Class Permissions

java.lang.Object
com.plotsquared.core.util.Permissions

public class Permissions extends Object
The Permissions class handles checking user permissions.
- This will respect * nodes and plots.admin and can be used to check permission ranges (e.g. plots.plot.5)
- Checking the PlotPlayer class directly will not take the above into account
  • Constructor Details

    • Permissions

      public Permissions()
  • Method Details

    • hasPermission

      public static boolean hasPermission(PlotPlayer<?> player, Permission permission, boolean notify)
    • hasPermission

      public static boolean hasPermission(@NonNull PermissionHolder caller, @NonNull Permission permission)
      Check if the owner of the profile has a given (global) permission
      Parameters:
      caller - permission holder
      permission - Permission
      Returns:
      true if the owner has the given permission, else false
    • hasPermission

      public static boolean hasPermission(@NonNull PermissionHolder caller, @NonNull String permission)
      Check if the owner of the profile has a given (global) permission
      Parameters:
      caller - permission holder
      permission - Permission
      Returns:
      true if the owner has the given permission, else false
    • hasKeyedPermission

      public static boolean hasKeyedPermission(@NonNull PermissionHolder caller, @NonNull String permission, @NonNull String key)
      Check if the owner of the profile has a given (global) keyed permission. Checks both permission.key and permission.*
      Parameters:
      caller - permission holder
      permission - Permission
      key - Permission "key"
      Returns:
      true if the owner has the given permission, else false
    • hasPermission

      public static boolean hasPermission(PlotPlayer<?> player, String permission, boolean notify)
      Checks if a PlotPlayer has a permission, and optionally send the no permission message if applicable.
      Parameters:
      player - permission holder
      permission - permission
      notify - if to notify the permission holder
      Returns:
      if permission is had
    • hasPermissionRange

      public static int hasPermissionRange(PlotPlayer<?> player, Permission Permission, int range)
    • hasPermissionRange

      public static int hasPermissionRange(PlotPlayer<?> player, String stub, int range)
      Check the highest permission a PlotPlayer has within a specified range.
      - Excessively high values will lag
      - The default range that is checked is Settings.Limit.MAX_PLOTS
      Parameters:
      player - Player to check for
      stub - The permission stub to check e.g. for `plots.plot.#` the stub is `plots.plot`
      range - The range to check
      Returns:
      The highest permission they have within that range