Module gomint.api

Interface PermissionManager

  • public interface PermissionManager
    • Method Detail

      • hasPermission

        boolean hasPermission​(String permission)
        Check if this permission manager has the permission. Permissions are sorted this way:

        - EntityPlayer permission - Group permission (reversed insert order)

        For example you have a player with group A and group B, group A has set permission "testpermission" to true group B has set "testpermission" to false. You inserted it with addGroup(Group) A first, second B you will get false as result.

        When you insert A second you will get true as result, same when you use setPermission(String, boolean) which adds a player based override.

        This manager also supports basic usage of the astrix wildcard (*). In the case of wildcard checking, all full written permissions will be checked first when there is a result wildcards will be skipped. When colliding wildcard permissions has been found (like "test.*": true, "test.command.*": false, testing for "test.command.test") the wildcard with the greater length will be used.

        permission - asked for
        true if this manager has the permission, false if not
      • addGroup

        void addGroup​(Group group)
        Add a new permission group to this manager
        group - which should be added
      • removeGroup

        void removeGroup​(Group group)
        Remove a group from the manager
        group - which should be removed
      • setPermission

        void setPermission​(String permission,
                           boolean value)
        Add a manager permission. This is the highest override level you can get
        permission - which should be set
        value - for the permission, true for grant, false for revoke
      • removePermission

        void removePermission​(String permission)
        Remove permission from this manager
        permission - which should be removed