Class PermissionNode

java.lang.Object
com.github.darksoulq.abyssallib.server.permission.PermissionNode

public class PermissionNode extends Object
Represents a structured permission node with defaults and child relationships. This class facilitates the fluent definition of permissions before they are registered with the Bukkit PluginManager.
  • Constructor Details

    • PermissionNode

      public PermissionNode(String node)
      Constructs a new PermissionNode.
      Parameters:
      node - The raw permission string.
  • Method Details

    • defaultValue

      public PermissionNode defaultValue(org.bukkit.permissions.PermissionDefault defaultValue)
      Sets the default value for this permission.
      Parameters:
      defaultValue - The PermissionDefault behavior.
      Returns:
      This node instance for chaining.
    • description

      public PermissionNode description(String description)
      Sets the description for this permission.
      Parameters:
      description - A string describing the permission.
      Returns:
      This node instance for chaining.
    • child

      public PermissionNode child(String childNode, boolean value)
      Adds a child node by string name.
      Parameters:
      childNode - The string of the child permission.
      value - The value the child receives when this node is true.
      Returns:
      This node instance for chaining.
    • child

      public PermissionNode child(PermissionNode childNode, boolean value)
      Adds a child node using another PermissionNode instance.
      Parameters:
      childNode - The PermissionNode to inherit.
      value - The value the child receives when this node is true.
      Returns:
      This node instance for chaining.
    • getNode

      public String getNode()
      Returns:
      The raw permission node string.
    • getDefaultValue

      public org.bukkit.permissions.PermissionDefault getDefaultValue()
      Returns:
      The PermissionDefault value of this node.
    • getDescription

      public String getDescription()
      Returns:
      The description of this permission.
    • getChildren

      public Map<String,Boolean> getChildren()
      Returns:
      An unmodifiable map containing the child nodes and their values.
    • has

      public boolean has(org.bukkit.permissions.Permissible permissible)
      Checks if a permissible object (like a Player) has this specific node.
      Parameters:
      permissible - The entity to check.
      Returns:
      True if the entity has the permission.
    • toBukkit

      public org.bukkit.permissions.Permission toBukkit()
      Converts this node into a Bukkit Permission object.

      This method utilizes lazy initialization to cache the result.

      Returns:
      The Bukkit Permission representation.
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      The raw node string.