mirror of
https://e.coding.net/circlecloud/Residence.git
synced 2025-11-26 22:06:07 +00:00
add config load tip and format config file...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
@@ -46,11 +46,13 @@ public class WorldFlagManager {
|
||||
public FlagPermissions getPerms(String world) {
|
||||
world = world.toLowerCase();
|
||||
final FlagPermissions list = worldperms.get(world);
|
||||
if (list == null)
|
||||
if (globaldefaults == null)
|
||||
if (list == null) {
|
||||
if (globaldefaults == null) {
|
||||
return new FlagPermissions();
|
||||
else
|
||||
} else {
|
||||
return globaldefaults;
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -58,15 +60,18 @@ public class WorldFlagManager {
|
||||
world = world.toLowerCase();
|
||||
group = group.toLowerCase();
|
||||
final Map<String, FlagPermissions> groupworldperms = groupperms.get(group);
|
||||
if (groupworldperms == null)
|
||||
if (groupworldperms == null) {
|
||||
return this.getPerms(world);
|
||||
}
|
||||
FlagPermissions list = groupworldperms.get(world);
|
||||
if (list == null) {
|
||||
list = groupworldperms.get("global." + world);
|
||||
if (list == null)
|
||||
if (list == null) {
|
||||
list = groupworldperms.get("global");
|
||||
if (list == null)
|
||||
}
|
||||
if (list == null) {
|
||||
return this.getPerms(world);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -75,16 +80,20 @@ public class WorldFlagManager {
|
||||
try {
|
||||
|
||||
Set<String> keys = config.getConfigurationSection("Global.Flags").getKeys(false);
|
||||
if (keys != null)
|
||||
for (final String key : keys)
|
||||
if (key.equalsIgnoreCase("Global"))
|
||||
if (keys != null) {
|
||||
for (final String key : keys) {
|
||||
if (key.equalsIgnoreCase("Global")) {
|
||||
globaldefaults = FlagPermissions.parseFromConfigNode(key, config.getConfigurationSection("Global.Flags"));
|
||||
else
|
||||
} else {
|
||||
worldperms.put(key.toLowerCase(), FlagPermissions.parseFromConfigNode(key, config.getConfigurationSection("Global.Flags")));
|
||||
for (final Entry<String, FlagPermissions> entry : worldperms.entrySet())
|
||||
}
|
||||
}
|
||||
}
|
||||
for (final Entry<String, FlagPermissions> entry : worldperms.entrySet()) {
|
||||
entry.getValue().setParent(globaldefaults);
|
||||
}
|
||||
keys = config.getConfigurationSection("Groups").getKeys(false);
|
||||
if (keys != null)
|
||||
if (keys != null) {
|
||||
for (final String key : keys) {
|
||||
final ConfigurationSection worldkeylist = config.getConfigurationSection("Groups." + key + ".Flags.World");
|
||||
if (worldkeylist != null) {
|
||||
@@ -101,24 +110,28 @@ public class WorldFlagManager {
|
||||
list.setParent(worldperm.getValue());
|
||||
perms.put("global." + worldperm.getKey().toLowerCase(), list);
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
perms.put(wkey.toLowerCase(), list);
|
||||
}
|
||||
}
|
||||
for (final Entry<String, FlagPermissions> entry : perms.entrySet()) {
|
||||
final String wkey = entry.getKey();
|
||||
final FlagPermissions list = entry.getValue();
|
||||
if (!wkey.startsWith("global.")) {
|
||||
list.setParent(perms.get("global." + wkey));
|
||||
if (list.getParent() == null)
|
||||
if (list.getParent() == null) {
|
||||
list.setParent(worldperms.get(wkey));
|
||||
if (list.getParent() == null)
|
||||
}
|
||||
if (list.getParent() == null) {
|
||||
list.setParent(globaldefaults);
|
||||
}
|
||||
}
|
||||
}
|
||||
groupperms.put(key.toLowerCase(), perms);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (final Exception ex) {
|
||||
Logger.getLogger(WorldFlagManager.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user