Interface PermissionDescription.Builder

Enclosing interface:

public static interface PermissionDescription.Builder
A builder for permission descriptions.
  • Method Details

    • id

      Sets the permission id for the description this builder creates.

      See for format specifications.

      permissionId - The permission id
      This builder for chaining
    • description

      PermissionDescription.Builder description(@Nullable Component description)
      Sets the short description to use.

      May include a link to a more detailed description on the plugin's web page.

      Can be null if the permission does not have a description.

      description - The short description to use
      This builder for chaining
    • assign

      PermissionDescription.Builder assign(String role, boolean value)
      Assigns this permission to the given role-template Subject.

      Role templates will be namespaced by the plugin that owns each registered permission. The expected format of the namespaced subject identifier is <plugin id>:<role>. Implementations must provide an un-namespaced role template that inherits its permissions from every plugin-namespaced role template.

      If the given subject does not exist it will be created.

      It is recommended to use the standard role suggestions expressed as static parameters in PermissionDescription.

      Do not assign a permission to user, staff and admin at the same time but solve this with subject inheritance if possible.

      Note: The permissions are only assigned during register().

      role - The role-template to assign the permission to. See constants in PermissionDescription for common roles (not exhaustive).
      value - The value to to assign
      This builder for chaining
    • defaultValue

      PermissionDescription.Builder defaultValue(Tristate defaultValue)
      Sets a value that this permission should have by default. This can be used to exclude permissions from node tree inheritance, or to provide a permission to users by default.

      This is shorthand for giving (with templates stripped) a value on the default subject, except that the default value will only be applied once register() is called.

      Assigning default permissions should be used sparingly, and by convention, only in situations where "default" game behaviour is restored by granting a certain permission.

      defaultValue - The value this permission should have for subjects where none has been assigned.
      The builder for chaining.
    • register

      Creates and registers a new PermissionDescription instance with the given settings.
      The newly created permission description instance
      IllegalStateException - If there are any settings left unset or a description with the given permission id was already registered and the PermissionService does not support overwriting descriptions