Class PermissionUtils

java.lang.Object
me.hsgamer.hscore.bukkit.utils.PermissionUtils

public final class PermissionUtils extends Object
Methods on Permissions
  • 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 object
      prefix - 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 object
      prefix - the permission prefix
      numberConverter - 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 object
      prefix - the permission prefix
      Returns:
      the stream of numbers
      See Also:
    • hasPermission

      public static boolean hasPermission(org.bukkit.entity.Player player, String permission)
      Check if the player has the permission
      Parameters:
      player - the player
      permission - 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 player
      permissions - 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 player
      permissions - the permissions
      Returns:
      true if the player does