Move default to own key section

This commit is contained in:
T00thpick1 2013-05-16 09:15:55 -04:00
parent fc935ce9dd
commit 66de4f7cab
2 changed files with 46 additions and 45 deletions

View File

@ -26,24 +26,24 @@ public class WorldConfig extends ConfigLoader {
// World settings // World settings
public boolean isSkillEnabled(SkillType skillType, String world) { public boolean isSkillEnabled(SkillType skillType, String world) {
String skill = StringUtils.getCapitalized(skillType.toString()); String skill = StringUtils.getCapitalized(skillType.toString());
return config.getBoolean("Worlds." + StringUtils.getCapitalized(world) + ".Skills." + skill + ".Enabled", isSkillEnabled(skill)); return config.getBoolean("Worlds." + world + ".Skills." + skill + ".Enabled", isSkillEnabled(skill));
} }
public boolean isAbilityEnabled(SkillType skillType, String world) { public boolean isAbilityEnabled(SkillType skillType, String world) {
String skill = StringUtils.getCapitalized(skillType.toString()); String skill = StringUtils.getCapitalized(skillType.toString());
return config.getBoolean("Worlds." + StringUtils.getCapitalized(world) + ".Skills." + skill + ".AbilityEnabled", isAbilityEnabled(skill)); return config.getBoolean("Worlds." + world + ".Skills." + skill + ".AbilityEnabled", isAbilityEnabled(skill));
} }
public boolean isBlockStoreEnabled(String world) { return config.getBoolean("Worlds." + StringUtils.getCapitalized(world) + ".BlockStore", isBlockStoreEnabled()); } public boolean isBlockStoreEnabled(String world) { return config.getBoolean("Worlds." + world + ".BlockStore", isBlockStoreEnabled()); }
public boolean isMobHealthEnabled(String world) { return config.getBoolean("Worlds." + StringUtils.getCapitalized(world) + ".MobHealthBar", isMobHealthEnabled()); } public boolean isMobHealthEnabled(String world) { return config.getBoolean("Worlds." + world + ".MobHealthBar", isMobHealthEnabled()); }
// Default settings // Default settings
private boolean isSkillEnabled(String skill) { return config.getBoolean("Worlds.default.Skills." + skill + ".Enabled", true); } private boolean isSkillEnabled(String skill) { return config.getBoolean("Default.Skills." + skill + ".Enabled", true); }
private boolean isAbilityEnabled(String skill) { return config.getBoolean("Worlds.default.Skills." + skill + ".AbilityEnabled", true); } private boolean isAbilityEnabled(String skill) { return config.getBoolean("Default.Skills." + skill + ".AbilityEnabled", true); }
private boolean isBlockStoreEnabled() { return config.getBoolean("Worlds.default.BlockStore", true); } private boolean isBlockStoreEnabled() { return config.getBoolean("Default.BlockStore", true); }
private boolean isMobHealthEnabled() { return config.getBoolean("Worlds.default.MobHealthBar", true); } private boolean isMobHealthEnabled() { return config.getBoolean("Default.MobHealthBar", true); }
} }

View File

@ -1,39 +1,40 @@
Default:
Skills:
Acrobatics:
Enabled: true
Archery:
Enabled: true
Axes:
Enabled: true
AbilityEnabled: true
Excavation:
Enabled: true
AbilityEnabled: true
Fishing:
Enabled: true
Herbalism:
Enabled: true
AbilityEnabled: true
Mining:
Enabled: true
AbilityEnabled: true
Repair:
Enabled: true
Smelting:
Enabled: true
Swords:
Enabled: true
AbilityEnabled: true
Taming:
Enabled: true
Unarmed:
Enabled: true
AbilityEnabled: true
Woodcutting:
Enabled: true
AbilityEnabled: true
BlockStore: true
MobHealthBar: true
Worlds: Worlds:
## Copy the default section and replace 'default' with the name of a world to enable world specific settings for that world ExampleWorldName:
default:
Skills:
Acrobatics:
Enabled: true
Archery:
Enabled: true
Axes:
Enabled: true
AbilityEnabled: true
Excavation:
Enabled: true
AbilityEnabled: true
Fishing:
Enabled: true
Herbalism:
Enabled: true
AbilityEnabled: true
Mining:
Enabled: true
AbilityEnabled: true
Repair:
Enabled: true
Smelting:
Enabled: true
Swords:
Enabled: true
AbilityEnabled: true
Taming:
Enabled: true
Unarmed:
Enabled: true
AbilityEnabled: true
Woodcutting:
Enabled: true
AbilityEnabled: true
BlockStore: true
MobHealthBar: true MobHealthBar: true