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(File script, String name, String pattern, List<Argument<?>> arguments, String description, String usage, ArrayList<String> aliases, String permission, @Nullable VariableString permissionMessage, @Nullable Timespan cooldown, @Nullable VariableString cooldownMessage, String cooldownBypass, @Nullable VariableString cooldownStorage, int executableBy, List<TriggerItem> items)
      Creates a new SkriptCommand.
      Parameters:
      name - /name
      pattern -
      arguments - the list of Arguments this command takes
      description - description to display in /help
      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
      items - trigger to execute
  • Method Details

    • onCommand

      public boolean onCommand(@Nullable org.bukkit.command.CommandSender sender, @Nullable org.bukkit.command.Command command, @Nullable String label, @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)
    • 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 Set<String> aliases)
    • unregister

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

      public void registerHelp()
    • unregisterHelp

      public void unregisterHelp()
    • getName

      public String getName()
    • getLabel

      public String getLabel()
    • getCooldown

      public @Nullable Timespan getCooldown()
    • getLastUsage

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

      public void setLastUsage(UUID uuid, org.bukkit.event.Event event, @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

      public @Nullable File getScript()
    • onTabComplete

      public @Nullable List<String> onTabComplete(@Nullable org.bukkit.command.CommandSender sender, @Nullable org.bukkit.command.Command command, @Nullable String alias, @Nullable String[] args)
      Specified by:
      onTabComplete in interface org.bukkit.command.TabCompleter