类 BukkitPluginContext
java.lang.Object
cn.afternode.commons.bukkit.BukkitPluginContext
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明Create PluginReportcn.afternode.commons.localizations.ILocalizationsGet localizations of this contextnet.kyori.adventure.text.ComponentLikeGet message line prefix of this contextorg.bukkit.plugin.PluginGet plugin of this contextvoidloadLocalizations(String resource) Load localizations from plugin resourcesmessage()Create MessageBuilder with localizations and prefix in this contextmessage(org.bukkit.command.CommandSender sender) Create MessageBuilder with localizations and prefix in this contextvoidregisterCommands(String packageName) Find classes with provided package name and register as Command, target class must extend org.bukkit.command.Command
This method will register commands through CommandMapvoidregisterListeners(String packageName) Find classes with provided package name and register as event listenervoidregisterPluginCommands(String packageName) Find classes with provided package name and register as CommandExecutor/TabExecutorvoidsetDisplayName(String name) Set plugin display namevoidsetLocalizations(cn.afternode.commons.localizations.ILocalizations localizations) Set localizations of this contextvoidsetMessageLinePrefix(net.kyori.adventure.text.ComponentLike messageLinePrefix) Set message line prefix of this context
-
构造器详细资料
-
BukkitPluginContext
public BukkitPluginContext(org.bukkit.plugin.Plugin plg) - 参数:
plg- Plugin instance will be used in registrations
-
-
方法详细资料
-
registerPluginCommands
Find classes with provided package name and register as CommandExecutor/TabExecutor- 参数:
packageName- Target package name- 抛出:
RuntimeException- Not a valid CommandExecutor/TabExecutor; Unable to create instance- 另请参阅:
-
registerCommands
Find classes with provided package name and register as Command, target class must extend org.bukkit.command.Command
This method will register commands through CommandMap- 参数:
packageName- Package name for scanning- 抛出:
cn.afternode.commons.ReflectionError- Error in reflections- 另请参阅:
-
CommandMapCommandRegisterCommand
-
registerListeners
Find classes with provided package name and register as event listener- 参数:
packageName- Target package name- 另请参阅:
-
setDisplayName
Set plugin display name- 参数:
name- Target name- 另请参阅:
-
PluginDescriptionFile.getName()
-
message
Create MessageBuilder with localizations and prefix in this context- 参数:
sender- Sender passed to MessageBuilder- 返回:
- builder
-
message
Create MessageBuilder with localizations and prefix in this context- 返回:
- builder
-
getPlugin
public org.bukkit.plugin.Plugin getPlugin()Get plugin of this context- 返回:
- Plugin
-
getMessageLinePrefix
public net.kyori.adventure.text.ComponentLike getMessageLinePrefix()Get message line prefix of this context- 返回:
- Message line prefix
-
setMessageLinePrefix
public void setMessageLinePrefix(net.kyori.adventure.text.ComponentLike messageLinePrefix) Set message line prefix of this context- 参数:
messageLinePrefix- Prefix
-
getLocalizations
public cn.afternode.commons.localizations.ILocalizations getLocalizations()Get localizations of this context- 返回:
- Localizations
-
setLocalizations
public void setLocalizations(cn.afternode.commons.localizations.ILocalizations localizations) Set localizations of this context- 参数:
localizations- Localizations
-
loadLocalizations
Load localizations from plugin resources- 参数:
resource- Resource path- 抛出:
IOException
-
createReport
Create PluginReport- 返回:
- Report
-