SimplePluginManager
public interface PluginManager
Modifier and Type | Method | Description |
---|---|---|
void |
addPermission(Permission perm) |
Adds a
Permission to this plugin manager. |
void |
callEvent(Event event) |
Calls an event with the given details
|
void |
clearPlugins() |
Disables and removes all plugins
|
void |
disablePlugin(Plugin plugin) |
Disables the specified plugin
|
void |
disablePlugins() |
Disables all the loaded plugins
|
void |
enablePlugin(Plugin plugin) |
Enables the specified plugin
|
java.util.Set<Permission> |
getDefaultPermissions(boolean op) |
Gets the default permissions for the given op status
|
java.util.Set<Permissible> |
getDefaultPermSubscriptions(boolean op) |
Gets a set containing all subscribed
Permissible s to the given
default list, by op status |
Permission |
getPermission(java.lang.String name) |
Gets a
Permission from its fully qualified name |
java.util.Set<Permission> |
getPermissions() |
Gets a set of all registered permissions.
|
java.util.Set<Permissible> |
getPermissionSubscriptions(java.lang.String permission) |
Gets a set containing all subscribed
Permissible s to the given
permission, by name |
Plugin |
getPlugin(java.lang.String name) |
Checks if the given plugin is loaded and returns it when applicable
|
Plugin[] |
getPlugins() |
Gets a list of all currently loaded plugins
|
boolean |
isPluginEnabled(java.lang.String name) |
Checks if the given plugin is enabled or not
|
boolean |
isPluginEnabled(Plugin plugin) |
Checks if the given plugin is enabled or not
|
Plugin |
loadPlugin(java.io.File file) |
Loads the plugin in the specified file
|
Plugin[] |
loadPlugins(java.io.File directory) |
Loads the plugins contained within the specified directory
|
void |
recalculatePermissionDefaults(Permission perm) |
Recalculates the defaults for the given
Permission . |
void |
registerEvent(java.lang.Class<? extends Event> event,
Listener listener,
EventPriority priority,
EventExecutor executor,
Plugin plugin) |
Registers the specified executor to the given event class
|
void |
registerEvent(java.lang.Class<? extends Event> event,
Listener listener,
EventPriority priority,
EventExecutor executor,
Plugin plugin,
boolean ignoreCancelled) |
Registers the specified executor to the given event class
|
void |
registerEvents(Listener listener,
Plugin plugin) |
Registers all the events in the given listener class
|
void |
registerInterface(java.lang.Class<? extends PluginLoader> loader) |
Registers the specified plugin loader
|
void |
removePermission(java.lang.String name) |
Removes a
Permission registration from this plugin manager. |
void |
removePermission(Permission perm) |
Removes a
Permission registration from this plugin manager. |
void |
subscribeToDefaultPerms(boolean op,
Permissible permissible) |
Subscribes to the given Default permissions by operator status
|
void |
subscribeToPermission(java.lang.String permission,
Permissible permissible) |
Subscribes the given Permissible for information about the requested
Permission, by name.
|
void |
unsubscribeFromDefaultPerms(boolean op,
Permissible permissible) |
Unsubscribes from the given Default permissions by operator status
|
void |
unsubscribeFromPermission(java.lang.String permission,
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(java.lang.Class<? extends PluginLoader> loader) throws java.lang.IllegalArgumentException
loader
- Class name of the PluginLoader to registerjava.lang.IllegalArgumentException
- Thrown when the given Class is not a
valid PluginLoaderPlugin getPlugin(java.lang.String name)
Please note that the name of the plugin is case-sensitive
name
- Name of the plugin to checkPlugin[] getPlugins()
boolean isPluginEnabled(java.lang.String name)
Please note that the name of the plugin is case-sensitive.
name
- Name of the plugin to checkboolean isPluginEnabled(Plugin plugin)
plugin
- Plugin to checkPlugin loadPlugin(java.io.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 resolvedPlugin[] loadPlugins(java.io.File directory)
directory
- Directory to check for pluginsvoid disablePlugins()
void clearPlugins()
void callEvent(Event event) throws java.lang.IllegalStateException
event
- Event detailsjava.lang.IllegalStateException
- 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(Listener listener, Plugin plugin)
listener
- Listener to registerplugin
- Plugin to registervoid registerEvent(java.lang.Class<? extends Event> event, Listener listener, EventPriority priority, EventExecutor executor, Plugin plugin)
event
- Event type to registerlistener
- Listener to registerpriority
- Priority to register this event atexecutor
- EventExecutor to registerplugin
- Plugin to registervoid registerEvent(java.lang.Class<? extends Event> event, Listener listener, EventPriority priority, EventExecutor executor, 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(Plugin plugin)
Attempting to enable a plugin that is already enabled will have no effect
plugin
- Plugin to enablevoid disablePlugin(Plugin plugin)
Attempting to disable a plugin that is not enabled will have no effect
plugin
- Plugin to disablePermission getPermission(java.lang.String name)
Permission
from its fully qualified namename
- Name of the permissionvoid addPermission(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 addjava.lang.IllegalArgumentException
- Thrown when a permission with the same
name already existsvoid removePermission(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(java.lang.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 removejava.util.Set<Permission> getDefaultPermissions(boolean op)
op
- Which set of default permissions to getvoid recalculatePermissionDefaults(Permission perm)
Permission
.
This will have no effect if the specified permission is not registered here.
perm
- Permission to recalculatevoid subscribeToPermission(java.lang.String permission, 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(java.lang.String permission, Permissible permissible)
permission
- Permission to unsubscribe frompermissible
- Permissible subscribingjava.util.Set<Permissible> getPermissionSubscriptions(java.lang.String permission)
Permissible
s to the given
permission, by namepermission
- Permission to query forvoid subscribeToDefaultPerms(boolean op, 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, Permissible permissible)
op
- Default list to unsubscribe frompermissible
- Permissible subscribingjava.util.Set<Permissible> getDefaultPermSubscriptions(boolean op)
Permissible
s to the given
default list, by op statusop
- Default list to query forjava.util.Set<Permission> getPermissions()
This set is a copy and will not be modified live.
boolean useTimings()
Copyright © 2018. All rights reserved.