map = mapAccess.get().orElse(null);
- if (map != null) {
- final Boolean result = map.get(permission);
- if (result != null) {
- return result;
- }
- } else {
- mapAccess.set((map = new HashMap<>()));
- }
- boolean result = hasPermission((PermissionHolder) player, permission);
- map.put(permission, result);
- return result;
- }
- }
-
- /**
- * Check if a {@code CommandCaller} has a permission.
- *
- * @param caller
- * @param permission
- * @return
- */
- public static boolean hasPermission(PermissionHolder caller, String permission) {
- if (caller.hasPermission(permission)) {
- return true;
- }/* TODO: DECIDE WHAT TO DO HERE; else if (caller.isPermissionSet(permission)) {
- return false;
- }*/
- if (caller.hasPermission(Captions.PERMISSION_ADMIN.getTranslated())) {
- return true;
- }
- permission = permission.toLowerCase().replaceAll("^[^a-z|0-9|\\.|_|-]", "");
- String[] nodes = permission.split("\\.");
- StringBuilder n = new StringBuilder();
- for (int i = 0; i <= (nodes.length - 1); i++) {
- n.append(nodes[i] + ".");
- String combined = n + Captions.PERMISSION_STAR.getTranslated();
- if (!permission.equals(combined)) {
- if (caller.hasPermission(combined)) {
- return true;
- }/* TODO: DECIDE WHAT TO DO HERE; else if (caller.isPermissionSet(combined)) {
- return false;
- }*/
- }
- }
- return false;
+ public static boolean hasPermission(@Nonnull final PermissionHolder caller, @Nonnull final String permission) {
+ return caller.hasPermission(permission);
}
/**
diff --git a/Core/src/main/java/com/plotsquared/core/util/PlayerManager.java b/Core/src/main/java/com/plotsquared/core/util/PlayerManager.java
index e316d6c19..cfe666569 100644
--- a/Core/src/main/java/com/plotsquared/core/util/PlayerManager.java
+++ b/Core/src/main/java/com/plotsquared/core/util/PlayerManager.java
@@ -239,7 +239,7 @@ public abstract class PlayerManager, T> {
/**
* Get a plot player from a platform player object. This method requires
- * that the caller actually knows that the player exists.
+ * that the caller actually knows that the player exists and is online.
*
* The method will throw an exception if there is no such
* player online.