Class CommandUtils
- java.lang.Object
-
- com.alessiodp.core.common.commands.utils.CommandUtils
-
public abstract class CommandUtils extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCommandUtils.RegisterResultResult of register method
-
Constructor Summary
Constructors Constructor Description CommandUtils()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidexecuteCommand(@NotNull User sender, String mainCommand, @NotNull ADPSubCommand command, @NotNull String[] args)Trigger the command handler@NotNull StringhandleCommandString(@NotNull String[] args, int start)Handle string into a command, get the entire string since start to end of arguments@Nullable BooleanhandleOnOffCommand(@NotNull Boolean value, @NotNull String[] args)Handle on/off commandsabstract @NotNull CommandUtils.RegisterResultregister(@NotNull ADPMainCommand command)Register the command@NotNull List<String>tabCompleteOnOff(@NotNull String[] args)Handle on/off tab complete@NotNull List<String>tabCompleteParser(@NotNull List<String> commands, @NotNull String word)Parse tab complete command list@NotNull List<String>tabCompletePlayerList(@NotNull String[] args, int index)Insert player list inside tab complete@NotNull List<String>tabCompletePlayerList(@NotNull String[] args, int index, boolean bypassVanish)Insert player list inside tab complete
-
-
-
Field Detail
-
plugin
@NotNull protected final @NotNull ADPPlugin plugin
-
-
Method Detail
-
register
@NotNull public abstract @NotNull CommandUtils.RegisterResult register(@NotNull @NotNull ADPMainCommand command)
Register the command- Parameters:
command- the command to register- Returns:
- the register result
-
executeCommand
public void executeCommand(@NotNull @NotNull User sender, String mainCommand, @NotNull @NotNull ADPSubCommand command, @NotNull @NotNull String[] args)Trigger the command handler- Parameters:
sender- the user that is executing the commandmainCommand- the command performedcommand- the sub command performedargs- arguments of the command
-
handleOnOffCommand
@Nullable public @Nullable Boolean handleOnOffCommand(@NotNull @NotNull Boolean value, @NotNull @NotNull String[] args)
Handle on/off commands- Parameters:
value- the default valueargs- the command arguments- Returns:
- true if the result is on
-
handleCommandString
@NotNull public @NotNull String handleCommandString(@NotNull @NotNull String[] args, int start)
Handle string into a command, get the entire string since start to end of arguments- Parameters:
args- the command argumentsstart- the start of the string- Returns:
- the string
-
tabCompleteParser
@NotNull public @NotNull List<String> tabCompleteParser(@NotNull @NotNull List<String> commands, @NotNull @NotNull String word)
Parse tab complete command list- Parameters:
commands- the list of commandsword- the word to check- Returns:
- a list of commands that starts with word
-
tabCompleteOnOff
@NotNull public @NotNull List<String> tabCompleteOnOff(@NotNull @NotNull String[] args)
Handle on/off tab complete- Parameters:
args- the command arguments (on/off)- Returns:
- a list of on/off that match args
-
tabCompletePlayerList
@NotNull public @NotNull List<String> tabCompletePlayerList(@NotNull @NotNull String[] args, int index, boolean bypassVanish)
Insert player list inside tab complete- Parameters:
args- the command argumentsindex- the argument indexbypassVanish- show vanished players- Returns:
- a list of players that match args
-
-