diff options
author | ElgarL <ElgarL@palmergames.com> | 2012-03-29 13:41:59 +0100 |
---|---|---|
committer | ElgarL <ElgarL@palmergames.com> | 2012-03-29 13:41:59 +0100 |
commit | 1ef8ab70d141e60a92b5fa152a5be61637fd84ba (patch) | |
tree | 6b36bfb304ac655015cbc114c0645a7d00dc0961 /EssentialsGroupManager/src | |
parent | b8453ac7927ae83811d00448842c622d8adec5fa (diff) | |
download | Essentials-1ef8ab70d141e60a92b5fa152a5be61637fd84ba.tar Essentials-1ef8ab70d141e60a92b5fa152a5be61637fd84ba.tar.gz Essentials-1ef8ab70d141e60a92b5fa152a5be61637fd84ba.tar.lz Essentials-1ef8ab70d141e60a92b5fa152a5be61637fd84ba.tar.xz Essentials-1ef8ab70d141e60a92b5fa152a5be61637fd84ba.zip |
Stop attempting to push empty permissions when players edit the yml's
incorrectly.
Diffstat (limited to 'EssentialsGroupManager/src')
-rw-r--r-- | EssentialsGroupManager/src/Changelog.txt | 3 | ||||
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java | 24 |
2 files changed, 22 insertions, 5 deletions
diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index a9ebb72aa..4599cbcc0 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -154,4 +154,5 @@ v 1.9: - Don't remove an attachment on a player leaving as Bukkit never forgets it. This fixes non mirrored permissions being messed up if a player relogs.
- Treat all world names as lower case for file handling (please check in your worlds folder. You should have no folders with upper case letters from now).
- Auto rename all case sensitive world folders to lower case (if possible).
- - Update GlobalGroups.yml for new/changed Towny permission nodes.
\ No newline at end of file + - Update GlobalGroups.yml for new/changed Towny permission nodes.
+ - Stop attempting to push empty permissions when players edit the yml's incorrectly.
\ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java index a01381fcd..c4e27fa1e 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java @@ -485,14 +485,22 @@ public class WorldDataHolder { if (thisGroupNode.get("permissions") instanceof List) { for (Object o : ((List) thisGroupNode.get("permissions"))) { try { - thisGrp.addPermission(o.toString()); + /* + * Only add this permission if it's not empty. + */ + if (!thisGroupNode.get("permissions").toString().isEmpty()) + thisGrp.addPermission(o.toString()); } catch (NullPointerException e) { // Ignore this entry as it's null. //throw new IllegalArgumentException("Invalid permission node in group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); } } } else if (thisGroupNode.get("permissions") instanceof String) { - thisGrp.addPermission((String) thisGroupNode.get("permissions")); + /* + * Only add this permission if it's not empty. + */ + if (!thisGroupNode.get("permissions").toString().isEmpty()) + thisGrp.addPermission((String) thisGroupNode.get("permissions")); } else { throw new IllegalArgumentException("Unknown type of permissions node(Should be String or List<String>) for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); } @@ -617,11 +625,19 @@ public class WorldDataHolder { } else { if (thisUserNode.get("permissions") instanceof List) { for (Object o : ((List) thisUserNode.get("permissions"))) { - thisUser.addPermission(o.toString()); + /* + * Only add this permission if it's not empty + */ + if (!o.toString().isEmpty()) + thisUser.addPermission(o.toString()); } } else if (thisUserNode.get("permissions") instanceof String) { try { - thisUser.addPermission(thisUserNode.get("permissions").toString()); + /* + * Only add this permission if it's not empty + */ + if (!thisUserNode.get("permissions").toString().isEmpty()) + thisUser.addPermission(thisUserNode.get("permissions").toString()); } catch (NullPointerException e) { // Ignore this entry as it's null. //throw new IllegalArgumentException("Invalid permission node for user: " + thisUser.getName() + " in file: " + UserFile.getPath()); |