Record Class LimitContainer

java.lang.Object
java.lang.Record
nl.pim16aap2.animatedarchitecture.core.api.LimitContainer

public record LimitContainer(OptionalInt structureSizeLimit, OptionalInt structureCountLimit, OptionalInt powerBlockDistanceLimit, OptionalInt blocksToMoveLimit) extends Record
A record that contains the Limits for a player.
  • Constructor Details

    • LimitContainer

      public LimitContainer(@Nullable Integer structureSizeLimit, @Nullable Integer structureCountLimit, @Nullable Integer powerBlockDistanceLimit, @Nullable Integer blocksToMoveLimit)
    • LimitContainer

      public LimitContainer(int structureSizeLimit, int structureCountLimit, int powerBlockDistanceLimit, int blocksToMoveLimit)
    • LimitContainer

      public LimitContainer(OptionalInt structureSizeLimit, OptionalInt structureCountLimit, OptionalInt powerBlockDistanceLimit, OptionalInt blocksToMoveLimit)
      Creates an instance of a LimitContainer record class.
      Parameters:
      structureSizeLimit - the value for the structureSizeLimit record component
      structureCountLimit - the value for the structureCountLimit record component
      powerBlockDistanceLimit - the value for the powerBlockDistanceLimit record component
      blocksToMoveLimit - the value for the blocksToMoveLimit record component
  • Method Details

    • getLimit

      public OptionalInt getLimit(Limit limit)
      Gets the limit for the specified Limit.
      Parameters:
      limit - The Limit to get the limit for.
      Returns:
      The limit for the specified Limit.
    • of

      public static LimitContainer of(IPlayer player)
      Creates a LimitContainer from the given IPlayer.
      Parameters:
      player - The IPlayer to create the LimitContainer from.
      Returns:
      The created LimitContainer.
    • of

      public static LimitContainer of(PlayerData playerData)
      Creates a LimitContainer from the given PlayerData.
      Parameters:
      playerData - The PlayerData to create the LimitContainer from.
      Returns:
      The created LimitContainer.
    • 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.
    • structureSizeLimit

      public OptionalInt structureSizeLimit()
      Returns the value of the structureSizeLimit record component.
      Returns:
      the value of the structureSizeLimit record component
    • structureCountLimit

      public OptionalInt structureCountLimit()
      Returns the value of the structureCountLimit record component.
      Returns:
      the value of the structureCountLimit record component
    • powerBlockDistanceLimit

      public OptionalInt powerBlockDistanceLimit()
      Returns the value of the powerBlockDistanceLimit record component.
      Returns:
      the value of the powerBlockDistanceLimit record component
    • blocksToMoveLimit

      public OptionalInt blocksToMoveLimit()
      Returns the value of the blocksToMoveLimit record component.
      Returns:
      the value of the blocksToMoveLimit record component