接口 PluginManager

所有已知实现类:
SimplePluginManager

public interface PluginManager
Handles all plugin management from the Server
  • 方法详细资料

    • registerInterface

      void registerInterface(Class<? extends PluginLoader> loader) throws IllegalArgumentException
      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

      Plugin getPlugin(String name)
      Checks if the given plugin is loaded and returns it when applicable

      Please 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

      boolean isPluginEnabled(String name)
      Checks if the given plugin is enabled or not

      Please 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

      boolean isPluginEnabled(Plugin plugin)
      检查指定插件是否启用.

      原文: Checks if the given plugin is enabled or not.

      参数:
      plugin - Plugin to check
      返回:
      true if the plugin is enabled, otherwise false
    • loadPlugin

      Loads the plugin in the specified file

      File 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 plugin
      InvalidDescriptionException - Thrown when the specified file contains an invalid description
      UnknownDependencyException - If a required dependency could not be resolved
    • loadPlugins

      Plugin[] loadPlugins(File directory)
      载入指定目录内的插件.

      原文: 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

      void callEvent(Event event) throws IllegalStateException
      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

      void registerEvents(Listener listener, Plugin plugin)
      Registers all the events in the given listener class
      参数:
      listener - Listener to register
      plugin - 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 register
      listener - Listener to register
      priority - Priority to register this event at
      executor - EventExecutor to register
      plugin - 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 register
      listener - Listener to register
      priority - Priority to register this event at
      executor - EventExecutor to register
      plugin - Plugin to register
      ignoreCancelled - Whether to pass cancelled events or not
    • enablePlugin

      void enablePlugin(Plugin plugin)
      Enables the specified plugin

      Attempting to enable a plugin that is already enabled will have no effect

      参数:
      plugin - Plugin to enable
    • disablePlugin

      void disablePlugin(Plugin plugin)
      Disables the specified plugin

      Attempting to disable a plugin that is not enabled will have no effect

      参数:
      plugin - Plugin to disable
    • getPermission

      Permission getPermission(String name)
      Gets a Permission from its fully qualified name
      参数:
      name - Name of the permission
      返回:
      Permission, or null if none
    • addPermission

      void addPermission(Permission perm)
      Adds a 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 add
      抛出:
      IllegalArgumentException - Thrown when a permission with the same name already exists
    • removePermission

      void removePermission(Permission perm)
      Removes a 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 Permissibles that have it.

      参数:
      perm - Permission to remove
    • removePermission

      void removePermission(String name)
      Removes a 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 Permissibles that have it.

      参数:
      name - Permission to remove
    • getDefaultPermissions

      Set<Permission> getDefaultPermissions(boolean op)
      获取普通玩家默认拥有的权限或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

      void recalculatePermissionDefaults(Permission perm)
      Recalculates the defaults for the given Permission.

      This will have no effect if the specified permission is not registered here.

      参数:
      perm - Permission to recalculate
    • subscribeToPermission

      void subscribeToPermission(String permission, Permissible permissible)
      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 to
      permissible - Permissible subscribing
    • unsubscribeFromPermission

      void unsubscribeFromPermission(String permission, Permissible permissible)
      Unsubscribes the given Permissible for information about the requested Permission, by name.
      参数:
      permission - Permission to unsubscribe from
      permissible - Permissible subscribing
    • getPermissionSubscriptions

      Set<Permissible> getPermissionSubscriptions(String permission)
      Gets a set containing all subscribed Permissibles to the given permission, by name
      参数:
      permission - Permission to query for
      返回:
      Set containing all subscribed permissions
    • subscribeToDefaultPerms

      void subscribeToDefaultPerms(boolean op, Permissible permissible)
      Subscribes to the given Default permissions by operator status

      If the specified defaults change in any form, the Permissible will be asked to recalculate.

      参数:
      op - Default list to subscribe to
      permissible - Permissible subscribing
    • unsubscribeFromDefaultPerms

      void unsubscribeFromDefaultPerms(boolean op, Permissible permissible)
      Unsubscribes from the given Default permissions by operator status
      参数:
      op - Default list to unsubscribe from
      permissible - Permissible subscribing
    • getDefaultPermSubscriptions

      Set<Permissible> getDefaultPermSubscriptions(boolean op)
      Gets a set containing all subscribed Permissibles 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