Record Class RegisteredCommand

java.lang.Object
java.lang.Record
dev.jorel.commandapi.RegisteredCommand

public record RegisteredCommand(String commandName, List<String> argsAsStr, Optional<String> shortDescription, Optional<String> fullDescription, Optional<String[]> usageDescription, String[] aliases, CommandPermission permission) extends Record
Class to store a registered command which has its command name and a list of arguments as a string. The arguments are expected to be of the form node_name:class_name, for example value:IntegerArgument. This class also contains the information required to construct a meaningful help topic for a command
  • Constructor Details

    • RegisteredCommand

      public RegisteredCommand(String commandName, List<String> argsAsStr, Optional<String> shortDescription, Optional<String> fullDescription, Optional<String[]> usageDescription, String[] aliases, CommandPermission permission)
      Creates an instance of a RegisteredCommand record class.
      Parameters:
      commandName - the value for the commandName record component
      argsAsStr - the value for the argsAsStr record component
      shortDescription - the value for the shortDescription record component
      fullDescription - the value for the fullDescription record component
      usageDescription - the value for the usageDescription record component
      aliases - the value for the aliases record component
      permission - the value for the permission record component
  • Method Details

    • hashCode

      public int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public boolean equals(Object obj)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      obj - the object with which to compare
      Returns:
      true if this object is the same as the obj argument; false otherwise.
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • commandName

      public String commandName()
      Returns the value of the commandName record component.
      Returns:
      the value of the commandName record component
    • argsAsStr

      public List<String> argsAsStr()
      Returns the value of the argsAsStr record component.
      Returns:
      the value of the argsAsStr record component
    • shortDescription

      public Optional<String> shortDescription()
      Returns the value of the shortDescription record component.
      Returns:
      the value of the shortDescription record component
    • fullDescription

      public Optional<String> fullDescription()
      Returns the value of the fullDescription record component.
      Returns:
      the value of the fullDescription record component
    • usageDescription

      public Optional<String[]> usageDescription()
      Returns the value of the usageDescription record component.
      Returns:
      the value of the usageDescription record component
    • aliases

      public String[] aliases()
      Returns the value of the aliases record component.
      Returns:
      the value of the aliases record component
    • permission

      public CommandPermission permission()
      Returns the value of the permission record component.
      Returns:
      the value of the permission record component