Class AutoRegister

java.lang.Object
com.miketheshadow.autoregister.util.ReflectionBase
com.miketheshadow.autoregister.api.AutoRegister

public final class AutoRegister extends ReflectionBase
The core class of this tool. Automatically reads the jar file and attempts to register any listener and command available. Commands need to be annotated with RegisterCommand Listeners need to extend Spigots Listener class.
  • Constructor Details

    • AutoRegister

      public AutoRegister(org.bukkit.plugin.Plugin plugin, String packageName)
      Parameters:
      plugin - Your plugin. Do not pass in another plugin but your own into this method, or you will end up with weird/bad side effects
      packageName - A package path using . as the separator. Example: com.miketheshadow.autoregister Where autoregister is the base package directory. Do not pass in something like com. or com.name as this could have the unintended effect of registering any library's listeners as well.
  • Method Details

    • defaultSetup

      public void defaultSetup()
      This is what should be used by default. Unless you have your own custom auto-registry this method will handle the registering of commands and listeners for you.
    • registerListeners

      public void registerListeners()
      Registers all listener classes
    • registerCommands

      public void registerCommands()
      Registers all commands
    • registerFullCommands

      public void registerFullCommands()
    • getListeners

      public Set<Class<?>> getListeners()
      Returns:
      returns a Set of classes that implement Spigot's Listener class