Class CommandLoader

java.lang.Object
io.github.simplexdevelopment.cl.CommandLoader

public class CommandLoader extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    CommandLoader(org.bukkit.plugin.Plugin plugin, String fallbackPrefix)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    This will load your commands and initialize them within Paper's CommandMap.
    void
    This method will register your command internally within the CommandLoader.
    void
    register(CommandBase... commands)
    This will run a loop for each command instance you input and register them all within one method.
    void
    This will effectively register all your commands and then load them into the Paper CommandMap.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CommandLoader

      public CommandLoader(org.bukkit.plugin.Plugin plugin, String fallbackPrefix)
      Parameters:
      plugin - Your plugin instance
      fallbackPrefix - The fallback prefix to use in case your plugin fails to provide a namespace.
  • Method Details

    • register

      public void register(CommandBase command)
      This method will register your command internally within the CommandLoader. Instances of commands will be cached and readied for loading into Paper. You should always run this before using load(), otherwise your commands will not be loaded.
      Parameters:
      command - A new instance of your command which should extend CommandBase.
    • register

      public void register(CommandBase... commands)
      This will run a loop for each command instance you input and register them all within one method. This simply runs the array through a stream and uses a lambda reference to register(CommandBase) in order to register the commands. Each command will be loaded in the order it is provided.
      Parameters:
      commands - An indefinite amount of command instances to be registered.
    • load

      public void load()
      This will load your commands and initialize them within Paper's CommandMap.
    • registerAndLoad

      public void registerAndLoad(CommandBase... commands)
      This will effectively register all your commands and then load them into the Paper CommandMap.
      Parameters:
      commands - An indefinite amount of command instances to be registered and loaded.