Class FoundryCommand

java.lang.Object
net.lewmc.foundry.command.FoundryCommand
All Implemented Interfaces:
org.bukkit.command.CommandExecutor
Direct Known Subclasses:
FoundryConsoleCommand, FoundryPlayerCommand

public abstract class FoundryCommand extends Object implements org.bukkit.command.CommandExecutor
Foundry's command class.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
    hasPermission(org.bukkit.command.CommandSender sender, String permission)
    Checks if the CommandSender has the required permission.
    boolean
    onCommand(org.bukkit.command.CommandSender cs, org.bukkit.command.Command command, String label, String[] args)
    Runs the command.
    protected abstract boolean
    onRun(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args)
    Runs the command.
    protected abstract String
    Stores the permission that is required.

    Methods inherited from class java.lang.Object

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

    • FoundryCommand

      public FoundryCommand()
  • Method Details

    • requiredPermission

      protected abstract String requiredPermission()
      Stores the permission that is required.
      Returns:
      String - The permission string.
    • onRun

      protected abstract boolean onRun(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args)
      Runs the command.
      Parameters:
      sender - CommandSender - The sender of the command.
      command - Command - The command.
      label - String - Label for the command.
      args - String[] - Arguments passed to the command.
      Returns:
      boolean - If the command was successful.
    • hasPermission

      protected boolean hasPermission(org.bukkit.command.CommandSender sender, String permission)
      Checks if the CommandSender has the required permission.
      Parameters:
      sender - CommandSender - The sender of the command.
      permission - String - The permission string.
      Returns:
      boolean - If the CommandSender has the required permission.
    • onCommand

      public boolean onCommand(org.bukkit.command.CommandSender cs, org.bukkit.command.Command command, String label, String[] args)
      Runs the command.
      Specified by:
      onCommand in interface org.bukkit.command.CommandExecutor
      Parameters:
      cs - CommandSender - The sender of the command.
      command - Command - The command.
      label - String - Label for the command.
      args - String[] - Arguments passed to the command.
      Returns:
      boolean - If the command was successful.