From db6469f48667bb31ff7df1673776f15751ae9a16 Mon Sep 17 00:00:00 2001 From: Xefir Date: Mon, 7 May 2012 20:03:54 +0200 Subject: [PATCH] Use my own code but i have to test to make sure it's work --- .../bukkit/simplyperms/SimplyPlugin.java | 29 +++++-------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/src/net/crystalyx/bukkit/simplyperms/SimplyPlugin.java b/src/net/crystalyx/bukkit/simplyperms/SimplyPlugin.java index cab288a..c1a1b11 100755 --- a/src/net/crystalyx/bukkit/simplyperms/SimplyPlugin.java +++ b/src/net/crystalyx/bukkit/simplyperms/SimplyPlugin.java @@ -6,7 +6,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import net.crystalyx.bukkit.simplyperms.io.ConfigFile; import net.crystalyx.bukkit.simplyperms.io.ConfigSQL; @@ -210,15 +209,9 @@ public class SimplyPlugin extends JavaPlugin { Map perms = new HashMap(); List groups = config.getPlayerGroups(player); if (groups.isEmpty()) groups.add(default_group); - - for (Entry entry : config.getPlayerPermissions(player).entrySet()) { - perms.put(entry.getKey(), entry.getValue()); - } - - for (Entry entry : config.getPlayerPermissions(player, world).entrySet()) { - // No containskey; world overrides non-world - perms.put(entry.getKey(), entry.getValue()); - } + perms.putAll(config.getPlayerPermissions(player)); + // No containskey; world overrides non-world + perms.putAll(config.getPlayerPermissions(player, world)); for (String group : groups) { for (Map.Entry entry : calculateGroupPermissions(group, world).entrySet()) { @@ -236,19 +229,11 @@ public class SimplyPlugin extends JavaPlugin { return new HashMap(); } - Map perms = new HashMap(); - for (String key : getNode("groups/" + group + "/permissions").getKeys(false)) { - perms.put(key, getNode("groups/" + group + "/permissions").getBoolean(key)); - } + Map perms = config.getGroupPermissions(group); + // No containskey; world overrides non-world + perms.putAll(config.getGroupPermissions(group, world)); - if (getNode("groups/" + group + "/worlds/" + world) != null) { - for (String entry : getNode("groups/" + group + "/worlds/" + world).getKeys(false)) { - // No containskey; world overrides non-world - perms.put(entry, getNode("groups/" + group + "/worlds/" + world).getBoolean(entry)); - } - } - - for (String parent : getNode("groups/" + group).getStringList("inheritance")) { + for (String parent : config.getGroupInheritance(group)) { for (Map.Entry entry : calculateGroupPermissions(parent, world).entrySet()) { if (!perms.containsKey(entry.getKey())) { // Children override permissions perms.put(entry.getKey(), entry.getValue());