Package net.minheur.potoflux.terminal
Record Class Command
java.lang.Object
java.lang.Record
net.minheur.potoflux.terminal.Command
- Record Components:
id- the resource loc of the commandkey- the key to write in the terminal in the terminalcommandOutput- the output to print in the terminal. It takes a list of command argscommandHelp- something to print when the command is wrongly used, or with thehelpcommand.- if the command is hidden (if true, thecommandHelpshould 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 Summary
ConstructorsConstructorDescriptionCreates the command.
It is a hidden commandCommand(ResourceLocation id, String key, Consumer<List<String>> commandOutput, @NotNull String commandHelp) Creates the command.
It is a normal commandCommand(ResourceLocation id, String key, Consumer<List<String>> commandOutput, @Nullable String commandHelp, boolean hidden) Creates an instance of aCommandrecord class. -
Method Summary
Modifier and TypeMethodDescription@Nullable StringReturns the value of thecommandHelprecord component.Returns the value of thecommandOutputrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanhidden()Returns the value of thehiddenrecord component.id()Returns the value of theidrecord component.key()Returns the value of thekeyrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Command
public Command(ResourceLocation id, String key, Consumer<List<String>> commandOutput, @NotNull @NotNull String commandHelp) Creates the command.
It is a normal command- Parameters:
id- the resource loc of the commandkey- the key to write in the terminal in the terminalcommandOutput- the output to print in the terminal. It takes a list of command argscommandHelp- something to print when the command is wrongly used, or with the help command.
-
Command
Creates the command.
It is a hidden command- Parameters:
id- the resource loc of the commandkey- the key to write in the terminal in the terminalcommandOutput- 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 @Nullable String commandHelp, boolean hidden) Creates an instance of aCommandrecord class.- Parameters:
id- the value for theidrecord componentkey- the value for thekeyrecord componentcommandOutput- the value for thecommandOutputrecord componentcommandHelp- the value for thecommandHelprecord componenthidden- the value for thehiddenrecord component
-
-
Method Details
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
id
Returns the value of theidrecord component.- Specified by:
idin interfaceIRegistryType- Returns:
- the value of the
idrecord component
-
key
Returns the value of thekeyrecord component.- Returns:
- the value of the
keyrecord component
-
commandOutput
Returns the value of thecommandOutputrecord component.- Returns:
- the value of the
commandOutputrecord component
-
commandHelp
Returns the value of thecommandHelprecord component.- Returns:
- the value of the
commandHelprecord component
-