Package io.github.simplexdevelopment.cl
Class CommandLoader
java.lang.Object
io.github.simplexdevelopment.cl.CommandLoader
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidload()This will load your commands and initialize them within Paper's CommandMap.voidregister(CommandBase command) This method will register your command internally within the CommandLoader.voidregister(CommandBase... commands) This will run a loop for each command instance you input and register them all within one method.voidregisterAndLoad(CommandBase... commands) This will effectively register all your commands and then load them into the Paper CommandMap.
-
Constructor Details
-
CommandLoader
- Parameters:
plugin- Your plugin instancefallbackPrefix- The fallback prefix to use in case your plugin fails to provide a namespace.
-
-
Method Details
-
register
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 usingload(), otherwise your commands will not be loaded.- Parameters:
command- A new instance of your command which should extend CommandBase.
-
register
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 toregister(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
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.
-