Record Class CommandContext

java.lang.Object
java.lang.Record
net.apartium.cocoabeans.commands.CommandContext
Record Components:
sender - The sender of the command
option - The command option that was evaluated
args - commands raw args
commandName - command name
parsedArgs - parsed args

public record CommandContext(Sender sender, CommandInfo commandInfo, @Nullable net.apartium.cocoabeans.commands.CommandOption option, @Nullable BadCommandResponse error, String[] args, String commandName, Map<Class<?>,List<Object>> parsedArgs) extends Record
Represents the context of a command after it has been processed
  • Constructor Details

    • CommandContext

      public CommandContext(Sender sender, CommandInfo commandInfo, @Nullable @Nullable net.apartium.cocoabeans.commands.CommandOption option, @Nullable @Nullable BadCommandResponse error, String[] args, String commandName, Map<Class<?>,List<Object>> parsedArgs)
      Creates an instance of a CommandContext record class.
      Parameters:
      sender - the value for the sender record component
      commandInfo - the value for the commandInfo record component
      option - the value for the option record component
      error - the value for the error record component
      args - the value for the args record component
      commandName - the value for the commandName record component
      parsedArgs - the value for the parsedArgs record component
  • Method Details

    • 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
    • hashCode

      public final 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 final boolean equals(Object o)
      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:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • sender

      public Sender sender()
      Returns the value of the sender record component.
      Returns:
      the value of the sender record component
    • commandInfo

      public CommandInfo commandInfo()
      Returns the value of the commandInfo record component.
      Returns:
      the value of the commandInfo record component
    • option

      @Nullable public @Nullable net.apartium.cocoabeans.commands.CommandOption option()
      Returns the value of the option record component.
      Returns:
      the value of the option record component
    • error

      @Nullable public @Nullable BadCommandResponse error()
      Returns the value of the error record component.
      Returns:
      the value of the error record component
    • args

      public String[] args()
      Returns the value of the args record component.
      Returns:
      the value of the args record component
    • commandName

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

      public Map<Class<?>,List<Object>> parsedArgs()
      Returns the value of the parsedArgs record component.
      Returns:
      the value of the parsedArgs record component