Package ch.njol.skript.command
Class ScriptCommand
java.lang.Object
ch.njol.skript.command.ScriptCommand
- All Implemented Interfaces:
org.bukkit.command.CommandExecutor
,org.bukkit.command.TabCompleter
,org.bukkit.command.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
(org.bukkit.command.CommandSender sender, String commandLabel, String arguments) boolean
checkPermissions
(org.bukkit.command.CommandSender sender, org.bukkit.event.Event event) boolean
Gets the arguments this command takes.org.bukkit.command.PluginCommand
@Nullable Timespan
long
getElapsedMilliseconds
(UUID uuid, org.bukkit.event.Event event) getLabel()
@Nullable Date
getLastUsage
(UUID uuid, org.bukkit.event.Event event) getName()
long
getRemainingMilliseconds
(UUID uuid, org.bukkit.event.Event event) @Nullable Script
boolean
onCommand
(@Nullable org.bukkit.command.CommandSender sender, @Nullable org.bukkit.command.Command command, @Nullable String label, @Nullable String[] args) onTabComplete
(@Nullable org.bukkit.command.CommandSender sender, @Nullable org.bukkit.command.Command command, @Nullable String alias, @Nullable String[] args) void
register
(org.bukkit.command.SimpleCommandMap commandMap, Map<String, org.bukkit.command.Command> knownCommands, @Nullable Set<String> aliases) void
void
sendHelp
(org.bukkit.command.CommandSender sender) void
setElapsedMilliSeconds
(UUID uuid, org.bukkit.event.Event event, long milliseconds) void
setLastUsage
(UUID uuid, org.bukkit.event.Event event, @Nullable Date date) void
setRemainingMilliseconds
(UUID uuid, org.bukkit.event.Event event, long milliseconds) void
unregister
(org.bukkit.command.SimpleCommandMap commandMap, Map<String, org.bukkit.command.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 org.bukkit.command.CommandSender sender, @Nullable @Nullable org.bukkit.command.Command command, @Nullable @Nullable String label, @Nullable @Nullable String[] args) - Specified by:
onCommand
in interfaceorg.bukkit.command.CommandExecutor
-
execute
-
checkPermissions
-
checkPermissions
public boolean checkPermissions(org.bukkit.command.CommandSender sender, org.bukkit.event.Event event) -
sendHelp
public void sendHelp(org.bukkit.command.CommandSender sender) -
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
public org.bukkit.command.PluginCommand getBukkitCommand() -
getScript
-
onTabComplete
@Nullable public @Nullable List<String> onTabComplete(@Nullable @Nullable org.bukkit.command.CommandSender sender, @Nullable @Nullable org.bukkit.command.Command command, @Nullable @Nullable String alias, @Nullable @Nullable String[] args) - Specified by:
onTabComplete
in interfaceorg.bukkit.command.TabCompleter
-