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.
SmartCommandsAPI api = new SmartCommandsAPI.ApiBuilder().build(this);
SmartCommandsManager scManager = api.getSmartCommandsManager();
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.
boolean isLoaded = scManager.isLoaded("item");
Get a SmartCommand by name
You can use the getSmartCommand(String name)
method to get the SmartCommand
instance associated to a command.
SmartCommand itemCommand = scManager.getSmartCommand("item");
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.
scManager.reloadCommandContents("item");
If you want to reload the contents of all the commands registered by the plugin, just use the reloadCommandContents()
method.
scManager.reloadCommandContents();
Last updated