类 BukkitPluginContext

java.lang.Object
cn.afternode.commons.bukkit.BukkitPluginContext

public class BukkitPluginContext extends Object
  • 构造器详细资料

    • BukkitPluginContext

      public BukkitPluginContext(org.bukkit.plugin.Plugin plg)
      参数:
      plg - Plugin instance will be used in registrations
  • 方法详细资料

    • registerPluginCommands

      public void registerPluginCommands(String packageName) throws RuntimeException
      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

      public void registerCommands(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 CommandMap
      参数:
      packageName - Package name for scanning
      抛出:
      cn.afternode.commons.ReflectionError - Error in reflections
      另请参阅:
    • registerListeners

      public void registerListeners(String packageName)
      Find classes with provided package name and register as event listener
      参数:
      packageName - Target package name
      另请参阅:
    • setDisplayName

      public void setDisplayName(String name)
      Set plugin display name
      参数:
      name - Target name
      另请参阅:
      • PluginDescriptionFile.getName()
    • message

      public MessageBuilder message(org.bukkit.command.CommandSender sender)
      Create MessageBuilder with localizations and prefix in this context
      参数:
      sender - Sender passed to MessageBuilder
      返回:
      builder
    • message

      public MessageBuilder 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

      public void loadLocalizations(String resource) throws IOException
      Load localizations from plugin resources
      参数:
      resource - Resource path
      抛出:
      IOException
    • createReport

      public PluginReport createReport()
      Create PluginReport
      返回:
      Report