Class Command

java.lang.Object
net.jeqo.bloons.commands.manager.Command
Direct Known Subclasses:
CommandEquip, CommandForceEquip, CommandForceUnequip, CommandReload, CommandUnequip

public abstract class Command extends Object
The base class for all commands within the plugin
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The description of the command
    protected org.bukkit.plugin.java.JavaPlugin
    The plugin instance
  • Constructor Summary

    Constructors
    Constructor
    Description
    Command(org.bukkit.plugin.java.JavaPlugin providedPlugin)
    Creates a new command instance
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds alias commands to the current command, needed especially for the primary command name.
    abstract boolean
    execute(org.bukkit.command.CommandSender sender, String[] args)
    The functionality run on the successful execution of a command
    boolean
    hasRequirement(org.bukkit.command.CommandSender sender, CommandPermission permission)
    Checks if the command meets the requirements to be executed

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • plugin

      protected org.bukkit.plugin.java.JavaPlugin plugin
      The plugin instance
    • commandDescription

      public String commandDescription
      The description of the command
  • Constructor Details

    • Command

      public Command(org.bukkit.plugin.java.JavaPlugin providedPlugin)
      Creates a new command instance
      Parameters:
      providedPlugin - The plugin instance, type org.bukkit.plugin.java.JavaPlugin
  • Method Details

    • addCommandAlias

      public void addCommandAlias(String alias)
      Adds alias commands to the current command, needed especially for the primary command name. Note: All aliases added here must be added to the plugin.yml file
      Parameters:
      alias - The alias to add to the command, type java.lang.String
    • execute

      public abstract boolean execute(org.bukkit.command.CommandSender sender, String[] args) throws Exception
      The functionality run on the successful execution of a command
      Parameters:
      sender - The sender of the command, type org.bukkit.command.CommandSender
      args - The arguments of the command, type java.lang.String[]
      Returns:
      Whether the command was executed successfully, type boolean
      Throws:
      Exception - If an error occurs during command execution, type java.lang.Exception
    • hasRequirement

      public boolean hasRequirement(org.bukkit.command.CommandSender sender, CommandPermission permission)
      Checks if the command meets the requirements to be executed
      Parameters:
      sender - The sender of the command, type org.bukkit.command.CommandSender
      permission - The permission required to execute the command, type net.jeqo.bloons.commands.manager.types.CommandPermission
      Returns:
      Whether the command meets the requirements, type boolean