Package net.winmister332.libs.commands
Class CommandInvoker
java.lang.Object
net.winmister332.libs.commands.CommandInvoker
This is the class which handles the searching and invocation of all WMCommands.
-
Method Summary
Modifier and TypeMethodDescriptionbooleancommandExists(Command command) Checks if a command is registered and is recognised by the invoker.Command[]Gets all commands registered with the @see CommandInvoker.getCommand(String value) Gets the command with the specified name or alias.getCommandByAlias(String alias) Gets the command with the specified alias.getCommandByName(String name) Gets the command with the specified name.Command[]Gets only the commands which are visible to the user and are not hidden.static CommandInvokerGets an instance of the @see CommandInvoker class.static CommandInvokergetInstance(boolean parseQuotes, boolean ignoreInnerQuotes) Gets an instance of the @see CommandInvoker class.intGets the index of a command which was registered to the invoker.booleanProcess and invoke a string as a command.booleaninvoke(Command command, CommandArgs arguments, String cmdInput, org.bukkit.command.CommandSender sender) Process and invoke a string as a commanditerator()voidRegisteres a command with the invoker.voidregisterAll(Command... commands) Registeres a collection of Commands one at a time.voidUnregisters a specified command, so it cannot be invoked by the invoker.voidunregisterAll(Command... commands) Unregisters a collection of commands, so they cannot be invoked by the invoker.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
getInstance
Gets an instance of the @see CommandInvoker class.- Parameters:
parseQuotes- If true, all arguments surrounded in quotes will be treated as their own argument.ignoreInnerQuotes- If true, all inner escaped quotes are hidden and not shown as unescaped quotes.- Returns:
- The instance of the @see CommandInvoker with the specified settings.
-
getInstance
Gets an instance of the @see CommandInvoker class.- Returns:
- The instance of the @see CommandInvoker with the default settings.
-
register
Registeres a command with the invoker. If the command is not registered it will NOT be invoked.- Parameters:
command- The command to register.
-
registerAll
Registeres a collection of Commands one at a time.- Parameters:
commands- The collection of commands to register.
-
unregister
Unregisters a specified command, so it cannot be invoked by the invoker.- Parameters:
c- The command to unregister.
-
unregisterAll
Unregisters a collection of commands, so they cannot be invoked by the invoker.- Parameters:
commands- The collection of commands to unregister.
-
commandExists
Checks if a command is registered and is recognised by the invoker.- Parameters:
command- The command to check.- Returns:
- True if the command is found.
-
indexOf
Gets the index of a command which was registered to the invoker.- Parameters:
c- The command to check.- Returns:
- The index of the command if found, -1 if not found.
-
getAllCommands
Gets all commands registered with the @see CommandInvoker.- Returns:
-
getCommands
Gets only the commands which are visible to the user and are not hidden.- Returns:
- The visible commands.
-
getCommandByName
Gets the command with the specified name.- Parameters:
name- The name to check;- Returns:
- The command with the specified name if one is found.
-
getCommandByAlias
Gets the command with the specified alias.- Parameters:
alias- The alias to check.- Returns:
- The command with the specified name if one is found.
-
getCommand
Gets the command with the specified name or alias.- Parameters:
value- The name or alias to check.- Returns:
- The command with the specified name or alias.
-
invoke
Process and invoke a string as a command.- Parameters:
input- The raw input of the command to be processed and invoked.sender- The sender of the command. (Forwarded by a Bukkit command.)- Returns:
- True if the command invoked and completed successfully.
-
invoke
public boolean invoke(Command command, CommandArgs arguments, String cmdInput, org.bukkit.command.CommandSender sender) Process and invoke a string as a command- Parameters:
command- The command to invoke.arguments- The arguments associated with the command.cmdInput- The input label string typed associated with the command (the name or alias).sender- The sender forwarded by the Bukkit command.- Returns:
- True if the command executed successfully.
-
iterator
-