Package com.plotsquared.core.util
Class Permissions
java.lang.Object
com.plotsquared.core.util.Permissions
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
- 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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
hasKeyedPermission(@NonNull PermissionHolder caller, @NonNull String permission, @NonNull String key)
Check if the owner of the profile has a given (global) keyed permission.static boolean
hasPermission(@NonNull PermissionHolder caller, @NonNull Permission permission)
Check if the owner of the profile has a given (global) permissionstatic boolean
hasPermission(@NonNull PermissionHolder caller, @NonNull String permission)
Check if the owner of the profile has a given (global) permissionstatic boolean
hasPermission(PlotPlayer<?> player, Permission permission, boolean notify)
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.static int
hasPermissionRange(PlotPlayer<?> player, Permission Permission, int range)
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 isSettings.Limit.MAX_PLOTS
-
Constructor Details
-
Permissions
public Permissions()
-
-
Method Details
-
hasPermission
-
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 holderpermission
- Permission- Returns:
true
if the owner has the given permission, elsefalse
-
hasPermission
Check if the owner of the profile has a given (global) permission- Parameters:
caller
- permission holderpermission
- Permission- Returns:
true
if the owner has the given permission, elsefalse
-
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 bothpermission.key
andpermission.*
- Parameters:
caller
- permission holderpermission
- Permissionkey
- Permission "key"- Returns:
true
if the owner has the given permission, elsefalse
-
hasPermission
Checks if a PlotPlayer has a permission, and optionally send the no permission message if applicable.- Parameters:
player
- permission holderpermission
- permissionnotify
- if to notify the permission holder- Returns:
- if permission is had
-
hasPermissionRange
-
hasPermissionRange
Check the highest permission a PlotPlayer has within a specified range.
- Excessively high values will lag
- The default range that is checked isSettings.Limit.MAX_PLOTS
- Parameters:
player
- Player to check forstub
- 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
-