diff options
author | ElgarL <ElgarL@palmergames.com> | 2013-01-13 16:39:53 +0000 |
---|---|---|
committer | ElgarL <ElgarL@palmergames.com> | 2013-01-13 16:39:53 +0000 |
commit | ad7009c77ebbb47a9694ed4e7f57e8eb5044beaf (patch) | |
tree | d3c96d4674bc43603c29e2ecc27072bda750d09f /EssentialsGroupManager | |
parent | 24f56892ad7230f61bcd1aac583d12e72e53907d (diff) | |
download | Essentials-ad7009c77ebbb47a9694ed4e7f57e8eb5044beaf.tar Essentials-ad7009c77ebbb47a9694ed4e7f57e8eb5044beaf.tar.gz Essentials-ad7009c77ebbb47a9694ed4e7f57e8eb5044beaf.tar.lz Essentials-ad7009c77ebbb47a9694ed4e7f57e8eb5044beaf.tar.xz Essentials-ad7009c77ebbb47a9694ed4e7f57e8eb5044beaf.zip |
Do not grant any permissions (nort update Bukkit) if the server is in
offline mode and the player has the permission node
'groupmanager.noofflineperms'.
Diffstat (limited to 'EssentialsGroupManager')
4 files changed, 30 insertions, 5 deletions
diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 0fb2d9d17..74e1581a6 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -206,4 +206,5 @@ v 2.0: - Prevent GM commands from being used on CommandBlocks.
- Clear our attachment map upon a manload so we correctly reconfigure a players new permissions.
- Synchronize the raising of GroupManager events to Bukkit.getServer() (should prevent deadlocks).
- - Synchronize pushing to Bukkit perms to prevent any ConcurrentModificationException.
\ No newline at end of file + - Synchronize pushing to Bukkit perms to prevent any ConcurrentModificationException.
+ - Do not grant any permissions (nort update Bukkit) if the server is in offline mode and the player has the permission node 'groupmanager.noofflineperms'.
\ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java index e954a88fd..59efb33dc 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java @@ -16,6 +16,7 @@ import org.anjocaido.groupmanager.data.Group; import org.anjocaido.groupmanager.dataholder.WorldDataHolder; import org.anjocaido.groupmanager.data.User; import org.anjocaido.groupmanager.utils.PermissionCheckResult; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; /** @@ -784,6 +785,15 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { if (user == null || targetPermission == null || targetPermission.isEmpty()) { return result; } + + /* + * Do not push any perms to bukkit if... + * We are in offline mode + * and the player has the 'groupmanager.noofflineperms' permission. + */ + if (!Bukkit.getServer().getOnlineMode() + && (checkFullGMPermission(user, "groupmanager.noofflineperms", true).resultType == PermissionCheckResult.Type.FOUND)) + return result; if (checkBukkit) { // Check Bukkit perms to support plugins which add perms via code diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java index a200a7b9a..03742b023 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java @@ -31,7 +31,6 @@ import java.util.WeakHashMap; import org.anjocaido.groupmanager.GroupManager;
import org.anjocaido.groupmanager.data.User;
-
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -183,6 +182,18 @@ public class BukkitPermissions { value = (!permission.startsWith("-"));
newPerms.put((value ? permission : permission.substring(1)), value);
}
+
+ /*
+ * Do not push any perms to bukkit if...
+ * We are in offline mode
+ * and the player has the 'groupmanager.noofflineperms' permission.
+ */
+ if (!Bukkit.getServer().getOnlineMode()
+ && (newPerms.containsKey("groupmanager.noofflineperms") && (newPerms.get("groupmanager.noofflineperms") == true))) {
+ removeAttachment(name);
+ return;
+ }
+
/**
* This is put in place until such a time as Bukkit pull 466 is
diff --git a/EssentialsGroupManager/src/users.yml b/EssentialsGroupManager/src/users.yml index 19496ad84..eaea6232d 100644 --- a/EssentialsGroupManager/src/users.yml +++ b/EssentialsGroupManager/src/users.yml @@ -3,13 +3,16 @@ users: snowleo: group: Builder subgroups: [] - permissions: [] + permissions: + - groupmanager.noofflineperms KHobbits: group: Moderator subgroups: [] - permissions: [] + permissions: + - groupmanager.noofflineperms ElgarL: group: Moderator subgroups: [] - permissions: [] + permissions: + - groupmanager.noofflineperms |