mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Deprecate the static Permissions "util" class that is almost entirely superseded by methods in PermissionHolder instances themselves
This commit is contained in:
parent
7279862def
commit
b2b0ef0a89
@ -30,9 +30,18 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
|||||||
* The Permissions class handles checking user permissions.<br>
|
* The Permissions class handles checking user permissions.<br>
|
||||||
* - This will respect * nodes and plots.admin and can be used to check permission ranges (e.g. plots.plot.5)<br>
|
* - This will respect * nodes and plots.admin and can be used to check permission ranges (e.g. plots.plot.5)<br>
|
||||||
* - Checking the PlotPlayer class directly will not take the above into account<br>
|
* - Checking the PlotPlayer class directly will not take the above into account<br>
|
||||||
|
*
|
||||||
|
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
||||||
|
* classes
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(forRemoval = true, since = "TODO")
|
||||||
public class Permissions {
|
public class Permissions {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
||||||
|
* classes
|
||||||
|
*/
|
||||||
|
@Deprecated(forRemoval = true, since = "TODO")
|
||||||
public static boolean hasPermission(PlotPlayer<?> player, Permission permission, boolean notify) {
|
public static boolean hasPermission(PlotPlayer<?> player, Permission permission, boolean notify) {
|
||||||
return hasPermission(player, permission.toString(), notify);
|
return hasPermission(player, permission.toString(), notify);
|
||||||
}
|
}
|
||||||
@ -43,18 +52,25 @@ public class Permissions {
|
|||||||
* @param caller permission holder
|
* @param caller permission holder
|
||||||
* @param permission Permission
|
* @param permission Permission
|
||||||
* @return {@code true} if the owner has the given permission, else {@code false}
|
* @return {@code true} if the owner has the given permission, else {@code false}
|
||||||
|
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
||||||
|
* classes
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(forRemoval = true, since = "TODO")
|
||||||
public static boolean hasPermission(final @NonNull PermissionHolder caller, final @NonNull Permission permission) {
|
public static boolean hasPermission(final @NonNull PermissionHolder caller, final @NonNull Permission permission) {
|
||||||
return caller.hasPermission(permission.toString());
|
return caller.hasPermission(permission.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the owner of the profile has a given (global) permission
|
* Check if the owner of the profile has a given (global) permission. There is no guarantee that per-world permissions will
|
||||||
|
* be checked because unmaintained crap plugins like PEX exist.
|
||||||
*
|
*
|
||||||
* @param caller permission holder
|
* @param caller permission holder
|
||||||
* @param permission Permission
|
* @param permission Permission
|
||||||
* @return {@code true} if the owner has the given permission, else {@code false}
|
* @return {@code true} if the owner has the given permission, else {@code false}
|
||||||
|
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
||||||
|
* classes
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(forRemoval = true, since = "TODO")
|
||||||
public static boolean hasPermission(final @NonNull PermissionHolder caller, final @NonNull String permission) {
|
public static boolean hasPermission(final @NonNull PermissionHolder caller, final @NonNull String permission) {
|
||||||
return caller.hasPermission(permission);
|
return caller.hasPermission(permission);
|
||||||
}
|
}
|
||||||
@ -68,7 +84,10 @@ public class Permissions {
|
|||||||
* @param key Permission "key"
|
* @param key Permission "key"
|
||||||
* @return {@code true} if the owner has the given permission, else {@code false}
|
* @return {@code true} if the owner has the given permission, else {@code false}
|
||||||
* @since 6.0.10
|
* @since 6.0.10
|
||||||
|
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
||||||
|
* classes
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(forRemoval = true, since = "TODO")
|
||||||
public static boolean hasKeyedPermission(
|
public static boolean hasKeyedPermission(
|
||||||
final @NonNull PermissionHolder caller, final @NonNull String permission,
|
final @NonNull PermissionHolder caller, final @NonNull String permission,
|
||||||
final @NonNull String key
|
final @NonNull String key
|
||||||
@ -83,7 +102,10 @@ public class Permissions {
|
|||||||
* @param permission permission
|
* @param permission permission
|
||||||
* @param notify if to notify the permission holder
|
* @param notify if to notify the permission holder
|
||||||
* @return if permission is had
|
* @return if permission is had
|
||||||
|
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
||||||
|
* classes
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(forRemoval = true, since = "TODO")
|
||||||
public static boolean hasPermission(PlotPlayer<?> player, String permission, boolean notify) {
|
public static boolean hasPermission(PlotPlayer<?> player, String permission, boolean notify) {
|
||||||
if (!hasPermission(player, permission)) {
|
if (!hasPermission(player, permission)) {
|
||||||
if (notify) {
|
if (notify) {
|
||||||
@ -97,6 +119,11 @@ public class Permissions {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
||||||
|
* classes
|
||||||
|
*/
|
||||||
|
@Deprecated(forRemoval = true, since = "TODO")
|
||||||
public static int hasPermissionRange(PlotPlayer<?> player, Permission Permission, int range) {
|
public static int hasPermissionRange(PlotPlayer<?> player, Permission Permission, int range) {
|
||||||
return hasPermissionRange(player, Permission.toString(), range);
|
return hasPermissionRange(player, Permission.toString(), range);
|
||||||
}
|
}
|
||||||
@ -110,7 +137,10 @@ public class Permissions {
|
|||||||
* @param stub The permission stub to check e.g. for `plots.plot.#` the stub is `plots.plot`
|
* @param stub The permission stub to check e.g. for `plots.plot.#` the stub is `plots.plot`
|
||||||
* @param range The range to check
|
* @param range The range to check
|
||||||
* @return The highest permission they have within that range
|
* @return The highest permission they have within that range
|
||||||
|
* @deprecated all logic that may once have been in the class lives elsewhere. We also want to do away with statically-accessed
|
||||||
|
* classes
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(forRemoval = true, since = "TODO")
|
||||||
public static int hasPermissionRange(PlotPlayer<?> player, String stub, int range) {
|
public static int hasPermissionRange(PlotPlayer<?> player, String stub, int range) {
|
||||||
return player.hasPermissionRange(stub, range);
|
return player.hasPermissionRange(stub, range);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user