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 booleanhasKeyedPermission(@NonNull PermissionHolder caller, @NonNull String permission, @NonNull String key) Check if the owner of the profile has a given (global) keyed permission.static booleanhasPermission(@NonNull PermissionHolder caller, @NonNull Permission permission) Check if the owner of the profile has a given (global) permissionstatic booleanhasPermission(@NonNull PermissionHolder caller, @NonNull String permission) Check if the owner of the profile has a given (global) permissionstatic booleanhasPermission(PlotPlayer<?> player, Permission permission, boolean notify) static booleanhasPermission(PlotPlayer<?> player, String permission, boolean notify) Checks if a PlotPlayer has a permission, and optionally send the no permission message if applicable.static inthasPermissionRange(PlotPlayer<?> player, Permission Permission, int range) static inthasPermissionRange(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:
trueif 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:
trueif 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.keyandpermission.*- Parameters:
caller- permission holderpermission- Permissionkey- Permission "key"- Returns:
trueif the owner has the given permission, elsefalse- Since:
- 6.0.10
-
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
-