Class CommandComponent
java.lang.Object
io.github.projectunified.minelib.plugin.command.CommandComponent
- All Implemented Interfaces:
Loadable
A component that manages the commands
-
Constructor Summary
ConstructorDescriptionCommandComponent
(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 TypeMethodDescriptionvoid
disable()
Called when the component is disabledvoid
enable()
Called when the component is enabledGet registered commandsvoid
register
(org.bukkit.command.Command command) Register the commandstatic void
registerCommandToCommandMap
(String label, org.bukkit.command.Command command) Register the command to the command mapstatic void
Sync the commands to the server.void
unregister
(String command) Unregister the commandvoid
unregister
(org.bukkit.command.Command command) Unregister the commandvoid
Unregister all commandsstatic void
unregisterFromKnownCommands
(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:Loadable
Called when the component is enabled -
disable
public void disable()Description copied from interface:Loadable
Called when the component is disabled
-