Class BukkitScriptCommand

java.lang.Object
dev.magicmq.pyspigot.bukkit.manager.command.BukkitScriptCommand
All Implemented Interfaces:
dev.magicmq.pyspigot.manager.command.ScriptCommand, CommandExecutor, TabCompleter, TabExecutor

public class BukkitScriptCommand extends Object implements TabExecutor, dev.magicmq.pyspigot.manager.command.ScriptCommand
Represents a registered Bukkit command belonging to a script.
See Also:
  • Constructor Details

    • BukkitScriptCommand

      public BukkitScriptCommand(dev.magicmq.pyspigot.manager.script.Script script, PyFunction commandFunction, PyFunction tabFunction, String name, String description, String usage, List<String> aliases, String permission)
      Parameters:
      script - The script to which this command belongs
      commandFunction - The command function that should be called when the command is executed
      tabFunction - The tab function that should be called for tab completion of the command. Can be null
      name - The name of the command to register
      description - The description of the command. Use an empty string for no description
      usage - The usage message for the command
      aliases - A List of String containing all the aliases for this command. Use an empty list for no aliases
      permission - The required permission node to use this command. Can be null
  • Method Details

    • onCommand

      public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
      Specified by:
      onCommand in interface CommandExecutor
    • onTabComplete

      public List<String> onTabComplete(CommandSender sender, Command cmd, String alias, String[] args)
      Specified by:
      onTabComplete in interface TabCompleter
    • getScript

      public dev.magicmq.pyspigot.manager.script.Script getScript()
      Get the script associated with this command.
      Specified by:
      getScript in interface dev.magicmq.pyspigot.manager.command.ScriptCommand
      Returns:
      The script associated with this command
    • getName

      public String getName()
      Get the name of this command.
      Specified by:
      getName in interface dev.magicmq.pyspigot.manager.command.ScriptCommand
      Returns:
      The name of this command
    • getBukkitCommand

      public PluginCommand getBukkitCommand()
      Get the PluginCommand that underlies this ScriptCommand
      Returns:
      The underlying PluginCommand
    • initHelp

      protected void initHelp()
    • removeHelp

      protected void removeHelp()
    • toString

      public String toString()
      Prints a representation of this ScriptCommand in string format, including all variables that pertain to the command (such as name, label, description, etc.)
      Overrides:
      toString in class Object
      Returns:
      A string representation of the ScriptCommand