接口 PluginManager
- 所有已知实现类:
SimplePluginManager
-
方法概要
修饰符和类型方法说明void
addPermission
(Permission perm) Adds aPermission
to this plugin manager.void
Calls an event with the given detailsvoid
停用并清除所有已启用插件的Plugin对象.void
disablePlugin
(Plugin plugin) Disables the specified pluginvoid
停用所有已载入的插件.void
enablePlugin
(Plugin plugin) Enables the specified plugingetDefaultPermissions
(boolean op) 获取普通玩家默认拥有的权限或op默认拥有的权限.getDefaultPermSubscriptions
(boolean op) Gets a set containing all subscribedPermissible
s to the given default list, by op statusgetPermission
(String name) Gets aPermission
from its fully qualified nameGets a set of all registered permissions.getPermissionSubscriptions
(String permission) Gets a set containing all subscribedPermissible
s to the given permission, by nameChecks if the given plugin is loaded and returns it when applicablePlugin[]
获取所有已载入的插件对象.boolean
isPluginEnabled
(String name) Checks if the given plugin is enabled or notboolean
isPluginEnabled
(Plugin plugin) 检查指定插件是否启用.loadPlugin
(File file) Loads the plugin in the specified filePlugin[]
loadPlugins
(File directory) 载入指定目录内的插件.void
Recalculates the defaults for the givenPermission
.void
registerEvent
(Class<? extends Event> event, Listener listener, EventPriority priority, EventExecutor executor, Plugin plugin) Registers the specified executor to the given event classvoid
registerEvent
(Class<? extends Event> event, Listener listener, EventPriority priority, EventExecutor executor, Plugin plugin, boolean ignoreCancelled) Registers the specified executor to the given event classvoid
registerEvents
(Listener listener, Plugin plugin) Registers all the events in the given listener classvoid
registerInterface
(Class<? extends PluginLoader> loader) Registers the specified plugin loadervoid
removePermission
(String name) Removes aPermission
registration from this plugin manager.void
removePermission
(Permission perm) Removes aPermission
registration from this plugin manager.void
subscribeToDefaultPerms
(boolean op, Permissible permissible) Subscribes to the given Default permissions by operator statusvoid
subscribeToPermission
(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 statusvoid
unsubscribeFromPermission
(String permission, Permissible permissible) Unsubscribes the given Permissible for information about the requested Permission, by name.boolean
Returns whether or not timing code should be used for event calls
-
方法详细资料
-
registerInterface
Registers the specified plugin loader- 参数:
loader
- Class name of the PluginLoader to register- 抛出:
IllegalArgumentException
- Thrown when the given Class is not a valid PluginLoader
-
getPlugin
Checks if the given plugin is loaded and returns it when applicablePlease note that the name of the plugin is case-sensitive
- 参数:
name
- Name of the plugin to check- 返回:
- Plugin if it exists, otherwise null
-
getPlugins
Plugin[] getPlugins()获取所有已载入的插件对象. 原文: Gets a list of all currently loaded plugins.- 返回:
- 返回类型为Plugin的数组
-
isPluginEnabled
Checks if the given plugin is enabled or notPlease note that the name of the plugin is case-sensitive.
- 参数:
name
- Name of the plugin to check- 返回:
- true if the plugin is enabled, otherwise false
-
isPluginEnabled
检查指定插件是否启用. 原文: Checks if the given plugin is enabled or not.- 参数:
plugin
- Plugin to check- 返回:
- true if the plugin is enabled, otherwise false
-
loadPlugin
Plugin loadPlugin(File file) throws InvalidPluginException, InvalidDescriptionException, UnknownDependencyException Loads the plugin in the specified fileFile must be valid according to the current enabled Plugin interfaces
- 参数:
file
- File containing the plugin to load- 返回:
- The Plugin loaded, or null if it was invalid
- 抛出:
InvalidPluginException
- 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
-
loadPlugins
载入指定目录内的插件. 原文: Loads the plugins contained within the specified directory.- 参数:
\u6307\u5b9a\u76ee\u5f55\u7684File\u5bf9\u8c61
-- 返回:
- 返回带有已成功载入的插件Plugin对象的数组
-
disablePlugins
void disablePlugins()停用所有已载入的插件. 原文: Disables all the loaded plugins. -
clearPlugins
void clearPlugins()停用并清除所有已启用插件的Plugin对象. 原文: Disables and removes all plugins. -
callEvent
Calls an event with the given details- 参数:
event
- Event details- 抛出:
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.
-
registerEvents
Registers all the events in the given listener class- 参数:
listener
- Listener to registerplugin
- Plugin to register
-
registerEvent
void registerEvent(Class<? extends Event> event, Listener listener, EventPriority priority, EventExecutor executor, Plugin plugin) Registers the specified executor to the given event class- 参数:
event
- Event type to registerlistener
- Listener to registerpriority
- Priority to register this event atexecutor
- EventExecutor to registerplugin
- Plugin to register
-
registerEvent
void registerEvent(Class<? extends Event> event, Listener listener, EventPriority priority, EventExecutor executor, Plugin plugin, boolean ignoreCancelled) Registers the specified executor to the given event class- 参数:
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 not
-
enablePlugin
Enables the specified pluginAttempting to enable a plugin that is already enabled will have no effect
- 参数:
plugin
- Plugin to enable
-
disablePlugin
Disables the specified pluginAttempting to disable a plugin that is not enabled will have no effect
- 参数:
plugin
- Plugin to disable
-
getPermission
Gets aPermission
from its fully qualified name- 参数:
name
- Name of the permission- 返回:
- Permission, or null if none
-
addPermission
Adds aPermission
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 add- 抛出:
IllegalArgumentException
- Thrown when a permission with the same name already exists
-
removePermission
Removes aPermission
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 remove
-
removePermission
Removes aPermission
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
-
getDefaultPermissions
获取普通玩家默认拥有的权限或op默认拥有的权限. 原文: Gets the default permissions for the given op status- 参数:
\u662f\u5426\u83b7\u53d6op\u72b6\u6001\u4e0b\u9ed8\u8ba4\u62e5\u6709\u7684\u6743\u9650
-- 返回:
- 返回 普通玩家/OP 默认拥有的权限
-
recalculatePermissionDefaults
Recalculates the defaults for the givenPermission
.This will have no effect if the specified permission is not registered here.
- 参数:
perm
- Permission to recalculate
-
subscribeToPermission
Subscribes the given Permissible for information about the requested Permission, by name.If the specified Permission changes in any form, the Permissible will be asked to recalculate.
- 参数:
permission
- Permission to subscribe topermissible
- Permissible subscribing
-
unsubscribeFromPermission
Unsubscribes the given Permissible for information about the requested Permission, by name.- 参数:
permission
- Permission to unsubscribe frompermissible
- Permissible subscribing
-
getPermissionSubscriptions
Gets a set containing all subscribedPermissible
s to the given permission, by name- 参数:
permission
- Permission to query for- 返回:
- Set containing all subscribed permissions
-
subscribeToDefaultPerms
Subscribes to the given Default permissions by operator statusIf the specified defaults change in any form, the Permissible will be asked to recalculate.
- 参数:
op
- Default list to subscribe topermissible
- Permissible subscribing
-
unsubscribeFromDefaultPerms
Unsubscribes from the given Default permissions by operator status- 参数:
op
- Default list to unsubscribe frompermissible
- Permissible subscribing
-
getDefaultPermSubscriptions
Gets a set containing all subscribedPermissible
s to the given default list, by op status- 参数:
op
- Default list to query for- 返回:
- Set containing all subscribed permissions
-
getPermissions
Set<Permission> getPermissions()Gets a set of all registered permissions.This set is a copy and will not be modified live.
- 返回:
- Set containing all current registered permissions
-
useTimings
boolean useTimings()Returns whether or not timing code should be used for event calls- 返回:
- True if event timings are to be used
-