Package de.eldoria.eldoutilities.utils
Class Permissions
java.lang.Object
de.eldoria.eldoutilities.utils.Permissions
-
Method Summary
Modifier and TypeMethodDescriptionstatic doublefindHighestDoublePermission(org.bukkit.entity.Player player, String prefix, double defaultValue) Find a permission which indicates a number in the formatpermission.node.<number>.static intfindHighestIntPermission(org.bukkit.entity.Player player, String prefix, int defaultValue) Find a permission which indicates a number in the formatpermission.node.<number>.static Collection<String>findPermissions(org.bukkit.entity.Player player, String prefix, boolean truncate) Finds all permissions which start with the provided prefix.static <T> Collection<@NotNull T>findPermissions(org.bukkit.entity.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.
-
Method Details
-
findHighestIntPermission
public static int findHighestIntPermission(org.bukkit.entity.Player player, String prefix, int defaultValue) Find a permission which indicates a number in the formatpermission.node.<number>.- Parameters:
player- player to checkprefix- 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(org.bukkit.entity.Player player, String prefix, double defaultValue) Find a permission which indicates a number in the formatpermission.node.<number>.- Parameters:
player- player to checkprefix- 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(org.bukkit.entity.Player player, String prefix, boolean truncate) Finds all permissions which start with the provided prefix.- Parameters:
player- player to checkprefix- 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(org.bukkit.entity.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 checkprefix- 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.
-