Class CommandComponent
java.lang.Object
io.github.projectunified.minelib.plugin.command.CommandComponent
- All Implemented Interfaces:
Loadable
A component that manages the commands
-
Constructor Summary
ConstructorsConstructorDescriptionCommandComponent(BasePlugin plugin, Supplier<List<org.bukkit.command.Command>> commandSupplier) Create a new instanceCommandComponent(BasePlugin plugin, List<org.bukkit.command.Command> commands) Create a new instanceCommandComponent(BasePlugin plugin, org.bukkit.command.Command... commands) Create a new instance -
Method Summary
Modifier and TypeMethodDescriptionvoiddisable()Called when the component is disabledvoidenable()Called when the component is enabledGet registered commandsvoidregister(org.bukkit.command.Command command) Register the commandstatic voidregisterCommandToCommandMap(String label, org.bukkit.command.Command command) Register the command to the command mapstatic voidSync the commands to the server.voidunregister(String command) Unregister the commandvoidunregister(org.bukkit.command.Command command) Unregister the commandvoidUnregister all commandsstatic voidunregisterFromKnownCommands(org.bukkit.command.Command command) Unregister a command from the known commands
-
Constructor Details
-
CommandComponent
Create a new instance- Parameters:
plugin- the plugincommands- the commands
-
CommandComponent
Create a new instance- Parameters:
plugin- the plugincommands- the commands
-
CommandComponent
public CommandComponent(BasePlugin plugin, Supplier<List<org.bukkit.command.Command>> commandSupplier) Create a new instance- Parameters:
plugin- the plugincommandSupplier- the command supplier
-
-
Method Details
-
syncCommand
public static void syncCommand()Sync the commands to the server. Mainly used to make tab completer work in 1.13+ -
unregisterFromKnownCommands
public static void unregisterFromKnownCommands(org.bukkit.command.Command command) Unregister a command from the known commands- Parameters:
command- the command
-
registerCommandToCommandMap
Register the command to the command map- Parameters:
label- the label of the commandcommand- the command
-
register
public void register(org.bukkit.command.Command command) Register the command- Parameters:
command- the command object
-
unregister
public void unregister(org.bukkit.command.Command command) Unregister the command- Parameters:
command- the command object
-
unregister
Unregister the command- Parameters:
command- the command label
-
unregisterAll
public void unregisterAll()Unregister all commands -
getRegistered
Get registered commands- Returns:
- the map contains the name and the command object
-
enable
public void enable()Description copied from interface:LoadableCalled when the component is enabled -
disable
public void disable()Description copied from interface:LoadableCalled when the component is disabled
-