Class LapisCorePermissions


  • public class LapisCorePermissions
    extends java.lang.Object
    This class handles the complex custom permission system that LapisCore
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      PlayerPermission calculatePermission​(java.util.UUID uuid)
      Calculate the PlayerPermission for a player
      org.bukkit.permissions.Permission getAssignedPermission​(java.util.UUID uuid)
      Get the Bukkit permission assigned to a player
      protected org.bukkit.permissions.Permission getOfflinePlayerPermission​(java.util.UUID uuid)
      Override this method to provide a method of retrieving the players permission while they are offline
      java.lang.Integer getPermissionValue​(java.util.UUID uuid, LapisPermission permission)
      Get the raw Integer value of the permission for a player
      boolean isPermitted​(java.util.UUID uuid, LapisPermission permission)
      Check if a player is given a permission
      void loadPermissions()
      Call this method to load the permission values from config once all of your LapisPermissions have been registered
      void registerPermissions​(LapisPermission... permission)
      Register permissions with LapisPermission objects
      protected void savePlayersPermission​(java.util.UUID uuid, org.bukkit.permissions.Permission perm)
      Override this method to save the players permission for retrieval when they are offline
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LapisCorePermissions

        public LapisCorePermissions​(LapisCorePlugin core)
        Parameters:
        core - The LapisCore class that the permissions should be assigned too
    • Method Detail

      • registerPermissions

        public void registerPermissions​(LapisPermission... permission)
        Register permissions with LapisPermission objects
        Parameters:
        permission - The permissions you wish to add
      • loadPermissions

        public void loadPermissions()
        Call this method to load the permission values from config once all of your LapisPermissions have been registered
      • getAssignedPermission

        public org.bukkit.permissions.Permission getAssignedPermission​(java.util.UUID uuid)
        Get the Bukkit permission assigned to a player
        Parameters:
        uuid - The UUID of the player
        Returns:
        Returns the Bukkit Permission that the plugin is using for permission calculations
      • getPermissionValue

        public java.lang.Integer getPermissionValue​(java.util.UUID uuid,
                                                    LapisPermission permission)
        Get the raw Integer value of the permission for a player
        Parameters:
        uuid - The UUID of the player
        permission - The Permission you want a value for
        Returns:
        Returns the Integer value for the permission assigned to the player, returns 0 if a permission could not be calculated
      • isPermitted

        public boolean isPermitted​(java.util.UUID uuid,
                                   LapisPermission permission)
        Check if a player is given a permission
        Parameters:
        uuid - The UUID of the player
        permission - The Permission you wish to check
        Returns:
        Returns true if the value of Permission is greater than 0 otherwise false
      • calculatePermission

        public PlayerPermission calculatePermission​(java.util.UUID uuid)
        Calculate the PlayerPermission for a player
        Parameters:
        uuid - The UUID of the player
        Returns:
        Returns the PlayerPermission assigned to the player
      • getOfflinePlayerPermission

        protected org.bukkit.permissions.Permission getOfflinePlayerPermission​(java.util.UUID uuid)
        Override this method to provide a method of retrieving the players permission while they are offline
        Parameters:
        uuid - The UUID of the player we want the permission of
        Returns:
        Return the Bukkit Permission that is assigned to this player
      • savePlayersPermission

        protected void savePlayersPermission​(java.util.UUID uuid,
                                             org.bukkit.permissions.Permission perm)
        Override this method to save the players permission for retrieval when they are offline
        Parameters:
        uuid - The UUID of the player the permission is assigned to
        perm - The permission the player has been assigned