Record Class Node
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. Iftrue, the permission is granted; iffalse, it is explicitly denied.expiry- The Unix timestamp (in milliseconds) at which this node expires. A value of0Lindicates a permanent node.
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
ConstructorsConstructorDescriptionConstructs a permanent Node with a specific key, defaulting the value totrue.Constructs a permanent Node with a specific key and value.Constructs a Node with a specific key, value, and expiry. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares this node to another object based on the key.longexpiry()Gets the expiration timestamp.booleanChecks if the current system time has passed the expiration timestamp.inthashCode()Generates a hash code based on the node key.booleanChecks if this node has a set expiration date.key()Gets the identifier key of this node.final StringtoString()Returns a string representation of this record class.booleanvalue()Gets the boolean state of this node.
-
Constructor Details
-
Node
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
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
Constructs a permanent Node with a specific key, defaulting the value totrue.- Parameters:
key- The permission or group key.
-
-
Method Details
-
key
-
value
public boolean value()Gets the boolean state of this node.- Returns:
trueif granted/active,falseif denied.
-
expiry
public long expiry()Gets the expiration timestamp.- Returns:
- The expiry time in milliseconds, or
0Lif permanent.
-
isTemporary
public boolean isTemporary()Checks if this node has a set expiration date.- Returns:
trueif the node is temporary,falseif permanent.
-
hasExpired
public boolean hasExpired()Checks if the current system time has passed the expiration timestamp.- Returns:
trueif temporary and expired,falseotherwise.
-
equals
-
hashCode
-
toString
-