Class Permissions

java.lang.Object
de.eldoria.eldoutilities.utils.Permissions

public final class Permissions extends Object
  • Method Details

    • findHighestIntPermission

      public static int findHighestIntPermission(Player player, String prefix, int defaultValue)
      Find a permission which indicates a number in the format permission.node.<number>.
      Parameters:
      player - player to check
      prefix - prefix of permission. E.g. permission.node.
      defaultValue - default value which should be returned when no value is present This will also be the lowest possible returned value.
      Returns:
      highest permission value or default value
    • findHighestDoublePermission

      public static double findHighestDoublePermission(Player player, String prefix, double defaultValue)
      Find a permission which indicates a number in the format permission.node.<number>.
      Parameters:
      player - player to check
      prefix - prefix of permission. E.g. permission.node.
      defaultValue - default value which should be returned when no value is present This will also be the lowest possible returned value.
      Returns:
      highest permission value or default value
    • findPermissions

      public static Collection<String> findPermissions(Player player, String prefix, boolean truncate)
      Finds all permissions which start with the provided prefix.
      Parameters:
      player - player to check
      prefix - prefix of permission. E.g. permission.node.
      truncate - if true the prefix will be removed.
      Returns:
      collection with all matchin permissions
    • findPermissions

      public static <T> Collection<@NotNull T> findPermissions(Player player, String prefix, boolean truncate, Function<String,T> parse)
      Finds all permissions which start with the provided prefix and maps them to the requested value.
      Type Parameters:
      T - requested value
      Parameters:
      player - player to check
      prefix - prefix of permission. E.g. permission.node.
      truncate - if true the prefix will be removed before parsing.
      parse - parse the permission to the requested value. Return null to remove permission
      Returns:
      collection which contains all matchin permission. Contains no null values.