From 66de4f7cab789986f0f5354c3f420ba39e950a2d Mon Sep 17 00:00:00 2001 From: T00thpick1 Date: Thu, 16 May 2013 09:15:55 -0400 Subject: [PATCH] Move default to own key section --- .../com/gmail/nossr50/config/WorldConfig.java | 16 ++-- src/main/resources/worlds.yml | 75 ++++++++++--------- 2 files changed, 46 insertions(+), 45 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/WorldConfig.java b/src/main/java/com/gmail/nossr50/config/WorldConfig.java index 826bd6d07..73bb01e86 100644 --- a/src/main/java/com/gmail/nossr50/config/WorldConfig.java +++ b/src/main/java/com/gmail/nossr50/config/WorldConfig.java @@ -26,24 +26,24 @@ public class WorldConfig extends ConfigLoader { // World settings public boolean isSkillEnabled(SkillType skillType, String world) { 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) { 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 - 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); } } diff --git a/src/main/resources/worlds.yml b/src/main/resources/worlds.yml index 7a15fbe65..72f9cb0d1 100644 --- a/src/main/resources/worlds.yml +++ b/src/main/resources/worlds.yml @@ -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: - ## Copy the default section and replace 'default' with the name of a world to enable world specific settings for that world - 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 + ExampleWorldName: MobHealthBar: true \ No newline at end of file