java.lang.Object
java.lang.Record
com.github.darksoulq.abyssallib.server.permission.Node
Record Components:
key - The unique key identifying the permission or group (e.g., "minecraft.command.tp").
value - The boolean value of the node. If true, the permission is granted; if false, it is explicitly denied.
expiry - The Unix timestamp (in milliseconds) at which this node expires. A value of 0L indicates a permanent node.

public record Node(String key, boolean value, long expiry) extends Record
Represents a specific permission entry or group inheritance entry.

A Node can be permanent or temporary. When used in a PermissionHolder, it determines whether a specific permission string is granted or denied, or whether a group is inherited as a parent.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Node(String key)
    Constructs a permanent Node with a specific key, defaulting the value to true.
    Node(String key, boolean value)
    Constructs a permanent Node with a specific key and value.
    Node(String key, boolean value, long expiry)
    Constructs a Node with a specific key, value, and expiry.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Compares this node to another object based on the key.
    long
    Gets the expiration timestamp.
    boolean
    Checks if the current system time has passed the expiration timestamp.
    int
    Generates a hash code based on the node key.
    boolean
    Checks if this node has a set expiration date.
    key()
    Gets the identifier key of this node.
    final String
    Returns a string representation of this record class.
    boolean
    Gets the boolean state of this node.

    Methods inherited from class java.lang.Object

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

    • Node

      public Node(String key, boolean value, long expiry)
      Constructs a Node with a specific key, value, and expiry.
      Parameters:
      key - The permission or group key.
      value - The boolean state of the node.
      expiry - The expiration timestamp in milliseconds.
    • Node

      public Node(String key, boolean value)
      Constructs a permanent Node with a specific key and value.
      Parameters:
      key - The permission or group key.
      value - The boolean state of the node.
    • Node

      public Node(String key)
      Constructs a permanent Node with a specific key, defaulting the value to true.
      Parameters:
      key - The permission or group key.
  • Method Details

    • key

      public String key()
      Gets the identifier key of this node.
      Returns:
      The key string.
    • value

      public boolean value()
      Gets the boolean state of this node.
      Returns:
      true if granted/active, false if denied.
    • expiry

      public long expiry()
      Gets the expiration timestamp.
      Returns:
      The expiry time in milliseconds, or 0L if permanent.
    • isTemporary

      public boolean isTemporary()
      Checks if this node has a set expiration date.
      Returns:
      true if the node is temporary, false if permanent.
    • hasExpired

      public boolean hasExpired()
      Checks if the current system time has passed the expiration timestamp.
      Returns:
      true if temporary and expired, false otherwise.
    • equals

      public boolean equals(Object o)
      Compares this node to another object based on the key.
      Specified by:
      equals in class Record
      Parameters:
      o - The object to compare.
      Returns:
      true if the keys match.
    • hashCode

      public int hashCode()
      Generates a hash code based on the node key.
      Specified by:
      hashCode in class Record
      Returns:
      The hash code.
    • 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