Class PermissionNode<T>

java.lang.Object
net.neoforged.neoforge.server.permission.nodes.PermissionNode<T>

public final class PermissionNode<T> extends Object
Represents the basic unit at the heart of the permission system.

A permission indicates the ability for an actor to perform an action, in its most general sense. In the permission system, all permissions are encoded as instances of this class, optionally integrated by a PermissionDynamicContext.

A node is uniquely identified by its `nodeName`, which is a dot-separated string providing meaning to the node itself. The suggested structure of the name is `modid.name`, where `modid` is the ID of the owner of the node. This API does not require any implicit hierarchy, so `modid.name` is not considered a parent of `modid.name.sub`. Such decisions are left to the IPermissionHandler.

Each node also has an associated PermissionType, detailing its exact type, along with a PermissionNode.PermissionResolver that is used to obtain the default value of the permission. More information can be found on their documentation.

A node can also be bound to additional PermissionDynamicContextKeys, which are used when querying the availability of the permission. There are no restrictions on their amount. It is also not mandatory to provide a value for all dynamics in a permission query. See the above link for more information.

Each node should be registered via the PermissionGatherEvent.Nodes and stored statically in a field. That instance should then be reused every-time a permission check needs to be performed via PermissionAPI.getPermission(ServerPlayer, PermissionNode, PermissionDynamicContext[]).