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
-
Constructor Summary
ConstructorDescriptionScriptCommand
(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 TypeMethodDescriptionboolean
checkPermissions
(CommandSender sender, String commandLabel, String arguments) boolean
checkPermissions
(CommandSender sender, Event event) boolean
execute
(CommandSender sender, String commandLabel, String rest) Gets the arguments this command takes.@Nullable Timespan
long
getElapsedMilliseconds
(UUID uuid, Event event) getLabel()
@Nullable Date
getLastUsage
(UUID uuid, Event event) getName()
long
getRemainingMilliseconds
(UUID uuid, Event event) @Nullable Script
boolean
onCommand
(@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) void
register
(SimpleCommandMap commandMap, Map<String, Command> knownCommands, @Nullable Set<String> aliases) void
void
sendHelp
(CommandSender sender) void
setElapsedMilliSeconds
(UUID uuid, Event event, long milliseconds) void
setLastUsage
(UUID uuid, Event event, @Nullable Date date) void
setRemainingMilliseconds
(UUID uuid, Event event, long milliseconds) void
unregister
(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:
onCommand
in 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:
onTabComplete
in interfaceTabCompleter
-