Record Class GameRule.Int

java.lang.Object
java.lang.Record
org.geysermc.geyser.level.gamerule.GameRule.Int
All Implemented Interfaces:
GameRule<Integer>
Enclosing interface:
GameRule<T>

public static record GameRule.Int(net.kyori.adventure.key.Key key, GameRuleCategory category, Integer defaultValue, int max, int min) extends Record implements GameRule<Integer>
  • Constructor Details

    • Int

      public Int(String key, GameRuleCategory category, Integer defaultValue, int max, int min)
    • Int

      public Int(net.kyori.adventure.key.Key key, GameRuleCategory category, Integer defaultValue, int max, int min)
      Creates an instance of a Int record class.
      Parameters:
      key - the value for the key record component
      category - the value for the category record component
      defaultValue - the value for the defaultValue record component
      max - the value for the max record component
      min - the value for the min record component
  • Method Details

    • adapter

      public TypeAdapter<Integer> adapter()
      Description copied from interface: GameRule
      The TypeAdapter used for this gamerule
      Specified by:
      adapter in interface GameRule<Integer>
    • validate

      public boolean validate(Integer value)
      Description copied from interface: GameRule
      ensures gamerule values are within range
      Specified by:
      validate in interface GameRule<Integer>
    • toComponent

      public org.geysermc.cumulus.component.Component toComponent(GeyserSession session, String currentValue)
      Specified by:
      toComponent in interface GameRule<Integer>
    • 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.
    • key

      public net.kyori.adventure.key.Key key()
      Returns the value of the key record component.
      Specified by:
      key in interface GameRule<Integer>
      Returns:
      the value of the key record component
    • category

      public GameRuleCategory category()
      Returns the value of the category record component.
      Specified by:
      category in interface GameRule<Integer>
      Returns:
      the value of the category record component
    • defaultValue

      public Integer defaultValue()
      Returns the value of the defaultValue record component.
      Specified by:
      defaultValue in interface GameRule<Integer>
      Returns:
      the value of the defaultValue record component
    • max

      public int max()
      Returns the value of the max record component.
      Returns:
      the value of the max record component
    • min

      public int min()
      Returns the value of the min record component.
      Returns:
      the value of the min record component