Record Class LevelRule.Static

java.lang.Object
java.lang.Record
de.Keyle.MyPet.api.skill.skilltree.levelrule.LevelRule.Static
Record Components:
levels - the levels this rule matches
All Implemented Interfaces:
LevelRule
Enclosing interface:
LevelRule

public static record LevelRule.Static(Set<Integer> levels) extends Record implements LevelRule
Matches an explicit, fixed set of levels.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface de.Keyle.MyPet.api.skill.skilltree.levelrule.LevelRule

    LevelRule.Dynamic, LevelRule.Static
  • Constructor Summary

    Constructors
    Constructor
    Description
    Static(Set<Integer> levels)
    Defensively copies the level set.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    check(int level)
    Tests whether this rule matches the given level.
    final boolean
    Indicates whether some other object is "equal to" this one.
    int
    Returns the priority used to order this rule relative to other rules that match the same level.
    final int
    Returns a hash code value for this object.
    Returns the value of the levels record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Static

      public Static(Set<Integer> levels)
      Defensively copies the level set.
  • Method Details

    • check

      public boolean check(int level)
      Description copied from interface: LevelRule
      Tests whether this rule matches the given level.
      Specified by:
      check in interface LevelRule
      Parameters:
      level - the pet's current level (1-based)
      Returns:
      true if the associated upgrade/notification should activate
    • getPriority

      public int getPriority()
      Description copied from interface: LevelRule
      Returns the priority used to order this rule relative to other rules that match the same level. Lower values execute first.
      Specified by:
      getPriority in interface LevelRule
      Returns:
      the ordering priority
    • 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. 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.
    • levels

      public Set<Integer> levels()
      Returns the value of the levels record component.
      Returns:
      the value of the levels record component