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

public class ScriptCommand extends Object implements org.bukkit.command.TabExecutor
This class is used for user-defined commands.
  • Field Details

  • 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 - /name
      pattern - the Skript pattern used to parse the input into arguments.
      arguments - the list of Arguments this command takes
      description - description to display in /help
      prefix - the prefix of the command
      usage - message to display if the command was used incorrectly
      aliases - /alias1, /alias2, ...
      permission - permission or null if none
      permissionMessage - message to display if the player doesn't have the given permission
      node - 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 - /name
      pattern - the Skript pattern used to parse the input into arguments.
      arguments - the list of Arguments this command takes
      description - description to display in /help
      prefix - the prefix of the command
      usage - message to display if the command was used incorrectly
      aliases - /alias1, /alias2, ...
      permission - permission or null if none
      permissionMessage - message to display if the player doesn't have the given permission
      node - 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 interface org.bukkit.command.CommandExecutor
    • execute

      public boolean execute(org.bukkit.command.CommandSender sender, String commandLabel, String rest)
    • checkPermissions

      public boolean checkPermissions(org.bukkit.command.CommandSender sender, String commandLabel, String arguments)
    • checkPermissions

      public boolean checkPermissions(org.bukkit.command.CommandSender sender, org.bukkit.event.Event event)
    • sendHelp

      public void sendHelp(org.bukkit.command.CommandSender sender)
    • getArguments

      public List<Argument<?>> getArguments()
      Gets the arguments this command takes.
      Returns:
      The internal list of arguments. Do not modify it!
    • getPattern

      public String getPattern()
    • register

      public void register(org.bukkit.command.SimpleCommandMap commandMap, Map<String,org.bukkit.command.Command> knownCommands, @Nullable @Nullable Set<String> aliases)
    • unregister

      public void unregister(org.bukkit.command.SimpleCommandMap commandMap, Map<String,org.bukkit.command.Command> knownCommands, @Nullable @Nullable Set<String> aliases)
    • registerHelp

      public void registerHelp()
    • unregisterHelp

      public void unregisterHelp()
    • getName

      public String getName()
    • getPrefix

      public String getPrefix()
    • getLabel

      public String getLabel()
    • getCooldown

      @Nullable public @Nullable Timespan getCooldown()
    • getLastUsage

      @Nullable public @Nullable Date getLastUsage(UUID uuid, org.bukkit.event.Event event)
    • setLastUsage

      public void setLastUsage(UUID uuid, org.bukkit.event.Event event, @Nullable @Nullable Date date)
    • getRemainingMilliseconds

      public long getRemainingMilliseconds(UUID uuid, org.bukkit.event.Event event)
    • setRemainingMilliseconds

      public void setRemainingMilliseconds(UUID uuid, org.bukkit.event.Event event, long milliseconds)
    • getElapsedMilliseconds

      public long getElapsedMilliseconds(UUID uuid, org.bukkit.event.Event event)
    • setElapsedMilliSeconds

      public void setElapsedMilliSeconds(UUID uuid, org.bukkit.event.Event event, long milliseconds)
    • getCooldownBypass

      public String getCooldownBypass()
    • getAliases

      public List<String> getAliases()
    • getActiveAliases

      public List<String> getActiveAliases()
    • getBukkitCommand

      public org.bukkit.command.PluginCommand getBukkitCommand()
    • getScript

      @Nullable public @Nullable Script 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 interface org.bukkit.command.TabCompleter