类 SimplePluginManager
- 所有已实现的接口:
PluginManager
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidaddPermission(@NotNull Permission perm) 添加一个Permission至本插件管理器.voidaddPermission(@NotNull Permission perm, boolean dirty) 已过时。void调用一个具有详细信息的事件.void停用并清除所有已启用插件的Plugin对象.void已过时。voiddisablePlugin(@NotNull Plugin plugin) 停用指定的插件.void停用所有已载入的插件.voidenablePlugin(@NotNull Plugin plugin) 启用指定插件.getDefaultPermissions(boolean op) 获取普通玩家默认拥有的权限或op默认拥有的权限.getDefaultPermSubscriptions(boolean op) 获取普通玩家/op默认权限列表已订阅的Permissible.getPermission(@NotNull String name) 以指定的完整权限节点获取对应Permission对象.获取已注册的权限的集合.getPermissionSubscriptions(@NotNull String permission) 根据权限名获取此权限已订阅的Permissible的集合.检测指定插件是否已加载并在合适时返回其对象.获取所有已载入的插件对象.booleanisPluginEnabled(@NotNull String name) 检测指定插件是否已启用.booleanisPluginEnabled(@Nullable Plugin plugin) 检查指定插件是否启用.booleanisTransitiveDepend(@NotNull PluginDescriptionFile plugin, @NotNull PluginDescriptionFile depend) loadPlugin(@NotNull File file) 加载某个文件为插件.loadPlugins(@NotNull File directory) 载入指定目录内的插件.loadPlugins(@NotNull File[] files) Loads the plugins in the list of the filesvoid重新计算指定权限的默认值.voidregisterEvent(@NotNull Class<? extends Event> event, @NotNull Listener listener, @NotNull EventPriority priority, @NotNull EventExecutor executor, @NotNull Plugin plugin) 将指定的执行器注册至指定的事件类.voidregisterEvent(@NotNull Class<? extends Event> event, @NotNull Listener listener, @NotNull EventPriority priority, @NotNull EventExecutor executor, @NotNull Plugin plugin, boolean ignoreCancelled) 将指定的执行器注册至指定的事件类.voidregisterEvents(@NotNull Listener listener, @NotNull Plugin plugin) 注册在指定监听器类中的所有事件.voidregisterInterface(@NotNull Class<? extends PluginLoader> loader) 注册指定的插件加载器.voidremovePermission(@NotNull String name) 从本插件管理器中移除已注册的权限.void从本插件管理器中移除已注册的权限.voidsubscribeToDefaultPerms(boolean op, @NotNull Permissible permissible) 为普通玩家/op默认权限订阅指定Permissible.voidsubscribeToPermission(@NotNull String permission, @NotNull Permissible permissible) 以指定的权限名订阅与其有关的 Permissible.voidunsubscribeFromDefaultPerms(boolean op, @NotNull Permissible permissible) 退订普通玩家/op默认权限已订阅的Permissible.voidunsubscribeFromPermission(@NotNull String permission, @NotNull Permissible permissible) 以指定的权限名退订与其有关的 Permissible.boolean返回是否在事件调用中使用插件计时器.voiduseTimings(boolean use) 设置服务器是否使用 Timings 监测每一个事件代码块的性能状况.
-
构造器详细资料
-
SimplePluginManager
-
-
方法详细资料
-
registerInterface
public void registerInterface(@NotNull @NotNull Class<? extends PluginLoader> loader) throws IllegalArgumentException 注册指定的插件加载器.原文:Registers the specified plugin loader
- 指定者:
registerInterface在接口中PluginManager- 参数:
loader- 要注册的 PluginLoader 类- 抛出:
IllegalArgumentException- 当给定的类不是一个有效的 PluginLoader 时抛出
-
loadPlugins
载入指定目录内的插件.原文: Loads the plugins contained within the specified directory.
- 指定者:
loadPlugins在接口中PluginManager- 参数:
directory- 指定目录的File对象- 返回:
- 返回带有已成功载入的插件Plugin对象的数组
-
loadPlugins
Loads the plugins in the list of the files- 指定者:
loadPlugins在接口中PluginManager- 参数:
files- List of files containing plugins to load- 返回:
- A list of all plugins loaded
-
loadPlugin
@Nullable public @Nullable Plugin loadPlugin(@NotNull @NotNull File file) throws InvalidPluginException, UnknownDependencyException 加载某个文件为插件.文件必须对当前的插件加载器有效才会被加载.
原文:Loads the plugin in the specified file
File must be valid according to the current enabled Plugin interfaces
- 指定者:
loadPlugin在接口中PluginManager- 参数:
file- 要加载的插件文件- 返回:
- 加载成功后的插件对象, 若插件文件无效返回null
- 抛出:
InvalidPluginException- 若指定文件不是一个有效的插件UnknownDependencyException- 若插件要求的依赖找不到
-
getPlugin
检测指定插件是否已加载并在合适时返回其对象.请注意插件名区分大小写.
原文:Checks if the given plugin is loaded and returns it when applicable
Please note that the name of the plugin is case-sensitive
- 指定者:
getPlugin在接口中PluginManager- 参数:
name- 要检测的插件的名称- 返回:
- 如果此插件存在, 返回对应插件对象, 否则返回null
-
getPlugins
从接口复制的说明:PluginManager获取所有已载入的插件对象.原文: Gets a list of all currently loaded plugins.
- 指定者:
getPlugins在接口中PluginManager- 返回:
- 返回类型为Plugin的数组
-
isPluginEnabled
检测指定插件是否已启用.请注意插件名区分大小写.
原文:Checks if the given plugin is enabled or not
Please note that the name of the plugin is case-sensitive.
- 指定者:
isPluginEnabled在接口中PluginManager- 参数:
name- 要检测的插件的名称- 返回:
- 如果此插件已启用, 返回true
-
isPluginEnabled
检查指定插件是否启用.原文: Checks if the given plugin is enabled or not.
- 指定者:
isPluginEnabled在接口中PluginManager- 参数:
plugin- 要检测的插件的对象- 返回:
- 如果此插件已启用, 返回true
-
enablePlugin
从接口复制的说明:PluginManager启用指定插件.尝试启用一个已启用的插件, 什么都不会发生.
原文:Enables the specified plugin
Attempting to enable a plugin that is already enabled will have no effect
- 指定者:
enablePlugin在接口中PluginManager- 参数:
plugin- 要启用的插件
-
disablePlugins
public void disablePlugins()从接口复制的说明:PluginManager停用所有已载入的插件.原文: Disables all the loaded plugins.
- 指定者:
disablePlugins在接口中PluginManager
-
disablePlugin
从接口复制的说明:PluginManager停用指定的插件.尝试停用一个已停用的插件, 什么都不会发生.
原文:Disables the specified plugin
Attempting to disable a plugin that is not enabled will have no effect
- 指定者:
disablePlugin在接口中PluginManager- 参数:
plugin- 要停用的插件
-
clearPlugins
public void clearPlugins()从接口复制的说明:PluginManager停用并清除所有已启用插件的Plugin对象.原文: Disables and removes all plugins.
- 指定者:
clearPlugins在接口中PluginManager
-
callEvent
调用一个具有详细信息的事件.译注:本方法是线程安全的, 但不可以在同步代码块/同步线程中触发异步事件, 也不可以从异步线程中触发同步事件.
原文:Calls an event with the given details
- 指定者:
callEvent在接口中PluginManager- 参数:
event- 事件- 抛出:
IllegalStateException- 当从同步代码中触发异步事件时抛出注意:这是插件开发者应尽的义务, 不应用其来测试同步状态. 这是逻辑流有缺陷的迹象
-
registerEvents
从接口复制的说明:PluginManager注册在指定监听器类中的所有事件.原文:Registers all the events in the given listener class
- 指定者:
registerEvents在接口中PluginManager- 参数:
listener- 要注册的监听器plugin- 注册事件的插件
-
registerEvent
public void registerEvent(@NotNull @NotNull Class<? extends Event> event, @NotNull @NotNull Listener listener, @NotNull @NotNull EventPriority priority, @NotNull @NotNull EventExecutor executor, @NotNull @NotNull Plugin plugin) 从接口复制的说明:PluginManager将指定的执行器注册至指定的事件类.原文:Registers the specified executor to the given event class
- 指定者:
registerEvent在接口中PluginManager- 参数:
event- 要注册的事件类型listener- 要注册的监听器priority- 要注册的事件的优先级executor- 要注册的EventExecutorplugin- 注册事件的插件
-
registerEvent
public 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) 将指定的执行器注册至指定的事件类.原文:Registers the specified executor to the given event class
- 指定者:
registerEvent在接口中PluginManager- 参数:
event- 要注册的事件类型listener- 要注册的监听器priority- 要注册的事件的优先级executor- 要注册的EventExecutorplugin- 注册事件的插件ignoreCancelled- 是否忽略已取消的事件
-
getPermission
从接口复制的说明:PluginManager以指定的完整权限节点获取对应Permission对象.原文:Gets a
Permissionfrom its fully qualified name- 指定者:
getPermission在接口中PluginManager- 参数:
name- Name of the permission- 返回:
- 对应
Permission对象, 若权限节点不存在返回null
-
addPermission
从接口复制的说明:PluginManager添加一个Permission至本插件管理器.如果已有同名权限, 会抛出一个异常.
原文:Adds a
Permissionto this plugin manager.If a permission is already defined with the given name of the new permission, an exception will be thrown.
- 指定者:
addPermission在接口中PluginManager- 参数:
perm- 要添加的权限
-
addPermission
@Deprecated(since="1.12") public void addPermission(@NotNull @NotNull Permission perm, boolean dirty) 已过时。 -
getDefaultPermissions
从接口复制的说明:PluginManager获取普通玩家默认拥有的权限或op默认拥有的权限.原文: Gets the default permissions for the given op status
- 指定者:
getDefaultPermissions在接口中PluginManager- 参数:
op- 是否获取op状态下默认拥有的权限- 返回:
- 返回 普通玩家/OP 默认拥有的权限
-
removePermission
从接口复制的说明:PluginManager从本插件管理器中移除已注册的权限.如果指定的权限未在本插件管理器中注册, 什么都不会发生.
原文:Removes a
Permissionregistration 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在接口中PluginManager- 参数:
perm- 要移除的权限
-
removePermission
从接口复制的说明:PluginManager从本插件管理器中移除已注册的权限.如果指定的权限未在本插件管理器中注册, 什么都不会发生.
原文:Removes a
Permissionregistration 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在接口中PluginManager- 参数:
name- 要移除的权限
-
recalculatePermissionDefaults
从接口复制的说明:PluginManager重新计算指定权限的默认值.若指定的权限未在本插件管理器注册, 将没有效果.
原文:Recalculates the defaults for the given
Permission.This will have no effect if the specified permission is not registered here.
- 指定者:
recalculatePermissionDefaults在接口中PluginManager- 参数:
perm- 要重算的权限
-
dirtyPermissibles
已过时。 -
subscribeToPermission
public void subscribeToPermission(@NotNull @NotNull String permission, @NotNull @NotNull Permissible permissible) 从接口复制的说明:PluginManager以指定的权限名订阅与其有关的 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.
- 指定者:
subscribeToPermission在接口中PluginManager- 参数:
permission- 要订阅的权限permissible- 要订阅的Permissible
-
unsubscribeFromPermission
public void unsubscribeFromPermission(@NotNull @NotNull String permission, @NotNull @NotNull Permissible permissible) 从接口复制的说明:PluginManager以指定的权限名退订与其有关的 Permissible.原文:Unsubscribes the given Permissible for information about the requested Permission, by name.
- 指定者:
unsubscribeFromPermission在接口中PluginManager- 参数:
permission- 要退订的权限permissible- 已订阅的Permissible
-
getPermissionSubscriptions
@NotNull public @NotNull Set<Permissible> getPermissionSubscriptions(@NotNull @NotNull String permission) 从接口复制的说明:PluginManager根据权限名获取此权限已订阅的Permissible的集合.原文:Gets a set containing all subscribed
Permissibles to the given permission, by name- 指定者:
getPermissionSubscriptions在接口中PluginManager- 参数:
permission- 要检索的权限- 返回:
- 包含此权限已订阅的所有
Permissible的集合
-
subscribeToDefaultPerms
从接口复制的说明:PluginManager为普通玩家/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.
- 指定者:
subscribeToDefaultPerms在接口中PluginManager- 参数:
op- 是否根据op的默认权限列表订阅permissible- 要订阅的Permissible
-
unsubscribeFromDefaultPerms
从接口复制的说明:PluginManager退订普通玩家/op默认权限已订阅的Permissible.原文:Unsubscribes from the given Default permissions by operator status
- 指定者:
unsubscribeFromDefaultPerms在接口中PluginManager- 参数:
op- 是否根据op的默认权限列表退订permissible- 权限已订阅的Permissible
-
getDefaultPermSubscriptions
从接口复制的说明:PluginManager获取普通玩家/op默认权限列表已订阅的Permissible.原文:Gets a set containing all subscribed
Permissibles to the given default list, by op status- 指定者:
getDefaultPermSubscriptions在接口中PluginManager- 参数:
op- 是否根据op的默认权限列表检索- 返回:
- 包含所有权限订阅者的集合
-
getPermissions
从接口复制的说明:PluginManager获取已注册的权限的集合.此集合是一个副本, 对其编辑不会作用于内部的权限列表.
原文:Gets a set of all registered permissions.
This set is a copy and will not be modified live.
- 指定者:
getPermissions在接口中PluginManager- 返回:
- 包含所有已注册权限的集合
-
isTransitiveDepend
public boolean isTransitiveDepend(@NotNull @NotNull PluginDescriptionFile plugin, @NotNull @NotNull PluginDescriptionFile depend) -
useTimings
public boolean useTimings()从接口复制的说明:PluginManager返回是否在事件调用中使用插件计时器.译注:Timings是一个性能分析工具, 通过Timings可以了解 服务器的性能损耗情况, 通过它可以定位插件/服务器代码中性能较差的方法, 并针对性地进行优化. 可以通过"/timings on"开始记录, "/timings paste"上传记录, "/timings off"关闭记录 (仅针对Spigot及其衍生服务端).
原文:Returns whether or not timing code should be used for event calls
- 指定者:
useTimings在接口中PluginManager- 返回:
- 若已启用Timings
-
useTimings
public void useTimings(boolean use) 设置服务器是否使用 Timings 监测每一个事件代码块的性能状况.原文:Sets whether or not per event timing code should be used
- 参数:
use- 是否使用 Timings
-