java.lang.Object
com.github.cyberryan1.cybercore.spigot.command.settings.CommandSettings
com.github.cyberryan1.cybercore.spigot.command.settings.BaseCommand
Direct Known Subclasses:
CyberCommand, CyberSubCommand, CyberSuperCommand

public class BaseCommand extends CommandSettings
The base structure of all other command classes. Used to validate argument types, send messages, etc.
  • Constructor Details

  • Method Details

    • validateArgument

      public final boolean validateArgument(org.bukkit.command.CommandSender sender, String arg, int index)
      Validates that the argument provided is of the correct type
      Parameters:
      sender - The command sender
      arg - The argument
      index - The index of the argument
      Returns:
      True if the argument is valid or if the argument is not of a type, false otherwise
    • sendPermissionMsg

      public void sendPermissionMsg(org.bukkit.command.CommandSender sender)
      Sends the permission message to the sender
      Parameters:
      sender - the sender of the command
    • sendPermMsg

      public void sendPermMsg(org.bukkit.command.CommandSender sender)
      Sends the permission message to the sender
      Parameters:
      sender - the sender of the command
    • sendUsage

      public void sendUsage(org.bukkit.command.CommandSender sender)
      Sends the usage message to the sender
      Parameters:
      sender - the sender of the command
    • sendInvalidPlayerArg

      public void sendInvalidPlayerArg(org.bukkit.command.CommandSender sender, String name)
      Sends that the name provided isn't any player's name
      Parameters:
      sender - The person to send this message to
      name - The attempted username
    • sendInvalidIntegerArg

      public void sendInvalidIntegerArg(org.bukkit.command.CommandSender sender, String arg)
      Sends that the argument provided isn't an integer
      Parameters:
      sender - The person to send this message to
      arg - The attempted argument
    • sendInvalidDoubleArg

      public void sendInvalidDoubleArg(org.bukkit.command.CommandSender sender, String arg)
      Sends that the argument provided isn't a double
      Parameters:
      sender - The person to send this message to
      arg - The attempted argument
    • getArgTypes

      public final Map<Integer,ArgType> getArgTypes()
      Returns:
      The Map of arg index to ArgType
    • getArgType

      public final ArgType getArgType(int index)
      Parameters:
      index - The index of the argument to get
      Returns:
      The ArgType of the argument at the given index
    • getArgIndexes

      public final List<Integer> getArgIndexes(ArgType type)
      Parameters:
      type - The ArgType to search for
      Returns:
      A List of all the indexes of the given ArgType
    • getStringArgOptions

      public final Map<Integer,List<String>> getStringArgOptions()
      Returns:
      The Map of arg indexes that have been set as ArgType.STRING to the list of options for that argument
    • getStringArgOptions

      public final List<String> getStringArgOptions(int index)
      Parameters:
      index - The index of the argument to get
      Returns:
      The List of strings that are valid for the argument at the given index
    • getMinArgLength

      public final int getMinArgLength()
      Returns:
      The minimum length of the arguments
    • isValidatingArgs

      public final boolean isValidatingArgs()
      Returns:
      True if the arguments are validated, false otherwise
    • isSendingValidationMsg

      public final boolean isSendingValidationMsg()
      Returns:
      True if the sender is sent a message when the arguments are invalid, false otherwise
    • setArgType

      public final void setArgType(int index, ArgType type)
      Parameters:
      index - The index of the argument to set
      type - The ArgType to set the argument to
    • setStringArgOptions

      public final void setStringArgOptions(int index, List<String> options)
      Important Notes:
      Parameters:
      index - The index of the argument to set
      options - The List of strings that are valid for that argument

    • setMinArgLength

      public final void setMinArgLength(int length)
      Parameters:
      length - The minimum length of the arguments
    • setValidateArgs

      public final void setValidateArgs(boolean validate)
      Parameters:
      validate - True if the arguments are validated, false otherwise
    • setSendValidationMsg

      public final void setSendValidationMsg(boolean send)
      Parameters:
      send - True if the sender is sent a message when the arguments are invalid, false otherwise