Use my own code but i have to test to make sure it's work

This commit is contained in:
Michel Roux 2012-05-07 20:03:54 +02:00
parent 34a0238ab4
commit db6469f486

View File

@ -6,7 +6,6 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry;
import net.crystalyx.bukkit.simplyperms.io.ConfigFile; import net.crystalyx.bukkit.simplyperms.io.ConfigFile;
import net.crystalyx.bukkit.simplyperms.io.ConfigSQL; import net.crystalyx.bukkit.simplyperms.io.ConfigSQL;
@ -210,15 +209,9 @@ public class SimplyPlugin extends JavaPlugin {
Map<String, Boolean> perms = new HashMap<String, Boolean>(); Map<String, Boolean> perms = new HashMap<String, Boolean>();
List<String> groups = config.getPlayerGroups(player); List<String> groups = config.getPlayerGroups(player);
if (groups.isEmpty()) groups.add(default_group); if (groups.isEmpty()) groups.add(default_group);
perms.putAll(config.getPlayerPermissions(player));
for (Entry<String, Boolean> entry : config.getPlayerPermissions(player).entrySet()) { // No containskey; world overrides non-world
perms.put(entry.getKey(), entry.getValue()); perms.putAll(config.getPlayerPermissions(player, world));
}
for (Entry<String, Boolean> entry : config.getPlayerPermissions(player, world).entrySet()) {
// No containskey; world overrides non-world
perms.put(entry.getKey(), entry.getValue());
}
for (String group : groups) { for (String group : groups) {
for (Map.Entry<String, Boolean> entry : calculateGroupPermissions(group, world).entrySet()) { for (Map.Entry<String, Boolean> entry : calculateGroupPermissions(group, world).entrySet()) {
@ -236,19 +229,11 @@ public class SimplyPlugin extends JavaPlugin {
return new HashMap<String, Boolean>(); return new HashMap<String, Boolean>();
} }
Map<String, Boolean> perms = new HashMap<String, Boolean>(); Map<String, Boolean> perms = config.getGroupPermissions(group);
for (String key : getNode("groups/" + group + "/permissions").getKeys(false)) { // No containskey; world overrides non-world
perms.put(key, getNode("groups/" + group + "/permissions").getBoolean(key)); perms.putAll(config.getGroupPermissions(group, world));
}
if (getNode("groups/" + group + "/worlds/" + world) != null) { for (String parent : config.getGroupInheritance(group)) {
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 (Map.Entry<String, Boolean> entry : calculateGroupPermissions(parent, world).entrySet()) { for (Map.Entry<String, Boolean> entry : calculateGroupPermissions(parent, world).entrySet()) {
if (!perms.containsKey(entry.getKey())) { // Children override permissions if (!perms.containsKey(entry.getKey())) { // Children override permissions
perms.put(entry.getKey(), entry.getValue()); perms.put(entry.getKey(), entry.getValue());