SimplePluginManager
public interface PluginManager
Modifier and Type | Method | Description |
---|---|---|
void |
addPermission(@NotNull Permission perm) |
Adds a
Permission to this plugin manager. |
void |
callEvent(@NotNull Event event) |
Calls an event with the given details
|
void |
clearPlugins() |
Disables and removes all plugins
|
void |
disablePlugin(@NotNull Plugin plugin) |
Disables the specified plugin
|
void |
disablePlugin(@NotNull Plugin plugin,
boolean closeClassloader) |
Disables the specified plugin
|
void |
disablePlugins() |
Disables all the loaded plugins
|
void |
enablePlugin(@NotNull Plugin plugin) |
Enables the specified plugin
|
@NotNull Set<Permission> |
getDefaultPermissions(boolean op) |
Gets the default permissions for the given op status
|
@NotNull Set<Permissible> |
getDefaultPermSubscriptions(boolean op) |
Gets a set containing all subscribed
Permissible s to the given
default list, by op status |
@Nullable Permission |
getPermission(@NotNull String name) |
Gets a
Permission from its fully qualified name |
@NotNull Set<Permission> |
getPermissions() |
Gets a set of all registered permissions.
|
@NotNull Set<Permissible> |
getPermissionSubscriptions(@NotNull String permission) |
Gets a set containing all subscribed
Permissible s to the given
permission, by name |
@Nullable Plugin |
getPlugin(@NotNull String name) |
Checks if the given plugin is loaded and returns it when applicable
|
@NotNull Plugin[] |
getPlugins() |
Gets a list of all currently loaded plugins
|
boolean |
isPluginEnabled(@NotNull String name) |
Checks if the given plugin is enabled or not
|
boolean |
isPluginEnabled(@Nullable Plugin plugin) |
Checks if the given plugin is enabled or not
|
@Nullable Plugin |
loadPlugin(@NotNull File file) |
Loads the plugin in the specified file
|
@NotNull Plugin[] |
loadPlugins(@NotNull File directory) |
Loads the plugins contained within the specified directory
|
void |
recalculatePermissionDefaults(@NotNull Permission perm) |
Recalculates the defaults for the given
Permission . |
void |
registerEvent(@NotNull Class<? extends Event> event,
@NotNull Listener listener,
@NotNull EventPriority priority,
@NotNull EventExecutor executor,
@NotNull Plugin plugin) |
Registers the specified executor to the given event class
|
void |
registerEvent(@NotNull Class<? extends Event> event,
@NotNull Listener listener,
@NotNull EventPriority priority,
@NotNull EventExecutor executor,
@NotNull Plugin plugin,
boolean ignoreCancelled) |
Registers the specified executor to the given event class
|
void |
registerEvents(@NotNull Listener listener,
@NotNull Plugin plugin) |
Registers all the events in the given listener class
|
void |
registerInterface(@NotNull Class<? extends PluginLoader> loader) |
Registers the specified plugin loader
|
void |
removePermission(@NotNull String name) |
Removes a
Permission registration from this plugin manager. |
void |
removePermission(@NotNull Permission perm) |
Removes a
Permission registration from this plugin manager. |
void |
subscribeToDefaultPerms(boolean op,
@NotNull Permissible permissible) |
Subscribes to the given Default permissions by operator status
|
void |
subscribeToPermission(@NotNull String permission,
@NotNull Permissible permissible) |
Subscribes the given Permissible for information about the requested
Permission, by name.
|
void |
unsubscribeFromDefaultPerms(boolean op,
@NotNull Permissible permissible) |
Unsubscribes from the given Default permissions by operator status
|
void |
unsubscribeFromPermission(@NotNull String permission,
@NotNull Permissible permissible) |
Unsubscribes the given Permissible for information about the requested
Permission, by name.
|
boolean |
useTimings() |
Returns whether or not timing code should be used for event calls
|
void registerInterface(@NotNull @NotNull Class<? extends PluginLoader> loader) throws IllegalArgumentException
loader
- Class name of the PluginLoader to registerIllegalArgumentException
- Thrown when the given Class is not a
valid PluginLoader@Nullable @Nullable Plugin getPlugin(@NotNull @NotNull String name)
Please note that the name of the plugin is case-sensitive
name
- Name of the plugin to check@NotNull @NotNull Plugin[] getPlugins()
boolean isPluginEnabled(@NotNull @NotNull String name)
Please note that the name of the plugin is case-sensitive.
name
- Name of the plugin to check@Contract("null -> false") boolean isPluginEnabled(@Nullable @Nullable Plugin plugin)
plugin
- Plugin to check@Nullable @Nullable Plugin loadPlugin(@NotNull @NotNull File file) throws InvalidPluginException, InvalidDescriptionException, UnknownDependencyException
File must be valid according to the current enabled Plugin interfaces
file
- File containing the plugin to loadInvalidPluginException
- Thrown when the specified file is not a
valid pluginInvalidDescriptionException
- Thrown when the specified file
contains an invalid descriptionUnknownDependencyException
- If a required dependency could not
be resolved@NotNull @NotNull Plugin[] loadPlugins(@NotNull @NotNull File directory)
directory
- Directory to check for pluginsvoid disablePlugins()
void clearPlugins()
void callEvent(@NotNull @NotNull Event event) throws IllegalStateException
event
- Event detailsIllegalStateException
- Thrown when an asynchronous event is
fired from synchronous code.
Note: This is best-effort basis, and should not be used to test synchronized state. This is an indicator for flawed flow logic.
void registerEvents(@NotNull @NotNull Listener listener, @NotNull @NotNull Plugin plugin)
listener
- Listener to registerplugin
- Plugin to registervoid registerEvent(@NotNull @NotNull Class<? extends Event> event, @NotNull @NotNull Listener listener, @NotNull @NotNull EventPriority priority, @NotNull @NotNull EventExecutor executor, @NotNull @NotNull Plugin plugin)
event
- Event type to registerlistener
- Listener to registerpriority
- Priority to register this event atexecutor
- EventExecutor to registerplugin
- Plugin to registervoid registerEvent(@NotNull @NotNull Class<? extends Event> event, @NotNull @NotNull Listener listener, @NotNull @NotNull EventPriority priority, @NotNull @NotNull EventExecutor executor, @NotNull @NotNull Plugin plugin, boolean ignoreCancelled)
event
- Event type to registerlistener
- Listener to registerpriority
- Priority to register this event atexecutor
- EventExecutor to registerplugin
- Plugin to registerignoreCancelled
- Whether to pass cancelled events or notvoid enablePlugin(@NotNull @NotNull Plugin plugin)
Attempting to enable a plugin that is already enabled will have no effect
plugin
- Plugin to enablevoid disablePlugin(@NotNull @NotNull Plugin plugin)
Attempting to disable a plugin that is not enabled will have no effect
plugin
- Plugin to disablevoid disablePlugin(@NotNull @NotNull Plugin plugin, boolean closeClassloader)
Attempting to disable a plugin that is not enabled will have no effect
plugin
- Plugin to disablecloseClassloader
- if the classloader for the Plugin should be closed@Nullable @Nullable Permission getPermission(@NotNull @NotNull String name)
Permission
from its fully qualified namename
- Name of the permissionvoid addPermission(@NotNull @NotNull Permission perm)
Permission
to this plugin manager.
If a permission is already defined with the given name of the new permission, an exception will be thrown.
perm
- Permission to addIllegalArgumentException
- Thrown when a permission with the same
name already existsvoid removePermission(@NotNull @NotNull Permission perm)
Permission
registration from this plugin manager.
If the specified permission does not exist in this plugin manager, nothing will happen.
Removing a permission registration will not remove the
permission from any Permissible
s that have it.
perm
- Permission to removevoid removePermission(@NotNull @NotNull String name)
Permission
registration from this plugin manager.
If the specified permission does not exist in this plugin manager, nothing will happen.
Removing a permission registration will not remove the
permission from any Permissible
s that have it.
name
- Permission to remove@NotNull @NotNull Set<Permission> getDefaultPermissions(boolean op)
op
- Which set of default permissions to getvoid recalculatePermissionDefaults(@NotNull @NotNull Permission perm)
Permission
.
This will have no effect if the specified permission is not registered here.
perm
- Permission to recalculatevoid subscribeToPermission(@NotNull @NotNull String permission, @NotNull @NotNull Permissible permissible)
If the specified Permission changes in any form, the Permissible will be asked to recalculate.
permission
- Permission to subscribe topermissible
- Permissible subscribingvoid unsubscribeFromPermission(@NotNull @NotNull String permission, @NotNull @NotNull Permissible permissible)
permission
- Permission to unsubscribe frompermissible
- Permissible subscribing@NotNull @NotNull Set<Permissible> getPermissionSubscriptions(@NotNull @NotNull String permission)
Permissible
s to the given
permission, by namepermission
- Permission to query forvoid subscribeToDefaultPerms(boolean op, @NotNull @NotNull Permissible permissible)
If the specified defaults change in any form, the Permissible will be asked to recalculate.
op
- Default list to subscribe topermissible
- Permissible subscribingvoid unsubscribeFromDefaultPerms(boolean op, @NotNull @NotNull Permissible permissible)
op
- Default list to unsubscribe frompermissible
- Permissible subscribing@NotNull @NotNull Set<Permissible> getDefaultPermSubscriptions(boolean op)
Permissible
s to the given
default list, by op statusop
- Default list to query for@NotNull @NotNull Set<Permission> getPermissions()
This set is a copy and will not be modified live.
boolean useTimings()
Copyright © 2020. All rights reserved.