PluginManagerpublic final class SimplePluginManager extends Object implements PluginManager
| Constructor | Description |
|---|---|
SimplePluginManager(@NotNull Server instance,
@NotNull SimpleCommandMap commandMap) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
addPermission(@NotNull Permission perm) |
Adds a
Permission to this plugin manager. |
void |
addPermission(@NotNull Permission perm,
boolean dirty) |
Deprecated.
|
void |
callEvent(@NotNull Event event) |
Calls an event with the given details.
|
void |
clearPlugins() |
Disables and removes all plugins
|
void |
dirtyPermissibles() |
Deprecated.
|
void |
disablePlugin(@NotNull Plugin plugin) |
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
Permissibles 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
Permissibles 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
|
boolean |
isTransitiveDepend(@NotNull PluginDescriptionFile plugin,
@NotNull PluginDescriptionFile depend) |
|
@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 given event to the specified listener using a directly
passed EventExecutor
|
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 |
useTimings(boolean use) |
Sets whether or not per event timing code should be used
|
public SimplePluginManager(@NotNull
@NotNull Server instance,
@NotNull
@NotNull SimpleCommandMap commandMap)
public void registerInterface(@NotNull
@NotNull Class<? extends PluginLoader> loader)
throws IllegalArgumentException
registerInterface in interface PluginManagerloader - Class name of the PluginLoader to registerIllegalArgumentException - Thrown when the given Class is not a
valid PluginLoader@NotNull public @NotNull Plugin[] loadPlugins(@NotNull @NotNull File directory)
loadPlugins in interface PluginManagerdirectory - Directory to check for plugins@Nullable public @Nullable Plugin loadPlugin(@NotNull @NotNull File file) throws InvalidPluginException, UnknownDependencyException
File must be valid according to the current enabled Plugin interfaces
loadPlugin in interface PluginManagerfile - File containing the plugin to loadInvalidPluginException - Thrown when the specified file is not a
valid pluginUnknownDependencyException - If a required dependency could not
be found@Nullable public @Nullable Plugin getPlugin(@NotNull @NotNull String name)
Please note that the name of the plugin is case-sensitive
getPlugin in interface PluginManagername - Name of the plugin to check@NotNull public @NotNull Plugin[] getPlugins()
PluginManagergetPlugins in interface PluginManagerpublic boolean isPluginEnabled(@NotNull
@NotNull String name)
Please note that the name of the plugin is case-sensitive.
isPluginEnabled in interface PluginManagername - Name of the plugin to checkpublic boolean isPluginEnabled(@Nullable
@Nullable Plugin plugin)
isPluginEnabled in interface PluginManagerplugin - Plugin to checkpublic void enablePlugin(@NotNull
@NotNull Plugin plugin)
PluginManagerAttempting to enable a plugin that is already enabled will have no effect
enablePlugin in interface PluginManagerplugin - Plugin to enablepublic void disablePlugins()
PluginManagerdisablePlugins in interface PluginManagerpublic void disablePlugin(@NotNull
@NotNull Plugin plugin)
PluginManagerAttempting to disable a plugin that is not enabled will have no effect
disablePlugin in interface PluginManagerplugin - Plugin to disablepublic void clearPlugins()
PluginManagerclearPlugins in interface PluginManagerpublic void callEvent(@NotNull
@NotNull Event event)
callEvent in interface PluginManagerevent - Event detailspublic void registerEvents(@NotNull
@NotNull Listener listener,
@NotNull
@NotNull Plugin plugin)
PluginManagerregisterEvents in interface PluginManagerlistener - Listener to registerplugin - Plugin to registerpublic void registerEvent(@NotNull
@NotNull Class<? extends Event> event,
@NotNull
@NotNull Listener listener,
@NotNull
@NotNull EventPriority priority,
@NotNull
@NotNull EventExecutor executor,
@NotNull
@NotNull Plugin plugin)
PluginManagerregisterEvent in interface PluginManagerevent - Event type to registerlistener - Listener to registerpriority - Priority to register this event atexecutor - EventExecutor to registerplugin - Plugin to registerpublic void 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)
registerEvent in interface PluginManagerevent - Event class to registerlistener - PlayerListener to registerpriority - Priority of this eventexecutor - EventExecutor to registerplugin - Plugin to registerignoreCancelled - Do not call executor if event was already
cancelled@Nullable public @Nullable Permission getPermission(@NotNull @NotNull String name)
PluginManagerPermission from its fully qualified namegetPermission in interface PluginManagername - Name of the permissionpublic void addPermission(@NotNull
@NotNull Permission perm)
PluginManagerPermission to this plugin manager.
If a permission is already defined with the given name of the new permission, an exception will be thrown.
addPermission in interface PluginManagerperm - Permission to add@Deprecated public void addPermission(@NotNull @NotNull Permission perm, boolean dirty)
@NotNull public @NotNull Set<Permission> getDefaultPermissions(boolean op)
PluginManagergetDefaultPermissions in interface PluginManagerop - Which set of default permissions to getpublic void removePermission(@NotNull
@NotNull Permission perm)
PluginManagerPermission 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 Permissibles that have it.
removePermission in interface PluginManagerperm - Permission to removepublic void removePermission(@NotNull
@NotNull String name)
PluginManagerPermission 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 Permissibles that have it.
removePermission in interface PluginManagername - Permission to removepublic void recalculatePermissionDefaults(@NotNull
@NotNull Permission perm)
PluginManagerPermission.
This will have no effect if the specified permission is not registered here.
recalculatePermissionDefaults in interface PluginManagerperm - Permission to recalculate@Deprecated public void dirtyPermissibles()
public void subscribeToPermission(@NotNull
@NotNull String permission,
@NotNull
@NotNull Permissible permissible)
PluginManagerIf the specified Permission changes in any form, the Permissible will be asked to recalculate.
subscribeToPermission in interface PluginManagerpermission - Permission to subscribe topermissible - Permissible subscribingpublic void unsubscribeFromPermission(@NotNull
@NotNull String permission,
@NotNull
@NotNull Permissible permissible)
PluginManagerunsubscribeFromPermission in interface PluginManagerpermission - Permission to unsubscribe frompermissible - Permissible subscribing@NotNull public @NotNull Set<Permissible> getPermissionSubscriptions(@NotNull @NotNull String permission)
PluginManagerPermissibles to the given
permission, by namegetPermissionSubscriptions in interface PluginManagerpermission - Permission to query forpublic void subscribeToDefaultPerms(boolean op,
@NotNull
@NotNull Permissible permissible)
PluginManagerIf the specified defaults change in any form, the Permissible will be asked to recalculate.
subscribeToDefaultPerms in interface PluginManagerop - Default list to subscribe topermissible - Permissible subscribingpublic void unsubscribeFromDefaultPerms(boolean op,
@NotNull
@NotNull Permissible permissible)
PluginManagerunsubscribeFromDefaultPerms in interface PluginManagerop - Default list to unsubscribe frompermissible - Permissible subscribing@NotNull public @NotNull Set<Permissible> getDefaultPermSubscriptions(boolean op)
PluginManagerPermissibles to the given
default list, by op statusgetDefaultPermSubscriptions in interface PluginManagerop - Default list to query for@NotNull public @NotNull Set<Permission> getPermissions()
PluginManagerThis set is a copy and will not be modified live.
getPermissions in interface PluginManagerpublic boolean isTransitiveDepend(@NotNull
@NotNull PluginDescriptionFile plugin,
@NotNull
@NotNull PluginDescriptionFile depend)
public boolean useTimings()
PluginManageruseTimings in interface PluginManagerpublic void useTimings(boolean use)
use - True if per event timing code should be usedCopyright © 2020. All rights reserved.