Package ch.njol.skript.command
Class ScriptCommand
java.lang.Object
ch.njol.skript.command.ScriptCommand
- All Implemented Interfaces:
CommandExecutor,TabCompleter,TabExecutor
This class is used for user-defined commands.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionScriptCommand(Script script, String name, String pattern, List<Argument<?>> arguments, String description, @Nullable String prefix, CommandUsage usage, List<String> aliases, String permission, @Nullable VariableString permissionMessage, @Nullable Timespan cooldown, @Nullable VariableString cooldownMessage, String cooldownBypass, @Nullable VariableString cooldownStorage, int executableBy, SectionNode node) Creates a new ScriptCommand.ScriptCommand(Script script, String name, String pattern, List<Argument<?>> arguments, String description, @Nullable String prefix, String usage, List<String> aliases, String permission, @Nullable VariableString permissionMessage, @Nullable Timespan cooldown, @Nullable VariableString cooldownMessage, String cooldownBypass, @Nullable VariableString cooldownStorage, int executableBy, SectionNode node) Creates a new ScriptCommand. -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckPermissions(CommandSender sender, String commandLabel, String arguments) booleancheckPermissions(CommandSender sender, Event event) booleanexecute(CommandSender sender, String commandLabel, String rest) Gets the arguments this command takes.@Nullable TimespanlonggetElapsedMilliseconds(UUID uuid, Event event) getLabel()@Nullable DategetLastUsage(UUID uuid, Event event) getName()longgetRemainingMilliseconds(UUID uuid, Event event) @Nullable ScriptbooleanonCommand(@Nullable CommandSender sender, @Nullable Command command, @Nullable String label, @Nullable String[] args) onTabComplete(@Nullable CommandSender sender, @Nullable Command command, @Nullable String alias, @Nullable String[] args) voidregister(SimpleCommandMap commandMap, Map<String, Command> knownCommands, @Nullable Set<String> aliases) voidvoidsendHelp(CommandSender sender) voidsetElapsedMilliSeconds(UUID uuid, Event event, long milliseconds) voidsetLastUsage(UUID uuid, Event event, @Nullable Date date) voidsetRemainingMilliseconds(UUID uuid, Event event, long milliseconds) voidunregister(SimpleCommandMap commandMap, Map<String, Command> knownCommands, @Nullable Set<String> aliases) void
-
Field Details
-
m_executable_by_players
-
m_executable_by_console
-
PLAYERS
public static final int PLAYERS- See Also:
-
CONSOLE
public static final int CONSOLE- See Also:
-
BOTH
public static final int BOTH- See Also:
-
-
Constructor Details
-
ScriptCommand
public ScriptCommand(Script script, String name, String pattern, List<Argument<?>> arguments, String description, @Nullable @Nullable String prefix, String usage, List<String> aliases, String permission, @Nullable @Nullable VariableString permissionMessage, @Nullable @Nullable Timespan cooldown, @Nullable @Nullable VariableString cooldownMessage, String cooldownBypass, @Nullable @Nullable VariableString cooldownStorage, int executableBy, SectionNode node) Creates a new ScriptCommand. Prefer using the CommandUsage class for the usage parameter.- Parameters:
name- /namepattern- the Skript pattern used to parse the input into arguments.arguments- the list of Arguments this command takesdescription- description to display in /helpprefix- the prefix of the commandusage- message to display if the command was used incorrectlyaliases- /alias1, /alias2, ...permission- permission or null if nonepermissionMessage- message to display if the player doesn't have the given permissionnode- the node to parse and load into a Trigger
-
ScriptCommand
public ScriptCommand(Script script, String name, String pattern, List<Argument<?>> arguments, String description, @Nullable @Nullable String prefix, CommandUsage usage, List<String> aliases, String permission, @Nullable @Nullable VariableString permissionMessage, @Nullable @Nullable Timespan cooldown, @Nullable @Nullable VariableString cooldownMessage, String cooldownBypass, @Nullable @Nullable VariableString cooldownStorage, int executableBy, SectionNode node) Creates a new ScriptCommand.- Parameters:
name- /namepattern- the Skript pattern used to parse the input into arguments.arguments- the list of Arguments this command takesdescription- description to display in /helpprefix- the prefix of the commandusage- message to display if the command was used incorrectlyaliases- /alias1, /alias2, ...permission- permission or null if nonepermissionMessage- message to display if the player doesn't have the given permissionnode- the node to parse and load into a Trigger
-
-
Method Details
-
onCommand
public boolean onCommand(@Nullable @Nullable CommandSender sender, @Nullable @Nullable Command command, @Nullable @Nullable String label, @Nullable @Nullable String[] args) - Specified by:
onCommandin interfaceCommandExecutor
-
execute
-
checkPermissions
-
checkPermissions
-
sendHelp
-
getArguments
Gets the arguments this command takes.- Returns:
- The internal list of arguments. Do not modify it!
-
getPattern
-
register
-
unregister
-
registerHelp
public void registerHelp() -
unregisterHelp
public void unregisterHelp() -
getName
-
getPrefix
-
getLabel
-
getCooldown
-
getLastUsage
-
setLastUsage
-
getRemainingMilliseconds
-
setRemainingMilliseconds
-
getElapsedMilliseconds
-
setElapsedMilliSeconds
-
getCooldownBypass
-
getAliases
-
getActiveAliases
-
getBukkitCommand
-
getScript
-
onTabComplete
@Nullable public @Nullable List<String> onTabComplete(@Nullable @Nullable CommandSender sender, @Nullable @Nullable Command command, @Nullable @Nullable String alias, @Nullable @Nullable String[] args) - Specified by:
onTabCompletein interfaceTabCompleter
-