Record Class Command

java.lang.Object
java.lang.Record
net.minheur.potoflux.terminal.Command
Record Components:
id - the resource loc of the command
key - the key to write in the terminal in the terminal
commandOutput - the output to print in the terminal. It takes a list of command args
commandHelp - something to print when the command is wrongly used, or with the help command.
hidden - if the command is hidden (if true, the commandHelp should be null).
All Implemented Interfaces:
IRegistryType

public record Command(ResourceLocation id, String key, Consumer<List<String>> commandOutput, @Nullable String commandHelp, boolean hidden) extends Record implements IRegistryType
A class used to register a command.
  • Constructor Details

    • Command

      public Command(ResourceLocation id, String key, Consumer<List<String>> commandOutput, @Nonnull String commandHelp)
      Creates the command.
      It is a normal command
      Parameters:
      id - the resource loc of the command
      key - the key to write in the terminal in the terminal
      commandOutput - the output to print in the terminal. It takes a list of command args
      commandHelp - something to print when the command is wrongly used, or with the help command.
    • Command

      public Command(ResourceLocation id, String key, Consumer<List<String>> commandOutput)
      Creates the command.
      It is a hidden command
      Parameters:
      id - the resource loc of the command
      key - the key to write in the terminal in the terminal
      commandOutput - the output to print in the terminal. It takes a list of command args
    • Command

      public Command(ResourceLocation id, String key, Consumer<List<String>> commandOutput, @Nullable String commandHelp, boolean hidden)
      Creates an instance of a Command record class.
      Parameters:
      id - the value for the id record component
      key - the value for the key record component
      commandOutput - the value for the commandOutput record component
      commandHelp - the value for the commandHelp record component
      hidden - the value for the hidden record component
  • Method Details

    • toString

      public final 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • id

      public ResourceLocation id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • key

      public String key()
      Returns the value of the key record component.
      Returns:
      the value of the key record component
    • commandOutput

      public Consumer<List<String>> commandOutput()
      Returns the value of the commandOutput record component.
      Returns:
      the value of the commandOutput record component
    • commandHelp

      @Nullable public String commandHelp()
      Returns the value of the commandHelp record component.
      Returns:
      the value of the commandHelp record component
    • hidden

      public boolean hidden()
      Returns the value of the hidden record component.
      Returns:
      the value of the hidden record component