Record Class KeyboardShortcut

java.lang.Object
java.lang.Record
forgottentowns.mod.api.KeyboardShortcut
Record Components:
id - namespaced command identity belonging to the registering mod
labelKey - translation key owned by that mod
command - shared UI operation to invoke
key - default GLFW physical key code
modifiers - default GLFW Shift, Control, Alt and Super bits
legacyBinding - previous settings identity to migrate, or empty for a new command

public record KeyboardShortcut(String id, String labelKey, KeyboardShortcut.Command command, int key, int modifiers, String legacyBinding) extends Record
A mod-owned keyboard command, registered at startup and remappable without restarting.
  • Constructor Details

    • KeyboardShortcut

      public KeyboardShortcut(String id, String labelKey, KeyboardShortcut.Command command, int key, int modifiers, String legacyBinding)
      Validates the portable shortcut definition.
      Parameters:
      id - namespaced command identity
      labelKey - owned translation key
      command - shared UI operation
      key - default physical key code
      modifiers - modifier mask between zero and fifteen
      legacyBinding - obsolete unnamespaced preference identity, or empty
      Throws:
      IllegalArgumentException - if an identity, command, key or modifier is invalid
  • 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 String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • labelKey

      public String labelKey()
      Returns the value of the labelKey record component.
      Returns:
      the value of the labelKey record component
    • command

      public KeyboardShortcut.Command command()
      Returns the value of the command record component.
      Returns:
      the value of the command record component
    • key

      public int key()
      Returns the value of the key record component.
      Returns:
      the value of the key record component
    • modifiers

      public int modifiers()
      Returns the value of the modifiers record component.
      Returns:
      the value of the modifiers record component
    • legacyBinding

      public String legacyBinding()
      Returns the value of the legacyBinding record component.
      Returns:
      the value of the legacyBinding record component