Record Class PlayerData

java.lang.Object
java.lang.Record
nl.pim16aap2.animatedarchitecture.core.api.PlayerData
Record Components:
uuid - The UUID of the player.
name - The name of the player.
limits - The limits of the player.
isOp - Whether the player is an operator.
hasProtectionBypassPermission - Whether the player has the permission to bypass protection.

public record PlayerData(UUID uuid, String name, LimitContainer limits, boolean isOp, boolean hasProtectionBypassPermission) extends Record
Represents the data of a player.
  • Constructor Details

    • PlayerData

      public PlayerData(UUID uuid, String name, LimitContainer limits, long permissionsFlag)
      Creates a new PlayerData instance with the specified parameters.
      Parameters:
      uuid - The UUID of the player.
      name - The name of the player.
      limits - The limits of the player.
      permissionsFlag - The permissions flag of the player. See IPlayerDataContainer.PermissionFlag. This bit flag is used to set isOp() and hasProtectionBypassPermission() from IPlayerDataContainer.PermissionFlag.OP and IPlayerDataContainer.PermissionFlag.BYPASS respectively.
    • PlayerData

      public PlayerData(UUID uuid, String name, LimitContainer limits, boolean isOp, boolean hasProtectionBypassPermission)
      Creates an instance of a PlayerData record class.
      Parameters:
      uuid - the value for the uuid record component
      name - the value for the name record component
      limits - the value for the limits record component
      isOp - the value for the isOp record component
      hasProtectionBypassPermission - the value for the hasProtectionBypassPermission 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 value of the specified Limit for this player.
    • getPlayerData

      public PlayerData getPlayerData()
    • getName

      public String getName()
    • getUUID

      public UUID getUUID()
    • hasProtectionBypassPermission

      public boolean hasProtectionBypassPermission()
      Returns the value of the hasProtectionBypassPermission record component.
      Returns:
      the value of the hasProtectionBypassPermission record component
    • 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 the compare method from their corresponding wrapper classes.
      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.
    • uuid

      public UUID uuid()
      Returns the value of the uuid record component.
      Returns:
      the value of the uuid record component
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • limits

      public LimitContainer limits()
      Returns the value of the limits record component.
      Returns:
      the value of the limits record component
    • isOp

      public boolean isOp()
      Returns the value of the isOp record component.
      Returns:
      the value of the isOp record component
    • asString

      default String asString()
      Gets the player as a String in the format '"playerName" (playerUUID)'.
      Returns:
      The player as a String.
    • getPermissionsFlag

      default long getPermissionsFlag()