Package me.hsgamer.hscore.bukkit.utils
Class PermissionUtils
java.lang.Object
me.hsgamer.hscore.bukkit.utils.PermissionUtils
Methods on Permissions
-
Method Summary
Modifier and TypeMethodDescriptiongetNumbersFromPermissions
(org.bukkit.permissions.Permissible permissible, String prefix) Get the numbers from the permissions the permissible object has ([prefix].getNumbersFromPermissions
(org.bukkit.permissions.Permissible permissible, String prefix, Function<String, Stream<Number>> numberConverter) Get the numbers from the permissions the permissible object has ([prefix].getStringsFromPermissions
(org.bukkit.permissions.Permissible permissible, String prefix) Get the strings from the permissions the permissible object has ([prefix].static boolean
hasAnyPermission
(org.bukkit.entity.Player player, Collection<org.bukkit.permissions.Permission> permissions) Check if the player has one of the permissionsstatic boolean
hasAnyPermissionString
(org.bukkit.entity.Player player, Collection<String> permissions) Check if the player has one of the permissionsstatic boolean
hasPermission
(org.bukkit.entity.Player player, String permission) Check if the player has the permission
-
Method Details
-
getStringsFromPermissions
@NotNull public static @NotNull Stream<String> getStringsFromPermissions(org.bukkit.permissions.Permissible permissible, String prefix) Get the strings from the permissions the permissible object has ([prefix].[string])- Parameters:
permissible
- the permissible objectprefix
- the permission prefix- Returns:
- the stream of strings
-
getNumbersFromPermissions
@NotNull public static @NotNull Stream<Number> getNumbersFromPermissions(org.bukkit.permissions.Permissible permissible, String prefix, Function<String, Stream<Number>> numberConverter) Get the numbers from the permissions the permissible object has ([prefix].[value])- Parameters:
permissible
- the permissible objectprefix
- the permission prefixnumberConverter
- the number converter- Returns:
- the stream of numbers
- See Also:
-
getNumbersFromPermissions
@NotNull public static @NotNull Stream<Number> getNumbersFromPermissions(org.bukkit.permissions.Permissible permissible, String prefix) Get the numbers from the permissions the permissible object has ([prefix].[value])- Parameters:
permissible
- the permissible objectprefix
- the permission prefix- Returns:
- the stream of numbers
- See Also:
-
hasPermission
Check if the player has the permission- Parameters:
player
- the playerpermission
- the permission. If it starts with "-", it will check if the player doesn't have the permission- Returns:
- true if the player does
-
hasAnyPermission
public static boolean hasAnyPermission(org.bukkit.entity.Player player, Collection<org.bukkit.permissions.Permission> permissions) Check if the player has one of the permissions- Parameters:
player
- the playerpermissions
- the permissions- Returns:
- true if the player does
-
hasAnyPermissionString
public static boolean hasAnyPermissionString(org.bukkit.entity.Player player, Collection<String> permissions) Check if the player has one of the permissions- Parameters:
player
- the playerpermissions
- the permissions- Returns:
- true if the player does
-