Class PermissionManager

java.lang.Object
fr.hytale.loader.permission.PermissionManager

public class PermissionManager extends Object
Central manager for player permissions in HytaleLoader.

This singleton class stores and manages permissions for all players. Permissions are stored by player UUID to persist across Player instance creations.

Since:
1.0.3
Version:
1.0.4
Author:
HytaleLoader
  • Method Details

    • getInstance

      @Nonnull public static PermissionManager getInstance()
      Gets the singleton instance of the PermissionManager.
      Returns:
      the PermissionManager instance
    • hasPermission

      public boolean hasPermission(@Nonnull UUID playerUUID, @Nonnull Permission permission)
      Checks if a player has a specific permission.
      Parameters:
      playerUUID - the player's UUID
      permission - the permission to check
      Returns:
      true if the player has the permission
    • addPermission

      public void addPermission(@Nonnull UUID playerUUID, @Nonnull Permission permission)
      Adds a permission to a player.
      Parameters:
      playerUUID - the player's UUID
      permission - the permission to add
    • removePermission

      public boolean removePermission(@Nonnull UUID playerUUID, @Nonnull Permission permission)
      Removes a permission from a player.
      Parameters:
      playerUUID - the player's UUID
      permission - the permission to remove
      Returns:
      true if the permission was removed
    • getPermissions

      @Nonnull public Set<Permission> getPermissions(@Nonnull UUID playerUUID)
      Gets all permissions for a player.
      Parameters:
      playerUUID - the player's UUID
      Returns:
      an unmodifiable set of permissions
    • clearPermissions

      public void clearPermissions(@Nonnull UUID playerUUID)
      Clears all permissions for a player.
      Parameters:
      playerUUID - the player's UUID
    • clearAll

      public void clearAll()
      Clears all permissions for all players.

      Use with caution - this will remove all stored permissions.

    • getPlayerCount

      public int getPlayerCount()
      Gets the number of players with stored permissions.
      Returns:
      the number of players with permissions