SmartCommandsManager
This is a guide to learn how to use the SmartCommandsManager class.
What is SmartCommandsManager ?
SmartCommandsManager
is a class which allows you to manage your commands. Indeed, it provides many features like checking if a command is loaded, getting a SmartCommand
or reloading its contents.
You can get it by using the getSmartCommandsManager()
method from the SmartCommandsAPI
class.
Check if a command is loaded
This class allows you to check if a command is correcly loaded by using the isLoaded(String name)
method which takes as parameter the name of the command you want to check.
A command is considered as loaded if it meets two criteria:
The command is stored in the commands.json file without syntax errors.
Its contents has been loaded without errors (only if it has a contents file).
Get a SmartCommand by name
You can use the getSmartCommand(String name)
method to get the SmartCommand
instance associated to a command.
SmartCommand is a class used to store command data. You can read this guide to get more information about it.
Reload command contents
This class also allows you to reload the contents of one or more command. To reload the contents of only one command, you can use the reloadCommandContents(String name)
method which takes as parameter the name of the command you want to reload.
If you want to reload the contents of all the commands registered by the plugin, just use the reloadCommandContents()
method.
Last updated