From b7955ea29e2db09241ffb5ae791f87fefb6342db Mon Sep 17 00:00:00 2001 From: NuclearW Date: Tue, 31 Jan 2012 02:59:46 -0500 Subject: [PATCH 1/5] Upate to config Now has a default config copied over on first run (can and should be commented!) Currently loads defaults from our in-jar file then what we define in code, could remove what we have in-code? The power of the auto-formatter compells you --- pom.xml | 2 +- .../gmail/nossr50/config/LoadProperties.java | 1382 ++++++++--------- src/main/java/com/gmail/nossr50/mcMMO.java | 6 +- src/main/resources/config.yml | 348 +++++ 4 files changed, 1042 insertions(+), 696 deletions(-) create mode 100644 src/main/resources/config.yml diff --git a/pom.xml b/pom.xml index 9438fa952..6fc8e5376 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ true ${basedir}/src/main/resources/ - plugin.yml + *.yml diff --git a/src/main/java/com/gmail/nossr50/config/LoadProperties.java b/src/main/java/com/gmail/nossr50/config/LoadProperties.java index 6ca35b02b..00f2b7733 100644 --- a/src/main/java/com/gmail/nossr50/config/LoadProperties.java +++ b/src/main/java/com/gmail/nossr50/config/LoadProperties.java @@ -13,718 +13,716 @@ You should have received a copy of the GNU General Public License along with mcMMO. If not, see . -*/ + */ package com.gmail.nossr50.config; import com.gmail.nossr50.mcMMO; import java.io.File; import java.io.IOException; -import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.configuration.file.FileConfiguration; import com.gmail.nossr50.datatypes.HUDType; -public class LoadProperties -{ - public static Boolean enableOnlyActivateWhenSneaking, enableAbilityMessages, enableAbilities, showDisplayName, showFaces, watch, xplockEnable, xpbar, xpicon, partybar, string, bucket, web, xprateEnable, slimeballs, spoutEnabled, - donateMessage, chimaeraWingEnable, xpGainsMobSpawners, myspawnEnable, mccEnable, mcmmoEnable, partyEnable, inviteEnable, acceptEnable, - whoisEnable, statsEnable, addxpEnable, ptpEnable, mmoeditEnable, clearmyspawnEnable, mcgodEnable, mcabilityEnable, mctopEnable, - mcrefreshEnable, enableMotd, enableMySpawn, enableRegen, enableCobbleToMossy, useMySQL, cocoabeans, mushrooms, - toolsLoseDurabilityFromAbilities, pvpxp, miningrequirespickaxe, excavationRequiresShovel, woodcuttingrequiresaxe, eggs, apples, cake, music, diamond, glowstone, - slowsand, sulphur, netherrack, bones, coal, clay, anvilmessages, mayDowngradeEnchants, mayLoseEnchants, - fishingDrops, leatherArmor, ironArmor, goldArmor, diamondArmor, woodenTools, stoneTools, ironTools, goldTools, diamondTools, enderPearl, blazeRod, records, glowstoneDust, fishingDiamonds; - - public static String xplock, MySQLtablePrefix, MySQLuserName, MySQLserverName, MySQLdbName, MySQLdbPass, mctop, addxp, - xprate, mcability, mcmmo, mcc, mcrefresh, mcgod, stats, mmoedit, ptp, party, myspawn, whois, invite, accept, clearmyspawn, nWood, - nStone, nIron, nGold, nDiamond, locale, nString, nLeather; - - public static int mfishing, mwatch, xpbar_x, xpbar_y, xpicon_x, xpicon_y, mstring, mbucket, mweb, - chimaeraId, msandstone, mcocoa, water_thunder, cure_self, cure_other, mslimeballs, mbones, msulphur, mslowsand, - mmushroom2, mglowstone2, mmelon, mmusic, mdiamond2, mbase, mapple, meggs, mcake, mpine, mbirch, mspruce, mcactus, mmushroom, mflower, - msugar, mpumpkin, mwheat, mgold, mdiamond, miron, mredstone, mlapis, mobsidian, mnetherrack, mglowstone, mcoal, mstone, MySQLport, - xpGainMultiplier, superBreakerCooldown, greenTerraCooldown, gigaDrillBreakerCooldown, treeFellerCooldown, - berserkCooldown, serratedStrikeCooldown, skullSplitterCooldown, abilityDurabilityLoss, - feathersConsumedByChimaeraWing, bonesConsumedByCOTW, repairdiamondlevel, rWood, rStone, rIron, rGold, rDiamond, rString, rLeather, - downgradeRank1, downgradeRank2, downgradeRank3, downgradeRank4, keepEnchantsRank1, keepEnchantsRank2, keepEnchantsRank3, keepEnchantsRank4, - fishingDropChanceTier1, fishingDropChanceTier2, fishingDropChanceTier3, fishingDropChanceTier4, fishingDropChanceTier5, - mnetherwart, mvines, mlilypad; - - public static double xpbackground_r, xpbackground_g, xpbackground_b, xpborder_r, xpborder_g, xpborder_b, fishing_r, fishing_g, fishing_b, acrobatics_r, acrobatics_g, acrobatics_b, archery_r, archery_g, archery_b, axes_r, axes_g, axes_b, - excavation_r, excavation_g, excavation_b, herbalism_r, herbalism_g, herbalism_b, mining_r, mining_g, mining_b, - repair_r, repair_g, repair_b, swords_r, swords_g, swords_b, taming_r, taming_g, taming_b, unarmed_r, unarmed_g, unarmed_b, - woodcutting_r, woodcutting_g, woodcutting_b, pvpxprewardmodifier, tamingxpmodifier, miningxpmodifier, - repairxpmodifier, woodcuttingxpmodifier, sorceryxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, - archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier; - +public class LoadProperties { + public static Boolean enableOnlyActivateWhenSneaking, + enableAbilityMessages, enableAbilities, showDisplayName, showFaces, + watch, xplockEnable, xpbar, xpicon, partybar, string, bucket, web, + xprateEnable, slimeballs, spoutEnabled, donateMessage, + chimaeraWingEnable, xpGainsMobSpawners, myspawnEnable, mccEnable, + mcmmoEnable, partyEnable, inviteEnable, acceptEnable, whoisEnable, + statsEnable, addxpEnable, ptpEnable, mmoeditEnable, + clearmyspawnEnable, mcgodEnable, mcabilityEnable, mctopEnable, + mcrefreshEnable, enableMotd, enableMySpawn, enableRegen, + enableCobbleToMossy, useMySQL, cocoabeans, mushrooms, + toolsLoseDurabilityFromAbilities, pvpxp, miningrequirespickaxe, + excavationRequiresShovel, woodcuttingrequiresaxe, eggs, apples, + cake, music, diamond, glowstone, slowsand, sulphur, netherrack, + bones, coal, clay, anvilmessages, mayDowngradeEnchants, + mayLoseEnchants, fishingDrops, leatherArmor, ironArmor, goldArmor, + diamondArmor, woodenTools, stoneTools, ironTools, goldTools, + diamondTools, enderPearl, blazeRod, records, glowstoneDust, + fishingDiamonds; + + public static String xplock, MySQLtablePrefix, MySQLuserName, + MySQLserverName, MySQLdbName, MySQLdbPass, mctop, addxp, xprate, + mcability, mcmmo, mcc, mcrefresh, mcgod, stats, mmoedit, ptp, + party, myspawn, whois, invite, accept, clearmyspawn, nWood, nStone, + nIron, nGold, nDiamond, locale, nString, nLeather; + + public static int mfishing, mwatch, xpbar_x, xpbar_y, xpicon_x, xpicon_y, + mstring, mbucket, mweb, chimaeraId, msandstone, mcocoa, + water_thunder, cure_self, cure_other, mslimeballs, mbones, + msulphur, mslowsand, mmushroom2, mglowstone2, mmelon, mmusic, + mdiamond2, mbase, mapple, meggs, mcake, mpine, mbirch, mspruce, + mcactus, mmushroom, mflower, msugar, mpumpkin, mwheat, mgold, + mdiamond, miron, mredstone, mlapis, mobsidian, mnetherrack, + mglowstone, mcoal, mstone, MySQLport, xpGainMultiplier, + superBreakerCooldown, greenTerraCooldown, gigaDrillBreakerCooldown, + treeFellerCooldown, berserkCooldown, serratedStrikeCooldown, + skullSplitterCooldown, abilityDurabilityLoss, + feathersConsumedByChimaeraWing, bonesConsumedByCOTW, + repairdiamondlevel, rWood, rStone, rIron, rGold, rDiamond, rString, + rLeather, downgradeRank1, downgradeRank2, downgradeRank3, + downgradeRank4, keepEnchantsRank1, keepEnchantsRank2, + keepEnchantsRank3, keepEnchantsRank4, fishingDropChanceTier1, + fishingDropChanceTier2, fishingDropChanceTier3, + fishingDropChanceTier4, fishingDropChanceTier5, mnetherwart, + mvines, mlilypad; + + public static double xpbackground_r, xpbackground_g, xpbackground_b, + xpborder_r, xpborder_g, xpborder_b, fishing_r, fishing_g, + fishing_b, acrobatics_r, acrobatics_g, acrobatics_b, archery_r, + archery_g, archery_b, axes_r, axes_g, axes_b, excavation_r, + excavation_g, excavation_b, herbalism_r, herbalism_g, herbalism_b, + mining_r, mining_g, mining_b, repair_r, repair_g, repair_b, + swords_r, swords_g, swords_b, taming_r, taming_g, taming_b, + unarmed_r, unarmed_g, unarmed_b, woodcutting_r, woodcutting_g, + woodcutting_b, pvpxprewardmodifier, tamingxpmodifier, + miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, + sorceryxpmodifier, unarmedxpmodifier, herbalismxpmodifier, + excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, + axesxpmodifier, acrobaticsxpmodifier; + public static HUDType defaulthud; protected static File configFile; protected static File dataFolder; protected final mcMMO plugin; - protected static YamlConfiguration config; - - public LoadProperties(mcMMO plugin) - { + protected static FileConfiguration config; + + public LoadProperties(mcMMO plugin) { this.plugin = plugin; dataFolder = plugin.getDataFolder(); configFile = new File(dataFolder, File.separator + "config.yml"); + config = plugin.getConfig(); } - - public void configCheck() - { - load(); - if(!configFile.exists()) - { - try - { - configFile.getParentFile().mkdir(); - configFile.createNewFile(); - addDefaults(); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - else - { - loadkeys(); + + public void load() { + // If not exist, copy from the jar + if (!configFile.exists()) { + dataFolder.mkdir(); + plugin.saveDefaultConfig(); + } + addDefaults(); + loadKeys(); + } + + private void writeDefault(String root, Object x) { + config.addDefault(root, x); + } + + private Boolean readBoolean(String root, Boolean def) { + // Configuration config = load(); + Boolean result = config.getBoolean(root, def); + saveConfig(); // Why? + return result; + } + + private Double readDouble(String root, Double def) { + Double result = config.getDouble(root, def); + saveConfig(); // Why? + return result; + } + + private Integer readInteger(String root, Integer def) { + // Configuration config = load(); + Integer result = config.getInt(root, def); + saveConfig(); // Why? + return result; + } + + public static String readString(String root, String def) { + // Configuration config = load(); + String result = config.getString(root, def); + saveConfig(); // Why? + return result; + } + + private static void saveConfig() { + try { + config.save(configFile); + } catch (IOException e) { + e.printStackTrace(); } } - private void write(String root, Object x) - { - //Configuration config = load(); - config.set(root, x); - } - private Boolean readBoolean(String root, Boolean def) - { - //Configuration config = load(); - Boolean result = config.getBoolean(root, def); - saveConfig(); - return result; - } - private Double readDouble(String root, Double def) - { - Double result = config.getDouble(root, def); - saveConfig(); - return result; - } - private Integer readInteger(String root, Integer def) - { - //Configuration config = load(); - Integer result = config.getInt(root, def); - saveConfig(); - return result; - } - - public static String readString(String root, String def) - { - //Configuration config = load(); - String result = config.getString(root, def); - saveConfig(); - return result; - } - - private YamlConfiguration load() - { - try { - config = YamlConfiguration.loadConfiguration(configFile); - return config; - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - private static void saveConfig() - { - try { - config.save(configFile); - } catch (IOException e) { - e.printStackTrace(); - } - } - - private void addDefaults() - { - System.out.println("Generating Config File..."); - - //Put in defaults - write("Spout.HUD.Default", "STANDARD"); - write("Spout.XP.Bar.Enabled", true); - write("Spout.Images.URL_DIR", "http://mcmmo.rycochet.net/mcmmo/"); - write("Spout.XP.Icon.Enabled", true); - write("Spout.XP.Bar.X_POS", 95); - write("Spout.XP.Bar.Y_POS", 6); - write("Spout.XP.Icon.X_POS", 78); - write("Spout.XP.Icon.Y_POS", 2); - write("Spout.Party.HUD.Enabled", true); - write("Spout.Party.HUD.Show_Faces", true); - write("Spout.Party.HUD.Show_Display_Name", false); - write("Spout.Menu.Key", "KEY_M"); - write("Spout.HUD.Retro.Colors.Acrobatics.RED", 0.3); - write("Spout.HUD.Retro.Colors.Acrobatics.GREEN", 0.3); - write("Spout.HUD.Retro.Colors.Acrobatics.BLUE", 0.75); - write("Spout.HUD.Retro.Colors.Archery.RED", 0.3); - write("Spout.HUD.Retro.Colors.Archery.GREEN", 0.3); - write("Spout.HUD.Retro.Colors.Archery.BLUE", 0.75); - write("Spout.HUD.Retro.Colors.Axes.RED", 0.3); - write("Spout.HUD.Retro.Colors.Axes.GREEN", 0.3); - write("Spout.HUD.Retro.Colors.Axes.BLUE", 0.75); - write("Spout.HUD.Retro.Colors.Excavation.RED", 0.3); - write("Spout.HUD.Retro.Colors.Excavation.GREEN", 0.3); - write("Spout.HUD.Retro.Colors.Excavation.BLUE", 0.75); - write("Spout.HUD.Retro.Colors.Herbalism.RED", 0.3); - write("Spout.HUD.Retro.Colors.Herbalism.GREEN", 0.3); - write("Spout.HUD.Retro.Colors.Herbalism.BLUE", 0.75); - write("Spout.HUD.Retro.Colors.Mining.RED", 0.3); - write("Spout.HUD.Retro.Colors.Mining.GREEN", 0.3); - write("Spout.HUD.Retro.Colors.Mining.BLUE", 0.75); - write("Spout.HUD.Retro.Colors.Repair.RED", 0.3); - write("Spout.HUD.Retro.Colors.Repair.GREEN", 0.3); - write("Spout.HUD.Retro.Colors.Repair.BLUE", 0.75); - write("Spout.HUD.Retro.Colors.Swords.RED", 0.3); - write("Spout.HUD.Retro.Colors.Swords.GREEN", 0.3); - write("Spout.HUD.Retro.Colors.Swords.BLUE", 0.75); - write("Spout.HUD.Retro.Colors.Taming.RED", 0.3); - write("Spout.HUD.Retro.Colors.Taming.GREEN", 0.3); - write("Spout.HUD.Retro.Colors.Taming.BLUE", 0.75); - write("Spout.HUD.Retro.Colors.Unarmed.RED", 0.3); - write("Spout.HUD.Retro.Colors.Unarmed.GREEN", 0.3); - write("Spout.HUD.Retro.Colors.Unarmed.BLUE", 0.75); - write("Spout.HUD.Retro.Colors.Woodcutting.RED", 0.3); - write("Spout.HUD.Retro.Colors.Woodcutting.GREEN", 0.3); - write("Spout.HUD.Retro.Colors.Woodcutting.BLUE", 0.75); - write("Spout.HUD.Retro.Colors.Fishing.RED", 0.3); - write("Spout.HUD.Retro.Colors.Fishing.GREEN", 0.3); - write("Spout.HUD.Retro.Colors.Fishing.BLUE", 0.75); - write("Spout.HUD.Retro.Colors.Border.RED", 0.0); - write("Spout.HUD.Retro.Colors.Border.GREEN", 0.0); - write("Spout.HUD.Retro.Colors.Border.BLUE", 0.0); - write("Spout.HUD.Retro.Colors.Background.RED", 0.75); - write("Spout.HUD.Retro.Colors.Background.GREEN", 0.75); - write("Spout.HUD.Retro.Colors.Background.BLUE", 0.75); - - write("MySQL.Enabled", false); - write("MySQL.Server.Address", "localhost"); - write("MySQL.Server.Port", 3306); - write("MySQL.Database.Name", "DataBaseName"); - write("MySQL.Database.User.Name", "UserName"); - write("MySQL.Database.TablePrefix", "mcmmo_"); - write("MySQL.Database.User.Password", "UserPassword"); - - write("General.Locale", "en_us"); - write("General.MOTD.Enabled", true); - write("General.MySpawn.Enabled", true); - write("General.HP_Regeneration.Enabled", true); - - write("Items.Chimaera_Wing.Enabled", true); - write("Items.Chimaera_Wing.Feather_Cost", 10); - write("Items.Chimaera_Wing.Item_ID", 288); - - write("Experience.PVP.Rewards", true); - write("Experience.Gains.Multiplier.PVP", 1); - write("Experience.Gains.Mobspawners.Enabled", false); - write("Experience.Gains.Multiplier.Global", 1.0); - write("Experience.Formula.Multiplier.Taming", 1.0); - write("Experience.Formula.Multiplier.Mining", 1.0); - write("Experience.Formula.Multiplier.Repair", 1.0); - write("Experience.Formula.Multiplier.Woodcutting", 1.0); - write("Experience.Formula.Multiplier.Unarmed", 1.0); - write("Experience.Formula.Multiplier.Herbalism", 1.0); - write("Experience.Formula.Multiplier.Excavation", 1.0); - write("Experience.Formula.Multiplier.Swords", 1.0); - write("Experience.Formula.Multiplier.Archery", 1.0); - write("Experience.Formula.Multiplier.Axes", 1.0); - write("Experience.Formula.Multiplier.Sorcery", 1.0); - write("Experience.Formula.Multiplier.Acrobatics", 1.0); - - //Mining XP values - write("Experience.Mining.Gold", 350); - write("Experience.Mining.Diamond", 750); - write("Experience.Mining.Iron", 250); - write("Experience.Mining.Redstone", 150); - write("Experience.Mining.Lapis", 400); - write("Experience.Mining.Obsidian", 150); - write("Experience.Mining.Netherrack", 30); - write("Experience.Mining.Glowstone", 30); - write("Experience.Mining.Coal", 100); - write("Experience.Mining.Stone", 30); - write("Experience.Mining.Sandstone", 30); - - //Herbalism XP values - write("Experience.Herbalism.Sugar_Cane", 30); - write("Experience.Herbalism.Cactus", 30); - write("Experience.Herbalism.Pumpkin", 20); - write("Experience.Herbalism.Flowers", 100); - write("Experience.Herbalism.Wheat", 50); - write("Experience.Herbalism.Mushrooms", 150); - write("Experience.Herbalism.Melon", 20); - write("Experience.Herbalism.Nether_Wart", 50); - write("Experience.Herbalism.Lily_Pads", 100); - write("Experience.Herbalism.Vines", 10); - - //Woodcutting XP values - write("Experience.Woodcutting.Pine", 90); - write("Experience.Woodcutting.Birch", 70); - write("Experience.Woodcutting.Spruce", 80); - - //Excavation XP values - write("Experience.Excavation.Base", 40); - write("Experience.Excavation.Mushroom", 80); - write("Experience.Excavation.Sulphur", 30); - write("Experience.Excavation.Slowsand", 80); - write("Experience.Excavation.Glowstone", 80); - write("Experience.Excavation.Music", 3000); - write("Experience.Excavation.Bones", 30); - write("Experience.Excavation.Diamond", 1000); - write("Experience.Excavation.Apple", 100); - write("Experience.Excavation.Eggs", 100); - write("Experience.Excavation.Cake", 3000); - write("Experience.Excavation.Slimeballs", 100); - write("Experience.Excavation.Cocoa_Beans", 100); - write("Experience.Excavation.Map", 200); - write("Experience.Excavation.String", 200); - write("Experience.Excavation.Bucket", 100); - write("Experience.Excavation.Web", 150); - - //Fishing XP values - write("Experience.Fishing.Base", 800); - - //write("Sorcery.Spells.Water.Thunder", 75); - //write("Sorcery.Spells.Curative.Cure_Self.Mana_Cost", 5); - //write("Sorcery.Spells.Curative.Cure_Other.Mana_Cost", 5); - - write("Excavation.Drops.Cocoa_Beans", true); - write("Excavation.Drops.Mushrooms", true); - write("Excavation.Drops.Glowstone", true); - write("Excavation.Drops.Eggs", true); - write("Excavation.Drops.Apples", true); - write("Excavation.Drops.Cake", true); - write("Excavation.Drops.Music", true); - write("Excavation.Drops.Diamond", true); - write("Excavation.Drops.Slowsand", true); - write("Excavation.Drops.Sulphur", true); - write("Excavation.Drops.Netherrack", true); - write("Excavation.Drops.Bones", true); - write("Excavation.Drops.Slimeballs", true); - write("Excavation.Drops.Map", true); - write("Excavation.Drops.String", true); - write("Excavation.Drops.Bucket", true); - write("Excavation.Drops.Web", true); - - write("Commands.xprate.Name", "xprate"); - write("Commands.xprate.Enabled", true); - write("Commands.mctop.Name", "mctop"); - write("Commands.mctop.Enabled", true); - write("Commands.addxp.Name", "addxp"); - write("Commands.addxp.Enabled", true); - write("Commands.mcability.Name", "mcability"); - write("Commands.mcability.Enabled", true); - write("Commands.mcrefresh.Name", "mcrefresh"); - write("Commands.mcrefresh.Enabled", true); - write("Commands.mcmmo.Name", "mcmmo"); - write("Commands.mcmmo.Donate_Message", true); - write("Commands.mcmmo.Enabled", true); - write("Commands.mcc.Name", "mcc"); - write("Commands.mcc.Enabled", true); - write("Commands.mcgod.Name", "mcgod"); - write("Commands.mcgod.Enabled", true); - write("Commands.stats.Name", "stats"); - write("Commands.stats.Enabled", true); - write("Commands.mmoedit.Name", "mmoedit"); - write("Commands.mmoedit.Enabled", true); - write("Commands.ptp.Name", "ptp"); - write("Commands.ptp.Enabled", true); - write("Commands.party.Name", "party"); - write("Commands.party.Enabled", true); - write("Commands.myspawn.Name", "myspawn"); - write("Commands.myspawn.Enabled", true); - write("Commands.whois.Name", "whois"); - write("Commands.whois.Enabled", true); - write("Commands.invite.Name", "invite"); - write("Commands.invite.Enabled", true); - write("Commands.accept.Name", "accept"); - write("Commands.accept.Enabled", true); - write("Commands.clearmyspawn.Name", "clearmyspawn"); - write("Commands.clearmyspawn.Enabled", true); - write("Commands.xplock.Enabled", true); - write("Commands.xplock.Name", "xplock"); - - write("Abilities.Tools.Durability_Loss_Enabled", true); - write("Abilities.Tools.Durability_Loss", 2); - write("Abilities.Activation.Only_Activate_When_Sneaking", false); - write("Abilities.Cooldowns.Green_Terra", 240); - write("Abilities.Cooldowns.Super_Breaker", 240); - write("Abilities.Cooldowns.Giga_Drill_Breaker", 240); - write("Abilities.Cooldowns.Tree_Feller", 240); - write("Abilities.Cooldowns.Berserk", 240); - write("Abilities.Cooldowns.Serrated_Strikes", 240); - write("Abilities.Cooldowns.Skull_Splitter", 240); - write("Abilities.Messages", true); - write("Abilities.Enabled", true); - - write("Skills.Repair.Anvil_Messages", true); - write("Skills.Repair.Gold.ID", 266); - write("Skills.Repair.Gold.Name", "Gold Bars"); - write("Skills.Repair.Stone.ID", 4); - write("Skills.Repair.Stone.Name", "Cobblestone"); - write("Skills.Repair.Wood.ID", 5); - write("Skills.Repair.Wood.Name", "Wood Planks"); - write("Skills.Repair.Diamond.ID", 264); - write("Skills.Repair.Diamond.Name", "Diamond"); - write("Skills.Repair.Diamond.Level_Required", 50); - write("Skills.Repair.Iron.ID", 265); - write("Skills.Repair.Iron.Name", "Iron Bars"); - write("Skills.Repair.String.ID", 287); - write("Skills.Repair.String.Name", "String"); - write("Skills.Repair.Leather.ID", 334); - write("Skills.Repair.String.Name", "Leather"); - write("Skills.Herbalism.Green_Thumb.Cobble_To_Mossy", true); - write("Skills.Excavation.Requires_Shovel", true); - write("Skills.Mining.Requires_Pickaxe", true); - write("Skills.Woodcutting.Requires_Axe", true); - write("Skills.Taming.Call_Of_The_Wild.Bones_Required", 10); - - //Arcane Forging Config Options - write("Arcane_Forging.Downgrades.Enabled", true); - write("Arcane_Forging.Downgrades.Chance.Rank_1", 75); - write("Arcane_Forging.Downgrades.Chance.Rank_2", 50); - write("Arcane_Forging.Downgrades.Chance.Rank_3", 25); - write("Arcane_Forging.Downgrades.Chance.Rank_4", 15); - write("Arcane_Forging.May_Lose_Enchants.Enabled", true); - write("Arcane_Forging.Keep_Enchants.Chance.Rank_1", 10); - write("Arcane_Forging.Keep_Enchants.Chance.Rank_2", 20); - write("Arcane_Forging.Keep_Enchants.Chance.Rank_3", 30); - write("Arcane_Forging.Keep_Enchants.Chance.Rank_4", 40); - - //Fishing Config Options - write("Fishing.Drops.Item_Drops_Enabled", true); - write("Fishing.Drops.Drop_Chance.Tier_1", 20); - write("Fishing.Drops.Drop_Chance.Tier_2", 25); - write("Fishing.Drops.Drop_Chance.Tier_3", 30); - write("Fishing.Drops.Drop_Chance.Tier_4", 35); - write("Fishing.Drops.Drop_Chance.Tier_5", 40); - write("Fishing.Drops.Leather_Armor", true); - write("Fishing.Drops.Iron_Armor", true); - write("Fishing.Drops.Gold_Armor", true); - write("Fishing.Drops.Diamond_Armor", true); - write("Fishing.Drops.Wooden_Tools", true); - write("Fishing.Drops.Stone_Tools", true); - write("Fishing.Drops.Iron_Tools", true); - write("Fishing.Drops.Gold_Tools", true); - write("Fishing.Drops.Diamond_Tools", true); - write("Fishing.Drops.Ender_Pearl", true); - write("Fishing.Drops.Blaze_Rod", true); - write("Fishing.Drops.Records", true); - write("Fishing.Drops.Glowstone_Dust", true); - write("Fishing.Drops.Diamonds", true); - - saveConfig(); - loadkeys(); - } - private void loadkeys() - { - System.out.println("Loading Config File..."); - - //Setup default HUD - load(); - String temp = readString("Spout.HUD.Default", "STANDARD"); - for(HUDType x : HUDType.values()) - { - if(x.toString().equalsIgnoreCase(temp)) - { - defaulthud = x; - } - } - - enableAbilityMessages = readBoolean("Abilities.Messages", true); - enableAbilities = readBoolean("Abilities.Enabled", true); - - donateMessage = readBoolean("Commands.mcmmo.Donate_Message", true); - xpGainsMobSpawners = readBoolean("XP.Gains.Mobspawners.Enabled", false); - - bonesConsumedByCOTW = readInteger("Skills.Taming.Call_Of_The_Wild.Bones_Required", 10); - - xpbar = readBoolean("Spout.XP.Bar.Enabled", true); - //web_url = readString("Spout.Images.URL_DIR", "http://mcmmo.rycochet.net/mcmmo/"); - xpicon = readBoolean("Spout.XP.Icon.Enabled", true); - xpbar_x = readInteger("Spout.XP.Bar.X_POS", 95); - xpbar_y = readInteger("Spout.XP.Bar.Y_POS", 6); - xpicon_x = readInteger("Spout.XP.Icon.X_POS", 78); - xpicon_y = readInteger("Spout.XP.Icon.Y_POS", 2); - - showFaces = readBoolean("Spout.Party.HUD.Show_Faces", true); - showDisplayName = readBoolean("Spout.Party.HUD.Show_Display_Name", false); - partybar = readBoolean("Spout.Party.HUD.Enabled", true); - - acrobatics_r = readDouble("Spout.HUD.Retro.Colors.Acrobatics.RED", 0.3); - acrobatics_g = readDouble("Spout.HUD.Retro.Colors.Acrobatics.GREEN", 0.3); - acrobatics_b = readDouble("Spout.HUD.Retro.Colors.Acrobatics.BLUE", 0.75); - archery_r = readDouble("Spout.HUD.Retro.Colors.Archery.RED", 0.3); - archery_g = readDouble("Spout.HUD.Retro.Colors.Archery.GREEN", 0.3); - archery_b = readDouble("Spout.HUD.Retro.Colors.Archery.BLUE", 0.75); - axes_r = readDouble("Spout.HUD.Retro.Colors.Axes.RED", 0.3); - axes_g = readDouble("Spout.HUD.Retro.Colors.Axes.GREEN", 0.3); - axes_b = readDouble("Spout.HUD.Retro.Colors.Axes.BLUE", 0.75); - excavation_r = readDouble("Spout.HUD.Retro.Colors.Excavation.RED", 0.3); - excavation_g = readDouble("Spout.HUD.Retro.Colors.Excavation.GREEN", 0.3); - excavation_b = readDouble("Spout.HUD.Retro.Colors.Excavation.BLUE", 0.75); - herbalism_r = readDouble("Spout.HUD.Retro.Colors.Herbalism.RED", 0.3); - herbalism_g = readDouble("Spout.HUD.Retro.Colors.Herbalism.GREEN", 0.3); - herbalism_b = readDouble("Spout.HUD.Retro.Colors.Herbalism.BLUE", 0.75); - mining_r = readDouble("Spout.HUD.Retro.Colors.Mining.RED", 0.3); - mining_g = readDouble("Spout.HUD.Retro.Colors.Mining.GREEN", 0.3); - mining_b = readDouble("Spout.HUD.Retro.Colors.Mining.BLUE", 0.75); - repair_r = readDouble("Spout.HUD.Retro.Colors.Repair.RED", 0.3); - repair_g = readDouble("Spout.HUD.Retro.Colors.Repair.GREEN", 0.3); - repair_b = readDouble("Spout.HUD.Retro.Colors.Repair.BLUE", 0.75); - swords_r = readDouble("Spout.HUD.Retro.Colors.Swords.RED", 0.3); - swords_g = readDouble("Spout.HUD.Retro.Colors.Swords.GREEN", 0.3); - swords_b = readDouble("Spout.HUD.Retro.Colors.Swords.BLUE", 0.75); - taming_r = readDouble("Spout.HUD.Retro.Colors.Taming.RED", 0.3); - taming_g = readDouble("Spout.HUD.Retro.Colors.Taming.GREEN", 0.3); - taming_b = readDouble("Spout.HUD.Retro.Colors.Taming.BLUE", 0.75); - unarmed_r = readDouble("Spout.HUD.Retro.Colors.Unarmed.RED", 0.3); - unarmed_g = readDouble("Spout.HUD.Retro.Colors.Unarmed.GREEN", 0.3); - unarmed_b = readDouble("Spout.HUD.Retro.Colors.Unarmed.BLUE", 0.75); - woodcutting_r = readDouble("Spout.HUD.Retro.Colors.Woodcutting.RED", 0.3); - woodcutting_g = readDouble("Spout.HUD.Retro.Colors.Woodcutting.GREEN", 0.3); - woodcutting_b = readDouble("Spout.HUD.Retro.Colors.Woodcutting.BLUE", 0.75); - fishing_r = readDouble("Spout.HUD.Retro.Colors.Fishing.RED", 0.3); - fishing_g = readDouble("Spout.HUD.Retro.Colors.Fishing.GREEN", 0.3); - fishing_b = readDouble("Spout.HUD.Retro.Colors.Fishing.BLUE", 0.75); - - xpborder_r = readDouble("Spout.HUD.Retro.Colors.Border.RED", 0.0); - xpborder_g = readDouble("Spout.HUD.Retro.Colors.Border.GREEN", 0.0); - xpborder_b = readDouble("Spout.HUD.Retro.Colors.Border.BLUE", 0.0); - xpbackground_r = readDouble("Spout.HUD.Retro.Colors.Background.RED", 0.75); - xpbackground_g = readDouble("Spout.HUD.Retro.Colors.Background.GREEN", 0.75); - xpbackground_b = readDouble("Spout.HUD.Retro.Colors.Background.BLUE", 0.75); - - msulphur = readInteger("Experience.Excavation.Sulphur", 30); - mbones = readInteger("Experience.Excavation.Bones", 30); - mbase = readInteger("Experience.Excavation.Base", 40); - mmushroom2 = readInteger("Experience.Excavation.Mushroom", 80); - mslowsand = readInteger("Experience.Excavation.Slowsand", 80); - mglowstone2 = readInteger("Experience.Excavation.Glowstone", 80); - mmusic = readInteger("Experience.Excavation.Music", 3000); - mdiamond2 = readInteger("Experience.Excavation.Diamond", 1000); - mapple = readInteger("Experience.Excavation.Apple", 100); - meggs = readInteger("Experience.Excavation.Eggs", 100); - mcake = readInteger("Experience.Excavation.Cake", 3000); - mcocoa = readInteger("Experience.Excavation.Cocoa_Beans", 100); - mslimeballs = readInteger("Experience.Excavation.Slimeballs", 100); - mstring = readInteger("Experience.Excavation.String", 200); - mbucket = readInteger("Experience.Excavation.Bucket", 100); - mweb = readInteger("Experience.Excavation.Web", 150); - mwatch = readInteger("Experience.Excavation.Watch", 200); - - msugar = readInteger("Experience.Herbalism.Sugar_Cane", 30); - mwheat = readInteger("Experience.Herbalism.Wheat", 50); - mcactus = readInteger("Experience.Herbalism.Cactus", 30); - mpumpkin = readInteger("Experience.Herbalism.Pumpkin", 20); - mflower = readInteger("Experience.Herbalism.Flowers", 100); - mmushroom = readInteger("Experience.Herbalism.Mushrooms", 150); - mmelon = readInteger("Experience.Herbalism.Melon", 20); - mnetherwart = readInteger("Experience.Herbalism.Nether_Wart", 50); - mlilypad = readInteger("Experience.Herbalism.Lily_Pads", 100); - mvines = readInteger("Experience.Herbalism.Vines", 10); - - mpine = readInteger("Experience.Woodcutting.Pine", 70); - mbirch = readInteger("Experience.Woodcutting.Birch", 80); - mspruce = readInteger("Experience.Woodcutting.Spruce", 90); - - mgold = readInteger("Experience.Mining.Gold", 250); - mdiamond = readInteger("Experience.Mining.Diamond", 750); - miron = readInteger("Experience.Mining.Iron", 250); - mredstone = readInteger("Experience.Mining.Redstone", 150); - mlapis = readInteger("Experience.Mining.lapis", 400); - mobsidian = readInteger("Experience.Mining.Obsidian", 150); - mnetherrack = readInteger("Experience.Mining.Netherrack", 30); - mglowstone = readInteger("Experience.Mining.Glowstone", 30); - mcoal = readInteger("Experience.Mining.Coal", 100); - mstone = readInteger("Experience.Mining.Stone", 30); - msandstone = readInteger("Experience.Mining.Sandstone", 30); - - mfishing = readInteger("Experience.Fishing.Base", 800); - - enableOnlyActivateWhenSneaking = readBoolean("Abilities.Activation.Only_Activate_When_Sneaking", false); - - greenTerraCooldown = readInteger("Abilities.Cooldowns.Green_Terra", 240); - superBreakerCooldown = readInteger("Abilities.Cooldowns.Super_Breaker", 240); - gigaDrillBreakerCooldown = readInteger("Abilities.Cooldowns.Giga_Drill_Breaker", 240); - treeFellerCooldown = readInteger("Abilities.Cooldowns.Tree_Feller", 240); - berserkCooldown = readInteger("Abilities.Cooldowns.Berserk", 240); - serratedStrikeCooldown = readInteger("Abilities.Cooldowns.Serrated_Strikes", 240); - skullSplitterCooldown = readInteger("Abilities.Cooldowns.Skull_Splitter", 240); - - MySQLserverName = readString("MySQL.Server.Address", "localhost"); - if(readString("MySQL.Database.User.Password", null) != null) - MySQLdbPass = readString("MySQL.Database.User.Password", null); - else - MySQLdbPass = ""; - - MySQLdbName = readString("MySQL.Database.Name", "DatabaseName"); - MySQLuserName = readString("MySQL.Database.User.Name", "UserName"); - MySQLtablePrefix = readString("MySQL.Database.TablePrefix", "mcmmo_"); - MySQLport = readInteger("MySQL.Server.Port", 3306); - useMySQL = readBoolean("MySQL.Enabled", false); - - locale = readString("General.Locale", "en_us"); - enableMotd = readBoolean("General.MOTD.Enabled", true); - enableMySpawn = readBoolean("General.MySpawn.Enabled", true); - enableRegen = readBoolean("General.HP_Regeneration.Enabled", true); - - enableCobbleToMossy = readBoolean("Skills.Herbalism.Green_Thumb.Cobble_To_Mossy", true); - - xpGainMultiplier = readInteger("Experience.Gains.Multiplier.Global", 1); - toolsLoseDurabilityFromAbilities = readBoolean("Abilities.Tools.Durability_Loss_Enabled", true); - abilityDurabilityLoss = readInteger("Abilities.Tools.Durability_Loss", 2); - - feathersConsumedByChimaeraWing = readInteger("Items.Chimaera_Wing.Feather_Cost", 10); - chimaeraId = readInteger("Items.Chimaera_Wing.Item_ID", 288); - chimaeraWingEnable = readBoolean("Items.Chimaera_Wing.Enabled", true); - - pvpxp = readBoolean("XP.PVP.Rewards", true); - pvpxprewardmodifier = readDouble("Experience.Gains.Multiplier.PVP", 1.0); - miningrequirespickaxe = readBoolean("Skills.Mining.Requires_Pickaxe", true); - excavationRequiresShovel = readBoolean("Skills.Excavation.Requires_Shovel", true); - woodcuttingrequiresaxe = readBoolean("Skills.Woodcutting.Requires_Axe", true); - repairdiamondlevel = readInteger("Skills.Repair.Diamond.Level_Required", 50); + private void addDefaults() { + // Load from included config.yml + config.options().copyDefaults(true); - sorceryxpmodifier = readDouble("Experience.Formula.Multiplier.Sorcery", 1.0); - tamingxpmodifier = readDouble("Experience.Formula.Multiplier.Taming", 1.0); - miningxpmodifier = readDouble("Experience.Formula.Multiplier.Mining", 1.0); - repairxpmodifier = readDouble("Experience.Formula.Multiplier.Repair", 1.0); - woodcuttingxpmodifier = readDouble("Experience.Formula.Multiplier.Woodcutting", 1.0); - unarmedxpmodifier = readDouble("Experience.Formula.Multiplier.Unarmed", 1.0); - herbalismxpmodifier = readDouble("Experience.Formula.Multiplier.Herbalism", 1.0); - excavationxpmodifier = readDouble("Experience.Formula.Multiplier.Excavation", 1.0); - archeryxpmodifier = readDouble("Experience.Formula.Multiplier.Archery", 1.0); - swordsxpmodifier = readDouble("Experience.Formula.Multiplier.Swords", 1.0); - axesxpmodifier = readDouble("Experience.Formula.Multiplier.Axes", 1.0); - acrobaticsxpmodifier = readDouble("Experience.Formula.Multiplier.Acrobatics", 1.0); + // Put in defaults + writeDefault("Spout.HUD.Default", "STANDARD"); + writeDefault("Spout.XP.Bar.Enabled", true); + writeDefault("Spout.Images.URL_DIR", "http://mcmmo.rycochet.net/mcmmo/"); + writeDefault("Spout.XP.Icon.Enabled", true); + writeDefault("Spout.XP.Bar.X_POS", 95); + writeDefault("Spout.XP.Bar.Y_POS", 6); + writeDefault("Spout.XP.Icon.X_POS", 78); + writeDefault("Spout.XP.Icon.Y_POS", 2); + writeDefault("Spout.Party.HUD.Enabled", true); + writeDefault("Spout.Party.HUD.Show_Faces", true); + writeDefault("Spout.Party.HUD.Show_Display_Name", false); + writeDefault("Spout.Menu.Key", "KEY_M"); + writeDefault("Spout.HUD.Retro.Colors.Acrobatics.RED", 0.3); + writeDefault("Spout.HUD.Retro.Colors.Acrobatics.GREEN", 0.3); + writeDefault("Spout.HUD.Retro.Colors.Acrobatics.BLUE", 0.75); + writeDefault("Spout.HUD.Retro.Colors.Archery.RED", 0.3); + writeDefault("Spout.HUD.Retro.Colors.Archery.GREEN", 0.3); + writeDefault("Spout.HUD.Retro.Colors.Archery.BLUE", 0.75); + writeDefault("Spout.HUD.Retro.Colors.Axes.RED", 0.3); + writeDefault("Spout.HUD.Retro.Colors.Axes.GREEN", 0.3); + writeDefault("Spout.HUD.Retro.Colors.Axes.BLUE", 0.75); + writeDefault("Spout.HUD.Retro.Colors.Excavation.RED", 0.3); + writeDefault("Spout.HUD.Retro.Colors.Excavation.GREEN", 0.3); + writeDefault("Spout.HUD.Retro.Colors.Excavation.BLUE", 0.75); + writeDefault("Spout.HUD.Retro.Colors.Herbalism.RED", 0.3); + writeDefault("Spout.HUD.Retro.Colors.Herbalism.GREEN", 0.3); + writeDefault("Spout.HUD.Retro.Colors.Herbalism.BLUE", 0.75); + writeDefault("Spout.HUD.Retro.Colors.Mining.RED", 0.3); + writeDefault("Spout.HUD.Retro.Colors.Mining.GREEN", 0.3); + writeDefault("Spout.HUD.Retro.Colors.Mining.BLUE", 0.75); + writeDefault("Spout.HUD.Retro.Colors.Repair.RED", 0.3); + writeDefault("Spout.HUD.Retro.Colors.Repair.GREEN", 0.3); + writeDefault("Spout.HUD.Retro.Colors.Repair.BLUE", 0.75); + writeDefault("Spout.HUD.Retro.Colors.Swords.RED", 0.3); + writeDefault("Spout.HUD.Retro.Colors.Swords.GREEN", 0.3); + writeDefault("Spout.HUD.Retro.Colors.Swords.BLUE", 0.75); + writeDefault("Spout.HUD.Retro.Colors.Taming.RED", 0.3); + writeDefault("Spout.HUD.Retro.Colors.Taming.GREEN", 0.3); + writeDefault("Spout.HUD.Retro.Colors.Taming.BLUE", 0.75); + writeDefault("Spout.HUD.Retro.Colors.Unarmed.RED", 0.3); + writeDefault("Spout.HUD.Retro.Colors.Unarmed.GREEN", 0.3); + writeDefault("Spout.HUD.Retro.Colors.Unarmed.BLUE", 0.75); + writeDefault("Spout.HUD.Retro.Colors.Woodcutting.RED", 0.3); + writeDefault("Spout.HUD.Retro.Colors.Woodcutting.GREEN", 0.3); + writeDefault("Spout.HUD.Retro.Colors.Woodcutting.BLUE", 0.75); + writeDefault("Spout.HUD.Retro.Colors.Fishing.RED", 0.3); + writeDefault("Spout.HUD.Retro.Colors.Fishing.GREEN", 0.3); + writeDefault("Spout.HUD.Retro.Colors.Fishing.BLUE", 0.75); + writeDefault("Spout.HUD.Retro.Colors.Border.RED", 0.0); + writeDefault("Spout.HUD.Retro.Colors.Border.GREEN", 0.0); + writeDefault("Spout.HUD.Retro.Colors.Border.BLUE", 0.0); + writeDefault("Spout.HUD.Retro.Colors.Background.RED", 0.75); + writeDefault("Spout.HUD.Retro.Colors.Background.GREEN", 0.75); + writeDefault("Spout.HUD.Retro.Colors.Background.BLUE", 0.75); - anvilmessages = readBoolean("Skills.Repair.Anvil_Messages", true); - - rGold = readInteger("Skills.Repair.Gold.ID", 266); - nGold = readString("Skills.Repair.Gold.Name", "Gold Bars"); - rStone = readInteger("Skills.Repair.Stone.ID", 4); - nStone = readString("Skills.Repair.Stone.Name", "Cobblestone"); - rWood = readInteger("Skills.Repair.Wood.ID", 5); - nWood = readString("Skills.Repair.Wood.Name", "Wood Planks"); - rDiamond = readInteger("Skills.Repair.Diamond.ID", 264); - nDiamond = readString("Skills.Repair.Diamond.Name", "Diamond"); - rIron = readInteger("Skills.Repair.Iron.ID", 265); - nIron = readString("Skills.Repair.Iron.Name", "Iron Bars"); - rString = readInteger("Skills.Repair.String.ID", 287); - nString = readString("Skills.Repair.String.Name", "String"); - rLeather = readInteger("Skills.Repair.Leather.ID", 334); - nLeather = readString("Skills.Repair.String.Name", "Leather"); + writeDefault("MySQL.Enabled", false); + writeDefault("MySQL.Server.Address", "localhost"); + writeDefault("MySQL.Server.Port", 3306); + writeDefault("MySQL.Database.Name", "DataBaseName"); + writeDefault("MySQL.Database.User.Name", "UserName"); + writeDefault("MySQL.Database.TablePrefix", "mcmmo_"); + writeDefault("MySQL.Database.User.Password", "UserPassword"); - mayDowngradeEnchants = readBoolean("Arcane_Forging.Downgrades.Enabled", true); - downgradeRank1 = readInteger("Arcane_Forging.Downgrades.Chance.Rank_1", 75); - downgradeRank2 = readInteger("Arcane_Forging.Downgrades.Chance.Rank_2", 50); - downgradeRank3 = readInteger("Arcane_Forging.Downgrades.Chance.Rank_3", 25); - downgradeRank4 = readInteger("Arcane_Forging.Downgrades.Chance.Rank_4", 15); - mayLoseEnchants = readBoolean("Arcane_Forging.May_Lose_Enchants.Enabled", true); - keepEnchantsRank1 = readInteger("Arcane_Forging.Keep_Enchants.Chance.Rank_1", 10); - keepEnchantsRank2 = readInteger("Arcane_Forging.Keep_Enchants.Chance.Rank_2", 20); - keepEnchantsRank3 = readInteger("Arcane_Forging.Keep_Enchants.Chance.Rank_3", 30); - keepEnchantsRank4 = readInteger("Arcane_Forging.Keep_Enchants.Chance.Rank_4", 40); - - cocoabeans = readBoolean("Excavation.Drops.Cocoa_Beans", true); - mushrooms = readBoolean("Excavation.Drops.Mushrooms", true); - glowstone = readBoolean("Excavation.Drops.Glowstone", true); - eggs = readBoolean("Excavation.Drops.Eggs", true); - apples = readBoolean("Excavation.Drops.Apples", true); - cake = readBoolean("Excavation.Drops.Cake", true); - music = readBoolean("Excavation.Drops.Music", true); - diamond = readBoolean("Excavation.Drops.Diamond", true); - slowsand = readBoolean("Excavation.Drops.Slowsand", true); - sulphur = readBoolean("Excavation.Drops.Sulphur", true); - netherrack = readBoolean("Excavation.Drops.Netherrack", true); - bones = readBoolean("Excavation.Drops.Bones", true); - slimeballs = readBoolean("Excavation.Drops.Slimeballs", true); - watch = readBoolean("Excavation.Drops.Watch", true); - string = readBoolean("Excavation.Drops.String", true); - bucket = readBoolean("Excavation.Drops.Bucket", true); - web = readBoolean("Excavation.Drops.Web", true); - - fishingDrops = readBoolean("Fishing.Drops.Item_Drops_Enabled", true); - fishingDropChanceTier1 = readInteger("Fishing.Drops.Drop_Chance.Tier_1", 20); - fishingDropChanceTier2 = readInteger("Fishing.Drops.Drop_Chance.Tier_2", 25); - fishingDropChanceTier3 = readInteger("Fishing.Drops.Drop_Chance.Tier_3", 30); - fishingDropChanceTier4 = readInteger("Fishing.Drops.Drop_Chance.Tier_4", 35); - fishingDropChanceTier5 = readInteger("Fishing.Drops.Drop_Chance.Tier_5", 40); - leatherArmor = readBoolean("Fishing.Drops.Leather_Armor", true); - ironArmor = readBoolean("Fishing.Drops.Iron_Armor", true); - goldArmor = readBoolean("Fishing.Drops.Gold_Armor", true); - diamondArmor = readBoolean("Fishing.Drops.Diamond_Armor", true); - woodenTools = readBoolean("Fishing.Drops.Wooden_Tools", true); - stoneTools = readBoolean("Fishing.Drops.Stone_Tools", true); - ironTools = readBoolean("Fishing.Drops.Iron_Tools", true); - goldTools = readBoolean("Fishing.Drops.Gold_Tools", true); - diamondTools = readBoolean("Fishing.Drops.Diamond_Tools", true); - enderPearl = readBoolean("Fishing.Drops.Ender_Pearl", true); - blazeRod = readBoolean("Fishing.Drops.Blaze_Rod", true); - records = readBoolean("Fishing.Drops.Records", true); - glowstoneDust = readBoolean("Fishing.Drops.Glowstone_Dust", true); - fishingDiamonds = readBoolean("Fishing.Drops.Diamonds", true); - - xprate = readString("Commands.xprate.Name", "xprate"); - xprateEnable = readBoolean("Commands.xprate.Enabled", true); - - mctop = readString("Commands.mctop.Name", "mctop"); - mctopEnable = readBoolean("Commands.mctop.Enabled", true); - - addxp = readString("Commands.addxp.Name", "addxp"); - addxpEnable = readBoolean("Commands.addxp.Enabled", true); - - mcability = readString("Commands.mcability.Name", "mcability"); - mcabilityEnable = readBoolean("Commands.mcability.Enabled", true); - - mcrefresh = readString("Commands.mcrefresh.Name", "mcrefresh"); - mcrefreshEnable = readBoolean("Commands.mcrefresh.Enabled", true); - - mcmmo = readString("Commands.mcmmo.Name", "mcmmo"); - mcmmoEnable = readBoolean("Commands.mcmmo.Enabled", true); - - mcc = readString("Commands.mcc.Name", "mcc"); - mccEnable = readBoolean("Commands.mcc.Enabled", true); - - mcgod = readString("Commands.mcgod.Name", "mcgod"); - mcgodEnable = readBoolean("Commands.mcgod.Enabled", true); - - stats = readString("Commands.stats.Name", "stats"); - statsEnable = readBoolean("Commands.stats.Enabled", true); - - mmoedit = readString("Commands.mmoedit.Name", "mmoedit"); - mmoeditEnable = readBoolean("Commands.mmoedit.Enabled", true); - - ptp = readString("Commands.ptp.Name", "ptp"); - ptpEnable = readBoolean("Commands.ptp.Enabled", true); - - party = readString("Commands.party.Name", "party"); - partyEnable = readBoolean("Commands.party.Enabled", true); - - myspawn = readString("Commands.myspawn.Name", "myspawn"); - myspawnEnable = readBoolean("Commands.myspawn.Enabled", true); - - whois = readString("Commands.whois.Name", "whois"); - whoisEnable = readBoolean("Commands.whois.Enabled", true); - - invite = readString("Commands.invite.Name", "invite"); - inviteEnable = readBoolean("Commands.invite.Enabled", true); - - accept = readString("Commands.accept.Name", "accept"); - acceptEnable = readBoolean("Commands.accept.Enabled", true); - - clearmyspawn = readString("Commands.clearmyspawn.Name", "clearmyspawn"); - clearmyspawnEnable = readBoolean("Commands.clearmyspawn.Enabled", true); - - xplockEnable = readBoolean("Commands.xplock.Enabled", true); - xplock = readString("Commands.xplock.Name", "xplock"); - } - } \ No newline at end of file + writeDefault("General.Locale", "en_us"); + writeDefault("General.MOTD.Enabled", true); + writeDefault("General.MySpawn.Enabled", true); + writeDefault("General.HP_Regeneration.Enabled", true); + + writeDefault("Items.Chimaera_Wing.Enabled", true); + writeDefault("Items.Chimaera_Wing.Feather_Cost", 10); + writeDefault("Items.Chimaera_Wing.Item_ID", 288); + + writeDefault("Experience.PVP.Rewards", true); + writeDefault("Experience.Gains.Multiplier.PVP", 1); + writeDefault("Experience.Gains.Mobspawners.Enabled", false); + writeDefault("Experience.Gains.Multiplier.Global", 1.0); + writeDefault("Experience.Formula.Multiplier.Taming", 1.0); + writeDefault("Experience.Formula.Multiplier.Mining", 1.0); + writeDefault("Experience.Formula.Multiplier.Repair", 1.0); + writeDefault("Experience.Formula.Multiplier.Woodcutting", 1.0); + writeDefault("Experience.Formula.Multiplier.Unarmed", 1.0); + writeDefault("Experience.Formula.Multiplier.Herbalism", 1.0); + writeDefault("Experience.Formula.Multiplier.Excavation", 1.0); + writeDefault("Experience.Formula.Multiplier.Swords", 1.0); + writeDefault("Experience.Formula.Multiplier.Archery", 1.0); + writeDefault("Experience.Formula.Multiplier.Axes", 1.0); + writeDefault("Experience.Formula.Multiplier.Sorcery", 1.0); + writeDefault("Experience.Formula.Multiplier.Acrobatics", 1.0); + + // Mining XP values + writeDefault("Experience.Mining.Gold", 350); + writeDefault("Experience.Mining.Diamond", 750); + writeDefault("Experience.Mining.Iron", 250); + writeDefault("Experience.Mining.Redstone", 150); + writeDefault("Experience.Mining.Lapis", 400); + writeDefault("Experience.Mining.Obsidian", 150); + writeDefault("Experience.Mining.Netherrack", 30); + writeDefault("Experience.Mining.Glowstone", 30); + writeDefault("Experience.Mining.Coal", 100); + writeDefault("Experience.Mining.Stone", 30); + writeDefault("Experience.Mining.Sandstone", 30); + + // Herbalism XP values + writeDefault("Experience.Herbalism.Sugar_Cane", 30); + writeDefault("Experience.Herbalism.Cactus", 30); + writeDefault("Experience.Herbalism.Pumpkin", 20); + writeDefault("Experience.Herbalism.Flowers", 100); + writeDefault("Experience.Herbalism.Wheat", 50); + writeDefault("Experience.Herbalism.Mushrooms", 150); + writeDefault("Experience.Herbalism.Melon", 20); + writeDefault("Experience.Herbalism.Nether_Wart", 50); + writeDefault("Experience.Herbalism.Lily_Pads", 100); + writeDefault("Experience.Herbalism.Vines", 10); + + // Woodcutting XP values + writeDefault("Experience.Woodcutting.Pine", 90); + writeDefault("Experience.Woodcutting.Birch", 70); + writeDefault("Experience.Woodcutting.Spruce", 80); + + // Excavation XP values + writeDefault("Experience.Excavation.Base", 40); + writeDefault("Experience.Excavation.Mushroom", 80); + writeDefault("Experience.Excavation.Sulphur", 30); + writeDefault("Experience.Excavation.Slowsand", 80); + writeDefault("Experience.Excavation.Glowstone", 80); + writeDefault("Experience.Excavation.Music", 3000); + writeDefault("Experience.Excavation.Bones", 30); + writeDefault("Experience.Excavation.Diamond", 1000); + writeDefault("Experience.Excavation.Apple", 100); + writeDefault("Experience.Excavation.Eggs", 100); + writeDefault("Experience.Excavation.Cake", 3000); + writeDefault("Experience.Excavation.Slimeballs", 100); + writeDefault("Experience.Excavation.Cocoa_Beans", 100); + writeDefault("Experience.Excavation.Map", 200); + writeDefault("Experience.Excavation.String", 200); + writeDefault("Experience.Excavation.Bucket", 100); + writeDefault("Experience.Excavation.Web", 150); + + // Fishing XP values + writeDefault("Experience.Fishing.Base", 800); + + // writeDefault("Sorcery.Spells.Water.Thunder", 75); + // writeDefault("Sorcery.Spells.Curative.Cure_Self.Mana_Cost", 5); + // writeDefault("Sorcery.Spells.Curative.Cure_Other.Mana_Cost", 5); + + writeDefault("Excavation.Drops.Cocoa_Beans", true); + writeDefault("Excavation.Drops.Mushrooms", true); + writeDefault("Excavation.Drops.Glowstone", true); + writeDefault("Excavation.Drops.Eggs", true); + writeDefault("Excavation.Drops.Apples", true); + writeDefault("Excavation.Drops.Cake", true); + writeDefault("Excavation.Drops.Music", true); + writeDefault("Excavation.Drops.Diamond", true); + writeDefault("Excavation.Drops.Slowsand", true); + writeDefault("Excavation.Drops.Sulphur", true); + writeDefault("Excavation.Drops.Netherrack", true); + writeDefault("Excavation.Drops.Bones", true); + writeDefault("Excavation.Drops.Slimeballs", true); + writeDefault("Excavation.Drops.Map", true); + writeDefault("Excavation.Drops.String", true); + writeDefault("Excavation.Drops.Bucket", true); + writeDefault("Excavation.Drops.Web", true); + + writeDefault("Commands.xprate.Name", "xprate"); + writeDefault("Commands.xprate.Enabled", true); + writeDefault("Commands.mctop.Name", "mctop"); + writeDefault("Commands.mctop.Enabled", true); + writeDefault("Commands.addxp.Name", "addxp"); + writeDefault("Commands.addxp.Enabled", true); + writeDefault("Commands.mcability.Name", "mcability"); + writeDefault("Commands.mcability.Enabled", true); + writeDefault("Commands.mcrefresh.Name", "mcrefresh"); + writeDefault("Commands.mcrefresh.Enabled", true); + writeDefault("Commands.mcmmo.Name", "mcmmo"); + writeDefault("Commands.mcmmo.Donate_Message", true); + writeDefault("Commands.mcmmo.Enabled", true); + writeDefault("Commands.mcc.Name", "mcc"); + writeDefault("Commands.mcc.Enabled", true); + writeDefault("Commands.mcgod.Name", "mcgod"); + writeDefault("Commands.mcgod.Enabled", true); + writeDefault("Commands.stats.Name", "stats"); + writeDefault("Commands.stats.Enabled", true); + writeDefault("Commands.mmoedit.Name", "mmoedit"); + writeDefault("Commands.mmoedit.Enabled", true); + writeDefault("Commands.ptp.Name", "ptp"); + writeDefault("Commands.ptp.Enabled", true); + writeDefault("Commands.party.Name", "party"); + writeDefault("Commands.party.Enabled", true); + writeDefault("Commands.myspawn.Name", "myspawn"); + writeDefault("Commands.myspawn.Enabled", true); + writeDefault("Commands.whois.Name", "whois"); + writeDefault("Commands.whois.Enabled", true); + writeDefault("Commands.invite.Name", "invite"); + writeDefault("Commands.invite.Enabled", true); + writeDefault("Commands.accept.Name", "accept"); + writeDefault("Commands.accept.Enabled", true); + writeDefault("Commands.clearmyspawn.Name", "clearmyspawn"); + writeDefault("Commands.clearmyspawn.Enabled", true); + writeDefault("Commands.xplock.Enabled", true); + writeDefault("Commands.xplock.Name", "xplock"); + + writeDefault("Abilities.Tools.Durability_Loss_Enabled", true); + writeDefault("Abilities.Tools.Durability_Loss", 2); + writeDefault("Abilities.Activation.Only_Activate_When_Sneaking", false); + writeDefault("Abilities.Cooldowns.Green_Terra", 240); + writeDefault("Abilities.Cooldowns.Super_Breaker", 240); + writeDefault("Abilities.Cooldowns.Giga_Drill_Breaker", 240); + writeDefault("Abilities.Cooldowns.Tree_Feller", 240); + writeDefault("Abilities.Cooldowns.Berserk", 240); + writeDefault("Abilities.Cooldowns.Serrated_Strikes", 240); + writeDefault("Abilities.Cooldowns.Skull_Splitter", 240); + writeDefault("Abilities.Messages", true); + writeDefault("Abilities.Enabled", true); + + writeDefault("Skills.Repair.Anvil_Messages", true); + writeDefault("Skills.Repair.Gold.ID", 266); + writeDefault("Skills.Repair.Gold.Name", "Gold Bars"); + writeDefault("Skills.Repair.Stone.ID", 4); + writeDefault("Skills.Repair.Stone.Name", "Cobblestone"); + writeDefault("Skills.Repair.Wood.ID", 5); + writeDefault("Skills.Repair.Wood.Name", "Wood Planks"); + writeDefault("Skills.Repair.Diamond.ID", 264); + writeDefault("Skills.Repair.Diamond.Name", "Diamond"); + writeDefault("Skills.Repair.Diamond.Level_Required", 50); + writeDefault("Skills.Repair.Iron.ID", 265); + writeDefault("Skills.Repair.Iron.Name", "Iron Bars"); + writeDefault("Skills.Repair.String.ID", 287); + writeDefault("Skills.Repair.String.Name", "String"); + writeDefault("Skills.Repair.Leather.ID", 334); + writeDefault("Skills.Repair.String.Name", "Leather"); + writeDefault("Skills.Herbalism.Green_Thumb.Cobble_To_Mossy", true); + writeDefault("Skills.Excavation.Requires_Shovel", true); + writeDefault("Skills.Mining.Requires_Pickaxe", true); + writeDefault("Skills.Woodcutting.Requires_Axe", true); + writeDefault("Skills.Taming.Call_Of_The_Wild.Bones_Required", 10); + + // Arcane Forging Config Options + writeDefault("Arcane_Forging.Downgrades.Enabled", true); + writeDefault("Arcane_Forging.Downgrades.Chance.Rank_1", 75); + writeDefault("Arcane_Forging.Downgrades.Chance.Rank_2", 50); + writeDefault("Arcane_Forging.Downgrades.Chance.Rank_3", 25); + writeDefault("Arcane_Forging.Downgrades.Chance.Rank_4", 15); + writeDefault("Arcane_Forging.May_Lose_Enchants.Enabled", true); + writeDefault("Arcane_Forging.Keep_Enchants.Chance.Rank_1", 10); + writeDefault("Arcane_Forging.Keep_Enchants.Chance.Rank_2", 20); + writeDefault("Arcane_Forging.Keep_Enchants.Chance.Rank_3", 30); + writeDefault("Arcane_Forging.Keep_Enchants.Chance.Rank_4", 40); + + // Fishing Config Options + writeDefault("Fishing.Drops.Item_Drops_Enabled", true); + writeDefault("Fishing.Drops.Drop_Chance.Tier_1", 20); + writeDefault("Fishing.Drops.Drop_Chance.Tier_2", 25); + writeDefault("Fishing.Drops.Drop_Chance.Tier_3", 30); + writeDefault("Fishing.Drops.Drop_Chance.Tier_4", 35); + writeDefault("Fishing.Drops.Drop_Chance.Tier_5", 40); + writeDefault("Fishing.Drops.Leather_Armor", true); + writeDefault("Fishing.Drops.Iron_Armor", true); + writeDefault("Fishing.Drops.Gold_Armor", true); + writeDefault("Fishing.Drops.Diamond_Armor", true); + writeDefault("Fishing.Drops.Wooden_Tools", true); + writeDefault("Fishing.Drops.Stone_Tools", true); + writeDefault("Fishing.Drops.Iron_Tools", true); + writeDefault("Fishing.Drops.Gold_Tools", true); + writeDefault("Fishing.Drops.Diamond_Tools", true); + writeDefault("Fishing.Drops.Ender_Pearl", true); + writeDefault("Fishing.Drops.Blaze_Rod", true); + writeDefault("Fishing.Drops.Records", true); + writeDefault("Fishing.Drops.Glowstone_Dust", true); + writeDefault("Fishing.Drops.Diamonds", true); + + saveConfig(); + } + + private void loadKeys() { + plugin.getLogger().info("Loading Config File..."); + + // Setup default HUD + String temp = readString("Spout.HUD.Default", "STANDARD"); + for (HUDType x : HUDType.values()) { + if (x.toString().equalsIgnoreCase(temp)) { + defaulthud = x; + } + } + + enableAbilityMessages = readBoolean("Abilities.Messages", true); + enableAbilities = readBoolean("Abilities.Enabled", true); + + donateMessage = readBoolean("Commands.mcmmo.Donate_Message", true); + xpGainsMobSpawners = readBoolean("XP.Gains.Mobspawners.Enabled", false); + + bonesConsumedByCOTW = readInteger("Skills.Taming.Call_Of_The_Wild.Bones_Required", 10); + + xpbar = readBoolean("Spout.XP.Bar.Enabled", true); + // web_url = readString("Spout.Images.URL_DIR", + // "http://mcmmo.rycochet.net/mcmmo/"); + xpicon = readBoolean("Spout.XP.Icon.Enabled", true); + xpbar_x = readInteger("Spout.XP.Bar.X_POS", 95); + xpbar_y = readInteger("Spout.XP.Bar.Y_POS", 6); + xpicon_x = readInteger("Spout.XP.Icon.X_POS", 78); + xpicon_y = readInteger("Spout.XP.Icon.Y_POS", 2); + + showFaces = readBoolean("Spout.Party.HUD.Show_Faces", true); + showDisplayName = readBoolean("Spout.Party.HUD.Show_Display_Name", false); + partybar = readBoolean("Spout.Party.HUD.Enabled", true); + + acrobatics_r = readDouble("Spout.HUD.Retro.Colors.Acrobatics.RED", 0.3); + acrobatics_g = readDouble("Spout.HUD.Retro.Colors.Acrobatics.GREEN", 0.3); + acrobatics_b = readDouble("Spout.HUD.Retro.Colors.Acrobatics.BLUE", 0.75); + archery_r = readDouble("Spout.HUD.Retro.Colors.Archery.RED", 0.3); + archery_g = readDouble("Spout.HUD.Retro.Colors.Archery.GREEN", 0.3); + archery_b = readDouble("Spout.HUD.Retro.Colors.Archery.BLUE", 0.75); + axes_r = readDouble("Spout.HUD.Retro.Colors.Axes.RED", 0.3); + axes_g = readDouble("Spout.HUD.Retro.Colors.Axes.GREEN", 0.3); + axes_b = readDouble("Spout.HUD.Retro.Colors.Axes.BLUE", 0.75); + excavation_r = readDouble("Spout.HUD.Retro.Colors.Excavation.RED", 0.3); + excavation_g = readDouble("Spout.HUD.Retro.Colors.Excavation.GREEN", 0.3); + excavation_b = readDouble("Spout.HUD.Retro.Colors.Excavation.BLUE", 0.75); + herbalism_r = readDouble("Spout.HUD.Retro.Colors.Herbalism.RED", 0.3); + herbalism_g = readDouble("Spout.HUD.Retro.Colors.Herbalism.GREEN", 0.3); + herbalism_b = readDouble("Spout.HUD.Retro.Colors.Herbalism.BLUE", 0.75); + mining_r = readDouble("Spout.HUD.Retro.Colors.Mining.RED", 0.3); + mining_g = readDouble("Spout.HUD.Retro.Colors.Mining.GREEN", 0.3); + mining_b = readDouble("Spout.HUD.Retro.Colors.Mining.BLUE", 0.75); + repair_r = readDouble("Spout.HUD.Retro.Colors.Repair.RED", 0.3); + repair_g = readDouble("Spout.HUD.Retro.Colors.Repair.GREEN", 0.3); + repair_b = readDouble("Spout.HUD.Retro.Colors.Repair.BLUE", 0.75); + swords_r = readDouble("Spout.HUD.Retro.Colors.Swords.RED", 0.3); + swords_g = readDouble("Spout.HUD.Retro.Colors.Swords.GREEN", 0.3); + swords_b = readDouble("Spout.HUD.Retro.Colors.Swords.BLUE", 0.75); + taming_r = readDouble("Spout.HUD.Retro.Colors.Taming.RED", 0.3); + taming_g = readDouble("Spout.HUD.Retro.Colors.Taming.GREEN", 0.3); + taming_b = readDouble("Spout.HUD.Retro.Colors.Taming.BLUE", 0.75); + unarmed_r = readDouble("Spout.HUD.Retro.Colors.Unarmed.RED", 0.3); + unarmed_g = readDouble("Spout.HUD.Retro.Colors.Unarmed.GREEN", 0.3); + unarmed_b = readDouble("Spout.HUD.Retro.Colors.Unarmed.BLUE", 0.75); + woodcutting_r = readDouble("Spout.HUD.Retro.Colors.Woodcutting.RED", 0.3); + woodcutting_g = readDouble("Spout.HUD.Retro.Colors.Woodcutting.GREEN", 0.3); + woodcutting_b = readDouble("Spout.HUD.Retro.Colors.Woodcutting.BLUE", 0.75); + fishing_r = readDouble("Spout.HUD.Retro.Colors.Fishing.RED", 0.3); + fishing_g = readDouble("Spout.HUD.Retro.Colors.Fishing.GREEN", 0.3); + fishing_b = readDouble("Spout.HUD.Retro.Colors.Fishing.BLUE", 0.75); + + xpborder_r = readDouble("Spout.HUD.Retro.Colors.Border.RED", 0.0); + xpborder_g = readDouble("Spout.HUD.Retro.Colors.Border.GREEN", 0.0); + xpborder_b = readDouble("Spout.HUD.Retro.Colors.Border.BLUE", 0.0); + xpbackground_r = readDouble("Spout.HUD.Retro.Colors.Background.RED", 0.75); + xpbackground_g = readDouble("Spout.HUD.Retro.Colors.Background.GREEN", 0.75); + xpbackground_b = readDouble("Spout.HUD.Retro.Colors.Background.BLUE", 0.75); + + msulphur = readInteger("Experience.Excavation.Sulphur", 30); + mbones = readInteger("Experience.Excavation.Bones", 30); + mbase = readInteger("Experience.Excavation.Base", 40); + mmushroom2 = readInteger("Experience.Excavation.Mushroom", 80); + mslowsand = readInteger("Experience.Excavation.Slowsand", 80); + mglowstone2 = readInteger("Experience.Excavation.Glowstone", 80); + mmusic = readInteger("Experience.Excavation.Music", 3000); + mdiamond2 = readInteger("Experience.Excavation.Diamond", 1000); + mapple = readInteger("Experience.Excavation.Apple", 100); + meggs = readInteger("Experience.Excavation.Eggs", 100); + mcake = readInteger("Experience.Excavation.Cake", 3000); + mcocoa = readInteger("Experience.Excavation.Cocoa_Beans", 100); + mslimeballs = readInteger("Experience.Excavation.Slimeballs", 100); + mstring = readInteger("Experience.Excavation.String", 200); + mbucket = readInteger("Experience.Excavation.Bucket", 100); + mweb = readInteger("Experience.Excavation.Web", 150); + mwatch = readInteger("Experience.Excavation.Watch", 200); + + msugar = readInteger("Experience.Herbalism.Sugar_Cane", 30); + mwheat = readInteger("Experience.Herbalism.Wheat", 50); + mcactus = readInteger("Experience.Herbalism.Cactus", 30); + mpumpkin = readInteger("Experience.Herbalism.Pumpkin", 20); + mflower = readInteger("Experience.Herbalism.Flowers", 100); + mmushroom = readInteger("Experience.Herbalism.Mushrooms", 150); + mmelon = readInteger("Experience.Herbalism.Melon", 20); + mnetherwart = readInteger("Experience.Herbalism.Nether_Wart", 50); + mlilypad = readInteger("Experience.Herbalism.Lily_Pads", 100); + mvines = readInteger("Experience.Herbalism.Vines", 10); + + mpine = readInteger("Experience.Woodcutting.Pine", 70); + mbirch = readInteger("Experience.Woodcutting.Birch", 80); + mspruce = readInteger("Experience.Woodcutting.Spruce", 90); + + mgold = readInteger("Experience.Mining.Gold", 250); + mdiamond = readInteger("Experience.Mining.Diamond", 750); + miron = readInteger("Experience.Mining.Iron", 250); + mredstone = readInteger("Experience.Mining.Redstone", 150); + mlapis = readInteger("Experience.Mining.lapis", 400); + mobsidian = readInteger("Experience.Mining.Obsidian", 150); + mnetherrack = readInteger("Experience.Mining.Netherrack", 30); + mglowstone = readInteger("Experience.Mining.Glowstone", 30); + mcoal = readInteger("Experience.Mining.Coal", 100); + mstone = readInteger("Experience.Mining.Stone", 30); + msandstone = readInteger("Experience.Mining.Sandstone", 30); + + mfishing = readInteger("Experience.Fishing.Base", 800); + + enableOnlyActivateWhenSneaking = readBoolean("Abilities.Activation.Only_Activate_When_Sneaking", false); + + greenTerraCooldown = readInteger("Abilities.Cooldowns.Green_Terra", 240); + superBreakerCooldown = readInteger("Abilities.Cooldowns.Super_Breaker", 240); + gigaDrillBreakerCooldown = readInteger("Abilities.Cooldowns.Giga_Drill_Breaker", 240); + treeFellerCooldown = readInteger("Abilities.Cooldowns.Tree_Feller", 240); + berserkCooldown = readInteger("Abilities.Cooldowns.Berserk", 240); + serratedStrikeCooldown = readInteger("Abilities.Cooldowns.Serrated_Strikes", 240); + skullSplitterCooldown = readInteger("Abilities.Cooldowns.Skull_Splitter", 240); + + MySQLserverName = readString("MySQL.Server.Address", "localhost"); + if (readString("MySQL.Database.User.Password", null) != null) + MySQLdbPass = readString("MySQL.Database.User.Password", null); + else + MySQLdbPass = ""; + + MySQLdbName = readString("MySQL.Database.Name", "DatabaseName"); + MySQLuserName = readString("MySQL.Database.User.Name", "UserName"); + MySQLtablePrefix = readString("MySQL.Database.TablePrefix", "mcmmo_"); + MySQLport = readInteger("MySQL.Server.Port", 3306); + useMySQL = readBoolean("MySQL.Enabled", false); + + locale = readString("General.Locale", "en_us"); + enableMotd = readBoolean("General.MOTD.Enabled", true); + enableMySpawn = readBoolean("General.MySpawn.Enabled", true); + enableRegen = readBoolean("General.HP_Regeneration.Enabled", true); + + enableCobbleToMossy = readBoolean("Skills.Herbalism.Green_Thumb.Cobble_To_Mossy", true); + + xpGainMultiplier = readInteger("Experience.Gains.Multiplier.Global", 1); + toolsLoseDurabilityFromAbilities = readBoolean("Abilities.Tools.Durability_Loss_Enabled", true); + abilityDurabilityLoss = readInteger("Abilities.Tools.Durability_Loss", 2); + + feathersConsumedByChimaeraWing = readInteger("Items.Chimaera_Wing.Feather_Cost", 10); + chimaeraId = readInteger("Items.Chimaera_Wing.Item_ID", 288); + chimaeraWingEnable = readBoolean("Items.Chimaera_Wing.Enabled", true); + + pvpxp = readBoolean("XP.PVP.Rewards", true); + pvpxprewardmodifier = readDouble("Experience.Gains.Multiplier.PVP", 1.0); + miningrequirespickaxe = readBoolean("Skills.Mining.Requires_Pickaxe", true); + excavationRequiresShovel = readBoolean("Skills.Excavation.Requires_Shovel", true); + woodcuttingrequiresaxe = readBoolean("Skills.Woodcutting.Requires_Axe", true); + repairdiamondlevel = readInteger("Skills.Repair.Diamond.Level_Required", 50); + + sorceryxpmodifier = readDouble("Experience.Formula.Multiplier.Sorcery", 1.0); + tamingxpmodifier = readDouble("Experience.Formula.Multiplier.Taming", 1.0); + miningxpmodifier = readDouble("Experience.Formula.Multiplier.Mining", 1.0); + repairxpmodifier = readDouble("Experience.Formula.Multiplier.Repair", 1.0); + woodcuttingxpmodifier = readDouble("Experience.Formula.Multiplier.Woodcutting", 1.0); + unarmedxpmodifier = readDouble("Experience.Formula.Multiplier.Unarmed", 1.0); + herbalismxpmodifier = readDouble("Experience.Formula.Multiplier.Herbalism", 1.0); + excavationxpmodifier = readDouble("Experience.Formula.Multiplier.Excavation", 1.0); + archeryxpmodifier = readDouble("Experience.Formula.Multiplier.Archery", 1.0); + swordsxpmodifier = readDouble("Experience.Formula.Multiplier.Swords", 1.0); + axesxpmodifier = readDouble("Experience.Formula.Multiplier.Axes", 1.0); + acrobaticsxpmodifier = readDouble("Experience.Formula.Multiplier.Acrobatics", 1.0); + + anvilmessages = readBoolean("Skills.Repair.Anvil_Messages", true); + + rGold = readInteger("Skills.Repair.Gold.ID", 266); + nGold = readString("Skills.Repair.Gold.Name", "Gold Bars"); + rStone = readInteger("Skills.Repair.Stone.ID", 4); + nStone = readString("Skills.Repair.Stone.Name", "Cobblestone"); + rWood = readInteger("Skills.Repair.Wood.ID", 5); + nWood = readString("Skills.Repair.Wood.Name", "Wood Planks"); + rDiamond = readInteger("Skills.Repair.Diamond.ID", 264); + nDiamond = readString("Skills.Repair.Diamond.Name", "Diamond"); + rIron = readInteger("Skills.Repair.Iron.ID", 265); + nIron = readString("Skills.Repair.Iron.Name", "Iron Bars"); + rString = readInteger("Skills.Repair.String.ID", 287); + nString = readString("Skills.Repair.String.Name", "String"); + rLeather = readInteger("Skills.Repair.Leather.ID", 334); + nLeather = readString("Skills.Repair.String.Name", "Leather"); + + mayDowngradeEnchants = readBoolean("Arcane_Forging.Downgrades.Enabled", true); + downgradeRank1 = readInteger("Arcane_Forging.Downgrades.Chance.Rank_1", 75); + downgradeRank2 = readInteger("Arcane_Forging.Downgrades.Chance.Rank_2", 50); + downgradeRank3 = readInteger("Arcane_Forging.Downgrades.Chance.Rank_3", 25); + downgradeRank4 = readInteger("Arcane_Forging.Downgrades.Chance.Rank_4", 15); + mayLoseEnchants = readBoolean("Arcane_Forging.May_Lose_Enchants.Enabled", true); + keepEnchantsRank1 = readInteger("Arcane_Forging.Keep_Enchants.Chance.Rank_1", 10); + keepEnchantsRank2 = readInteger("Arcane_Forging.Keep_Enchants.Chance.Rank_2", 20); + keepEnchantsRank3 = readInteger("Arcane_Forging.Keep_Enchants.Chance.Rank_3", 30); + keepEnchantsRank4 = readInteger("Arcane_Forging.Keep_Enchants.Chance.Rank_4", 40); + + cocoabeans = readBoolean("Excavation.Drops.Cocoa_Beans", true); + mushrooms = readBoolean("Excavation.Drops.Mushrooms", true); + glowstone = readBoolean("Excavation.Drops.Glowstone", true); + eggs = readBoolean("Excavation.Drops.Eggs", true); + apples = readBoolean("Excavation.Drops.Apples", true); + cake = readBoolean("Excavation.Drops.Cake", true); + music = readBoolean("Excavation.Drops.Music", true); + diamond = readBoolean("Excavation.Drops.Diamond", true); + slowsand = readBoolean("Excavation.Drops.Slowsand", true); + sulphur = readBoolean("Excavation.Drops.Sulphur", true); + netherrack = readBoolean("Excavation.Drops.Netherrack", true); + bones = readBoolean("Excavation.Drops.Bones", true); + slimeballs = readBoolean("Excavation.Drops.Slimeballs", true); + watch = readBoolean("Excavation.Drops.Watch", true); + string = readBoolean("Excavation.Drops.String", true); + bucket = readBoolean("Excavation.Drops.Bucket", true); + web = readBoolean("Excavation.Drops.Web", true); + + fishingDrops = readBoolean("Fishing.Drops.Item_Drops_Enabled", true); + fishingDropChanceTier1 = readInteger("Fishing.Drops.Drop_Chance.Tier_1", 20); + fishingDropChanceTier2 = readInteger("Fishing.Drops.Drop_Chance.Tier_2", 25); + fishingDropChanceTier3 = readInteger("Fishing.Drops.Drop_Chance.Tier_3", 30); + fishingDropChanceTier4 = readInteger("Fishing.Drops.Drop_Chance.Tier_4", 35); + fishingDropChanceTier5 = readInteger("Fishing.Drops.Drop_Chance.Tier_5", 40); + leatherArmor = readBoolean("Fishing.Drops.Leather_Armor", true); + ironArmor = readBoolean("Fishing.Drops.Iron_Armor", true); + goldArmor = readBoolean("Fishing.Drops.Gold_Armor", true); + diamondArmor = readBoolean("Fishing.Drops.Diamond_Armor", true); + woodenTools = readBoolean("Fishing.Drops.Wooden_Tools", true); + stoneTools = readBoolean("Fishing.Drops.Stone_Tools", true); + ironTools = readBoolean("Fishing.Drops.Iron_Tools", true); + goldTools = readBoolean("Fishing.Drops.Gold_Tools", true); + diamondTools = readBoolean("Fishing.Drops.Diamond_Tools", true); + enderPearl = readBoolean("Fishing.Drops.Ender_Pearl", true); + blazeRod = readBoolean("Fishing.Drops.Blaze_Rod", true); + records = readBoolean("Fishing.Drops.Records", true); + glowstoneDust = readBoolean("Fishing.Drops.Glowstone_Dust", true); + fishingDiamonds = readBoolean("Fishing.Drops.Diamonds", true); + + xprate = readString("Commands.xprate.Name", "xprate"); + xprateEnable = readBoolean("Commands.xprate.Enabled", true); + + mctop = readString("Commands.mctop.Name", "mctop"); + mctopEnable = readBoolean("Commands.mctop.Enabled", true); + + addxp = readString("Commands.addxp.Name", "addxp"); + addxpEnable = readBoolean("Commands.addxp.Enabled", true); + + mcability = readString("Commands.mcability.Name", "mcability"); + mcabilityEnable = readBoolean("Commands.mcability.Enabled", true); + + mcrefresh = readString("Commands.mcrefresh.Name", "mcrefresh"); + mcrefreshEnable = readBoolean("Commands.mcrefresh.Enabled", true); + + mcmmo = readString("Commands.mcmmo.Name", "mcmmo"); + mcmmoEnable = readBoolean("Commands.mcmmo.Enabled", true); + + mcc = readString("Commands.mcc.Name", "mcc"); + mccEnable = readBoolean("Commands.mcc.Enabled", true); + + mcgod = readString("Commands.mcgod.Name", "mcgod"); + mcgodEnable = readBoolean("Commands.mcgod.Enabled", true); + + stats = readString("Commands.stats.Name", "stats"); + statsEnable = readBoolean("Commands.stats.Enabled", true); + + mmoedit = readString("Commands.mmoedit.Name", "mmoedit"); + mmoeditEnable = readBoolean("Commands.mmoedit.Enabled", true); + + ptp = readString("Commands.ptp.Name", "ptp"); + ptpEnable = readBoolean("Commands.ptp.Enabled", true); + + party = readString("Commands.party.Name", "party"); + partyEnable = readBoolean("Commands.party.Enabled", true); + + myspawn = readString("Commands.myspawn.Name", "myspawn"); + myspawnEnable = readBoolean("Commands.myspawn.Enabled", true); + + whois = readString("Commands.whois.Name", "whois"); + whoisEnable = readBoolean("Commands.whois.Enabled", true); + + invite = readString("Commands.invite.Name", "invite"); + inviteEnable = readBoolean("Commands.invite.Enabled", true); + + accept = readString("Commands.accept.Name", "accept"); + acceptEnable = readBoolean("Commands.accept.Enabled", true); + + clearmyspawn = readString("Commands.clearmyspawn.Name", "clearmyspawn"); + clearmyspawnEnable = readBoolean("Commands.clearmyspawn.Enabled", true); + + xplockEnable = readBoolean("Commands.xplock.Enabled", true); + xplock = readString("Commands.xplock.Name", "xplock"); + } +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 086514388..6d22a8993 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -97,7 +97,7 @@ public class mcMMO extends JavaPlugin public Misc misc = new Misc(this); //Config file stuff - LoadProperties config = new LoadProperties(this); + LoadProperties config; //Jar stuff public static File mcmmo; @@ -127,8 +127,8 @@ public class mcMMO extends JavaPlugin mcPermissions.initialize(getServer()); - System.out.println("[mcMMO]Checking config file at: " + this.getDataFolder().toString() + File.separator + "config.yml"); - config.configCheck(); + this.config = new LoadProperties(this); + this.config.load(); Party.getInstance().loadParties(); new Party(this); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml new file mode 100644 index 000000000..bfdf14871 --- /dev/null +++ b/src/main/resources/config.yml @@ -0,0 +1,348 @@ +Items: + Chimaera_Wing: + Enabled: true + Feather_Cost: 10 + Item_ID: 288 +Spout: + Menu: + Key: KEY_M + XP: + Bar: + Enabled: true + X_POS: 95 + Y_POS: 6 + Icon: + Enabled: true + X_POS: 78 + Y_POS: 2 + Party: + HUD: + Show_Faces: true + Enabled: true + Show_Display_Name: false + Images: + URL_DIR: http://mcmmo.rycochet.net/mcmmo/ + HUD: + Default: STANDARD + Retro: + Colors: + Swords: + BLUE: 0.75 + GREEN: 0.3 + RED: 0.3 + Taming: + BLUE: 0.75 + GREEN: 0.3 + RED: 0.3 + Acrobatics: + BLUE: 0.75 + GREEN: 0.3 + RED: 0.3 + Border: + BLUE: 0.0 + GREEN: 0.0 + RED: 0.0 + Background: + BLUE: 0.75 + GREEN: 0.75 + RED: 0.75 + Woodcutting: + BLUE: 0.75 + GREEN: 0.3 + RED: 0.3 + Archery: + BLUE: 0.75 + GREEN: 0.3 + RED: 0.3 + Axes: + BLUE: 0.75 + GREEN: 0.3 + RED: 0.3 + Repair: + BLUE: 0.75 + GREEN: 0.3 + RED: 0.3 + Fishing: + BLUE: 0.75 + GREEN: 0.3 + RED: 0.3 + Excavation: + BLUE: 0.75 + GREEN: 0.3 + RED: 0.3 + Herbalism: + BLUE: 0.75 + GREEN: 0.3 + RED: 0.3 + Unarmed: + BLUE: 0.75 + GREEN: 0.3 + RED: 0.3 + Mining: + BLUE: 0.75 + GREEN: 0.3 + RED: 0.3 +Fishing: + Drops: + Gold_Tools: true + Diamond_Armor: true + Stone_Tools: true + Diamonds: true + Iron_Armor: true + Iron_Tools: true + Diamond_Tools: true + Item_Drops_Enabled: true + Records: true + Blaze_Rod: true + Leather_Armor: true + Drop_Chance: + Tier_1: 20 + Tier_2: 25 + Tier_3: 30 + Tier_4: 35 + Tier_5: 40 + Gold_Armor: true + Glowstone_Dust: true + Ender_Pearl: true + Wooden_Tools: true +Skills: + Taming: + Call_Of_The_Wild: + Bones_Required: 10 + Excavation: + Requires_Shovel: true + Woodcutting: + Requires_Axe: true + Herbalism: + Green_Thumb: + Cobble_To_Mossy: true + Mining: + Requires_Pickaxe: true + Repair: + Leather: + ID: 334 + String: + Name: Leather + ID: 287 + Stone: + Name: Cobblestone + ID: 4 + Wood: + Name: Wood Planks + ID: 5 + Gold: + Name: Gold Bars + ID: 266 + Anvil_Messages: true + Diamond: + Name: Diamond + Level_Required: 50 + ID: 264 + Iron: + Name: Iron Bars + ID: 265 +Experience: + Fishing: + Base: 800 + Formula: + Multiplier: + Swords: 1.0 + Taming: 1.0 + Acrobatics: 1.0 + Sorcery: 1.0 + Excavation: 1.0 + Herbalism: 1.0 + Unarmed: 1.0 + Woodcutting: 1.0 + Mining: 1.0 + Archery: 1.0 + Axes: 1.0 + Repair: 1.0 + Gains: + Mobspawners: + Enabled: false + Multiplier: + PVP: 1 + Global: 1.0 + PVP: + Rewards: true + Excavation: + Base: 40 + Cake: 3000 + Sulphur: 30 + Bones: 30 + Map: 200 + Slimeballs: 100 + Bucket: 100 + Apple: 100 + Mushroom: 80 + Eggs: 100 + Slowsand: 80 + Watch: 200 + Web: 150 + String: 200 + Glowstone: 80 + Music: 3000 + Diamond: 1000 + Cocoa_Beans: 100 + Woodcutting: + Birch: 70 + Spruce: 80 + Pine: 90 + Herbalism: + Sugar_Cane: 30 + Cactus: 30 + Flowers: 100 + Pumpkin: 20 + Mushrooms: 150 + Wheat: 50 + Melon: 20 + Nether_Wart: 50 + Lily_Pads: 100 + Vines: 10 + Mining: + Sandstone: 30 + Glowstone: 30 + Lapis: 400 + Obsidian: 150 + Stone: 30 + Netherrack: 30 + Gold: 350 + Redstone: 150 + Coal: 100 + Diamond: 750 + lapis: 400 + Iron: 250 +MySQL: + Enabled: false + Database: + User: + Name: UserName + Password: UserPassword + Name: DataBaseName + TablePrefix: mcmmo_ + Server: + Port: 3306 + Address: localhost +XP: + Gains: + Mobspawners: + Enabled: false + PVP: + Rewards: true +General: + HP_Regeneration: + Enabled: true + Locale: en_us + MySpawn: + Enabled: true + MOTD: + Enabled: true +Excavation: + Drops: + Cake: true + Sulphur: true + Bones: true + Apples: true + Map: true + Slimeballs: true + Bucket: true + Netherrack: true + Mushrooms: true + Eggs: true + Slowsand: true + Watch: true + Web: true + String: true + Glowstone: true + Music: true + Diamond: true + Cocoa_Beans: true +Arcane_Forging: + Keep_Enchants: + Chance: + Rank_4: 40 + Rank_3: 30 + Rank_2: 20 + Rank_1: 10 + May_Lose_Enchants: + Enabled: true + Downgrades: + Enabled: true + Chance: + Rank_4: 15 + Rank_3: 25 + Rank_2: 50 + Rank_1: 75 +Abilities: + Activation: + Only_Activate_When_Sneaking: false + Enabled: true + Messages: true + Cooldowns: + Giga_Drill_Breaker: 240 + Berserk: 240 + Green_Terra: 240 + Skull_Splitter: 240 + Serrated_Strikes: 240 + Tree_Feller: 240 + Super_Breaker: 240 + Tools: + Durability_Loss: 2 + Durability_Loss_Enabled: true +Commands: + invite: + Name: invite + Enabled: true + mctop: + Name: mctop + Enabled: true + xplock: + Name: xplock + Enabled: true + whois: + Name: whois + Enabled: true + mcc: + Name: mcc + Enabled: true + mmoedit: + Name: mmoedit + Enabled: true + accept: + Name: accept + Enabled: true + stats: + Name: stats + Enabled: true + mcability: + Name: mcability + Enabled: true + party: + Name: party + Enabled: true + xprate: + Name: xprate + Enabled: true + mcgod: + Name: mcgod + Enabled: true + mcmmo: + Name: mcmmo + Enabled: true + Donate_Message: true + mcrefresh: + Name: mcrefresh + Enabled: true + myspawn: + Name: myspawn + Enabled: true + addxp: + Name: addxp + Enabled: true + clearmyspawn: + Name: clearmyspawn + Enabled: true + ptp: + Name: ptp + Enabled: true \ No newline at end of file From 50af20037a85b136896b4636584db7aaadbf59d4 Mon Sep 17 00:00:00 2001 From: TheYeti Date: Tue, 31 Jan 2012 00:22:54 -0800 Subject: [PATCH 2/5] We do not need aliasing anymore --- .../gmail/nossr50/config/LoadProperties.java | 318 ------------------ src/main/resources/config.yml | 18 - 2 files changed, 336 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/LoadProperties.java b/src/main/java/com/gmail/nossr50/config/LoadProperties.java index 00f2b7733..87c39dde7 100644 --- a/src/main/java/com/gmail/nossr50/config/LoadProperties.java +++ b/src/main/java/com/gmail/nossr50/config/LoadProperties.java @@ -107,34 +107,23 @@ public class LoadProperties { loadKeys(); } - private void writeDefault(String root, Object x) { - config.addDefault(root, x); - } - private Boolean readBoolean(String root, Boolean def) { - // Configuration config = load(); Boolean result = config.getBoolean(root, def); - saveConfig(); // Why? return result; } private Double readDouble(String root, Double def) { Double result = config.getDouble(root, def); - saveConfig(); // Why? return result; } private Integer readInteger(String root, Integer def) { - // Configuration config = load(); Integer result = config.getInt(root, def); - saveConfig(); // Why? return result; } public static String readString(String root, String def) { - // Configuration config = load(); String result = config.getString(root, def); - saveConfig(); // Why? return result; } @@ -149,278 +138,6 @@ public class LoadProperties { private void addDefaults() { // Load from included config.yml config.options().copyDefaults(true); - - // Put in defaults - writeDefault("Spout.HUD.Default", "STANDARD"); - writeDefault("Spout.XP.Bar.Enabled", true); - writeDefault("Spout.Images.URL_DIR", "http://mcmmo.rycochet.net/mcmmo/"); - writeDefault("Spout.XP.Icon.Enabled", true); - writeDefault("Spout.XP.Bar.X_POS", 95); - writeDefault("Spout.XP.Bar.Y_POS", 6); - writeDefault("Spout.XP.Icon.X_POS", 78); - writeDefault("Spout.XP.Icon.Y_POS", 2); - writeDefault("Spout.Party.HUD.Enabled", true); - writeDefault("Spout.Party.HUD.Show_Faces", true); - writeDefault("Spout.Party.HUD.Show_Display_Name", false); - writeDefault("Spout.Menu.Key", "KEY_M"); - writeDefault("Spout.HUD.Retro.Colors.Acrobatics.RED", 0.3); - writeDefault("Spout.HUD.Retro.Colors.Acrobatics.GREEN", 0.3); - writeDefault("Spout.HUD.Retro.Colors.Acrobatics.BLUE", 0.75); - writeDefault("Spout.HUD.Retro.Colors.Archery.RED", 0.3); - writeDefault("Spout.HUD.Retro.Colors.Archery.GREEN", 0.3); - writeDefault("Spout.HUD.Retro.Colors.Archery.BLUE", 0.75); - writeDefault("Spout.HUD.Retro.Colors.Axes.RED", 0.3); - writeDefault("Spout.HUD.Retro.Colors.Axes.GREEN", 0.3); - writeDefault("Spout.HUD.Retro.Colors.Axes.BLUE", 0.75); - writeDefault("Spout.HUD.Retro.Colors.Excavation.RED", 0.3); - writeDefault("Spout.HUD.Retro.Colors.Excavation.GREEN", 0.3); - writeDefault("Spout.HUD.Retro.Colors.Excavation.BLUE", 0.75); - writeDefault("Spout.HUD.Retro.Colors.Herbalism.RED", 0.3); - writeDefault("Spout.HUD.Retro.Colors.Herbalism.GREEN", 0.3); - writeDefault("Spout.HUD.Retro.Colors.Herbalism.BLUE", 0.75); - writeDefault("Spout.HUD.Retro.Colors.Mining.RED", 0.3); - writeDefault("Spout.HUD.Retro.Colors.Mining.GREEN", 0.3); - writeDefault("Spout.HUD.Retro.Colors.Mining.BLUE", 0.75); - writeDefault("Spout.HUD.Retro.Colors.Repair.RED", 0.3); - writeDefault("Spout.HUD.Retro.Colors.Repair.GREEN", 0.3); - writeDefault("Spout.HUD.Retro.Colors.Repair.BLUE", 0.75); - writeDefault("Spout.HUD.Retro.Colors.Swords.RED", 0.3); - writeDefault("Spout.HUD.Retro.Colors.Swords.GREEN", 0.3); - writeDefault("Spout.HUD.Retro.Colors.Swords.BLUE", 0.75); - writeDefault("Spout.HUD.Retro.Colors.Taming.RED", 0.3); - writeDefault("Spout.HUD.Retro.Colors.Taming.GREEN", 0.3); - writeDefault("Spout.HUD.Retro.Colors.Taming.BLUE", 0.75); - writeDefault("Spout.HUD.Retro.Colors.Unarmed.RED", 0.3); - writeDefault("Spout.HUD.Retro.Colors.Unarmed.GREEN", 0.3); - writeDefault("Spout.HUD.Retro.Colors.Unarmed.BLUE", 0.75); - writeDefault("Spout.HUD.Retro.Colors.Woodcutting.RED", 0.3); - writeDefault("Spout.HUD.Retro.Colors.Woodcutting.GREEN", 0.3); - writeDefault("Spout.HUD.Retro.Colors.Woodcutting.BLUE", 0.75); - writeDefault("Spout.HUD.Retro.Colors.Fishing.RED", 0.3); - writeDefault("Spout.HUD.Retro.Colors.Fishing.GREEN", 0.3); - writeDefault("Spout.HUD.Retro.Colors.Fishing.BLUE", 0.75); - writeDefault("Spout.HUD.Retro.Colors.Border.RED", 0.0); - writeDefault("Spout.HUD.Retro.Colors.Border.GREEN", 0.0); - writeDefault("Spout.HUD.Retro.Colors.Border.BLUE", 0.0); - writeDefault("Spout.HUD.Retro.Colors.Background.RED", 0.75); - writeDefault("Spout.HUD.Retro.Colors.Background.GREEN", 0.75); - writeDefault("Spout.HUD.Retro.Colors.Background.BLUE", 0.75); - - writeDefault("MySQL.Enabled", false); - writeDefault("MySQL.Server.Address", "localhost"); - writeDefault("MySQL.Server.Port", 3306); - writeDefault("MySQL.Database.Name", "DataBaseName"); - writeDefault("MySQL.Database.User.Name", "UserName"); - writeDefault("MySQL.Database.TablePrefix", "mcmmo_"); - writeDefault("MySQL.Database.User.Password", "UserPassword"); - - writeDefault("General.Locale", "en_us"); - writeDefault("General.MOTD.Enabled", true); - writeDefault("General.MySpawn.Enabled", true); - writeDefault("General.HP_Regeneration.Enabled", true); - - writeDefault("Items.Chimaera_Wing.Enabled", true); - writeDefault("Items.Chimaera_Wing.Feather_Cost", 10); - writeDefault("Items.Chimaera_Wing.Item_ID", 288); - - writeDefault("Experience.PVP.Rewards", true); - writeDefault("Experience.Gains.Multiplier.PVP", 1); - writeDefault("Experience.Gains.Mobspawners.Enabled", false); - writeDefault("Experience.Gains.Multiplier.Global", 1.0); - writeDefault("Experience.Formula.Multiplier.Taming", 1.0); - writeDefault("Experience.Formula.Multiplier.Mining", 1.0); - writeDefault("Experience.Formula.Multiplier.Repair", 1.0); - writeDefault("Experience.Formula.Multiplier.Woodcutting", 1.0); - writeDefault("Experience.Formula.Multiplier.Unarmed", 1.0); - writeDefault("Experience.Formula.Multiplier.Herbalism", 1.0); - writeDefault("Experience.Formula.Multiplier.Excavation", 1.0); - writeDefault("Experience.Formula.Multiplier.Swords", 1.0); - writeDefault("Experience.Formula.Multiplier.Archery", 1.0); - writeDefault("Experience.Formula.Multiplier.Axes", 1.0); - writeDefault("Experience.Formula.Multiplier.Sorcery", 1.0); - writeDefault("Experience.Formula.Multiplier.Acrobatics", 1.0); - - // Mining XP values - writeDefault("Experience.Mining.Gold", 350); - writeDefault("Experience.Mining.Diamond", 750); - writeDefault("Experience.Mining.Iron", 250); - writeDefault("Experience.Mining.Redstone", 150); - writeDefault("Experience.Mining.Lapis", 400); - writeDefault("Experience.Mining.Obsidian", 150); - writeDefault("Experience.Mining.Netherrack", 30); - writeDefault("Experience.Mining.Glowstone", 30); - writeDefault("Experience.Mining.Coal", 100); - writeDefault("Experience.Mining.Stone", 30); - writeDefault("Experience.Mining.Sandstone", 30); - - // Herbalism XP values - writeDefault("Experience.Herbalism.Sugar_Cane", 30); - writeDefault("Experience.Herbalism.Cactus", 30); - writeDefault("Experience.Herbalism.Pumpkin", 20); - writeDefault("Experience.Herbalism.Flowers", 100); - writeDefault("Experience.Herbalism.Wheat", 50); - writeDefault("Experience.Herbalism.Mushrooms", 150); - writeDefault("Experience.Herbalism.Melon", 20); - writeDefault("Experience.Herbalism.Nether_Wart", 50); - writeDefault("Experience.Herbalism.Lily_Pads", 100); - writeDefault("Experience.Herbalism.Vines", 10); - - // Woodcutting XP values - writeDefault("Experience.Woodcutting.Pine", 90); - writeDefault("Experience.Woodcutting.Birch", 70); - writeDefault("Experience.Woodcutting.Spruce", 80); - - // Excavation XP values - writeDefault("Experience.Excavation.Base", 40); - writeDefault("Experience.Excavation.Mushroom", 80); - writeDefault("Experience.Excavation.Sulphur", 30); - writeDefault("Experience.Excavation.Slowsand", 80); - writeDefault("Experience.Excavation.Glowstone", 80); - writeDefault("Experience.Excavation.Music", 3000); - writeDefault("Experience.Excavation.Bones", 30); - writeDefault("Experience.Excavation.Diamond", 1000); - writeDefault("Experience.Excavation.Apple", 100); - writeDefault("Experience.Excavation.Eggs", 100); - writeDefault("Experience.Excavation.Cake", 3000); - writeDefault("Experience.Excavation.Slimeballs", 100); - writeDefault("Experience.Excavation.Cocoa_Beans", 100); - writeDefault("Experience.Excavation.Map", 200); - writeDefault("Experience.Excavation.String", 200); - writeDefault("Experience.Excavation.Bucket", 100); - writeDefault("Experience.Excavation.Web", 150); - - // Fishing XP values - writeDefault("Experience.Fishing.Base", 800); - - // writeDefault("Sorcery.Spells.Water.Thunder", 75); - // writeDefault("Sorcery.Spells.Curative.Cure_Self.Mana_Cost", 5); - // writeDefault("Sorcery.Spells.Curative.Cure_Other.Mana_Cost", 5); - - writeDefault("Excavation.Drops.Cocoa_Beans", true); - writeDefault("Excavation.Drops.Mushrooms", true); - writeDefault("Excavation.Drops.Glowstone", true); - writeDefault("Excavation.Drops.Eggs", true); - writeDefault("Excavation.Drops.Apples", true); - writeDefault("Excavation.Drops.Cake", true); - writeDefault("Excavation.Drops.Music", true); - writeDefault("Excavation.Drops.Diamond", true); - writeDefault("Excavation.Drops.Slowsand", true); - writeDefault("Excavation.Drops.Sulphur", true); - writeDefault("Excavation.Drops.Netherrack", true); - writeDefault("Excavation.Drops.Bones", true); - writeDefault("Excavation.Drops.Slimeballs", true); - writeDefault("Excavation.Drops.Map", true); - writeDefault("Excavation.Drops.String", true); - writeDefault("Excavation.Drops.Bucket", true); - writeDefault("Excavation.Drops.Web", true); - - writeDefault("Commands.xprate.Name", "xprate"); - writeDefault("Commands.xprate.Enabled", true); - writeDefault("Commands.mctop.Name", "mctop"); - writeDefault("Commands.mctop.Enabled", true); - writeDefault("Commands.addxp.Name", "addxp"); - writeDefault("Commands.addxp.Enabled", true); - writeDefault("Commands.mcability.Name", "mcability"); - writeDefault("Commands.mcability.Enabled", true); - writeDefault("Commands.mcrefresh.Name", "mcrefresh"); - writeDefault("Commands.mcrefresh.Enabled", true); - writeDefault("Commands.mcmmo.Name", "mcmmo"); - writeDefault("Commands.mcmmo.Donate_Message", true); - writeDefault("Commands.mcmmo.Enabled", true); - writeDefault("Commands.mcc.Name", "mcc"); - writeDefault("Commands.mcc.Enabled", true); - writeDefault("Commands.mcgod.Name", "mcgod"); - writeDefault("Commands.mcgod.Enabled", true); - writeDefault("Commands.stats.Name", "stats"); - writeDefault("Commands.stats.Enabled", true); - writeDefault("Commands.mmoedit.Name", "mmoedit"); - writeDefault("Commands.mmoedit.Enabled", true); - writeDefault("Commands.ptp.Name", "ptp"); - writeDefault("Commands.ptp.Enabled", true); - writeDefault("Commands.party.Name", "party"); - writeDefault("Commands.party.Enabled", true); - writeDefault("Commands.myspawn.Name", "myspawn"); - writeDefault("Commands.myspawn.Enabled", true); - writeDefault("Commands.whois.Name", "whois"); - writeDefault("Commands.whois.Enabled", true); - writeDefault("Commands.invite.Name", "invite"); - writeDefault("Commands.invite.Enabled", true); - writeDefault("Commands.accept.Name", "accept"); - writeDefault("Commands.accept.Enabled", true); - writeDefault("Commands.clearmyspawn.Name", "clearmyspawn"); - writeDefault("Commands.clearmyspawn.Enabled", true); - writeDefault("Commands.xplock.Enabled", true); - writeDefault("Commands.xplock.Name", "xplock"); - - writeDefault("Abilities.Tools.Durability_Loss_Enabled", true); - writeDefault("Abilities.Tools.Durability_Loss", 2); - writeDefault("Abilities.Activation.Only_Activate_When_Sneaking", false); - writeDefault("Abilities.Cooldowns.Green_Terra", 240); - writeDefault("Abilities.Cooldowns.Super_Breaker", 240); - writeDefault("Abilities.Cooldowns.Giga_Drill_Breaker", 240); - writeDefault("Abilities.Cooldowns.Tree_Feller", 240); - writeDefault("Abilities.Cooldowns.Berserk", 240); - writeDefault("Abilities.Cooldowns.Serrated_Strikes", 240); - writeDefault("Abilities.Cooldowns.Skull_Splitter", 240); - writeDefault("Abilities.Messages", true); - writeDefault("Abilities.Enabled", true); - - writeDefault("Skills.Repair.Anvil_Messages", true); - writeDefault("Skills.Repair.Gold.ID", 266); - writeDefault("Skills.Repair.Gold.Name", "Gold Bars"); - writeDefault("Skills.Repair.Stone.ID", 4); - writeDefault("Skills.Repair.Stone.Name", "Cobblestone"); - writeDefault("Skills.Repair.Wood.ID", 5); - writeDefault("Skills.Repair.Wood.Name", "Wood Planks"); - writeDefault("Skills.Repair.Diamond.ID", 264); - writeDefault("Skills.Repair.Diamond.Name", "Diamond"); - writeDefault("Skills.Repair.Diamond.Level_Required", 50); - writeDefault("Skills.Repair.Iron.ID", 265); - writeDefault("Skills.Repair.Iron.Name", "Iron Bars"); - writeDefault("Skills.Repair.String.ID", 287); - writeDefault("Skills.Repair.String.Name", "String"); - writeDefault("Skills.Repair.Leather.ID", 334); - writeDefault("Skills.Repair.String.Name", "Leather"); - writeDefault("Skills.Herbalism.Green_Thumb.Cobble_To_Mossy", true); - writeDefault("Skills.Excavation.Requires_Shovel", true); - writeDefault("Skills.Mining.Requires_Pickaxe", true); - writeDefault("Skills.Woodcutting.Requires_Axe", true); - writeDefault("Skills.Taming.Call_Of_The_Wild.Bones_Required", 10); - - // Arcane Forging Config Options - writeDefault("Arcane_Forging.Downgrades.Enabled", true); - writeDefault("Arcane_Forging.Downgrades.Chance.Rank_1", 75); - writeDefault("Arcane_Forging.Downgrades.Chance.Rank_2", 50); - writeDefault("Arcane_Forging.Downgrades.Chance.Rank_3", 25); - writeDefault("Arcane_Forging.Downgrades.Chance.Rank_4", 15); - writeDefault("Arcane_Forging.May_Lose_Enchants.Enabled", true); - writeDefault("Arcane_Forging.Keep_Enchants.Chance.Rank_1", 10); - writeDefault("Arcane_Forging.Keep_Enchants.Chance.Rank_2", 20); - writeDefault("Arcane_Forging.Keep_Enchants.Chance.Rank_3", 30); - writeDefault("Arcane_Forging.Keep_Enchants.Chance.Rank_4", 40); - - // Fishing Config Options - writeDefault("Fishing.Drops.Item_Drops_Enabled", true); - writeDefault("Fishing.Drops.Drop_Chance.Tier_1", 20); - writeDefault("Fishing.Drops.Drop_Chance.Tier_2", 25); - writeDefault("Fishing.Drops.Drop_Chance.Tier_3", 30); - writeDefault("Fishing.Drops.Drop_Chance.Tier_4", 35); - writeDefault("Fishing.Drops.Drop_Chance.Tier_5", 40); - writeDefault("Fishing.Drops.Leather_Armor", true); - writeDefault("Fishing.Drops.Iron_Armor", true); - writeDefault("Fishing.Drops.Gold_Armor", true); - writeDefault("Fishing.Drops.Diamond_Armor", true); - writeDefault("Fishing.Drops.Wooden_Tools", true); - writeDefault("Fishing.Drops.Stone_Tools", true); - writeDefault("Fishing.Drops.Iron_Tools", true); - writeDefault("Fishing.Drops.Gold_Tools", true); - writeDefault("Fishing.Drops.Diamond_Tools", true); - writeDefault("Fishing.Drops.Ender_Pearl", true); - writeDefault("Fishing.Drops.Blaze_Rod", true); - writeDefault("Fishing.Drops.Records", true); - writeDefault("Fishing.Drops.Glowstone_Dust", true); - writeDefault("Fishing.Drops.Diamonds", true); - saveConfig(); } @@ -671,58 +388,23 @@ public class LoadProperties { glowstoneDust = readBoolean("Fishing.Drops.Glowstone_Dust", true); fishingDiamonds = readBoolean("Fishing.Drops.Diamonds", true); - xprate = readString("Commands.xprate.Name", "xprate"); xprateEnable = readBoolean("Commands.xprate.Enabled", true); - - mctop = readString("Commands.mctop.Name", "mctop"); mctopEnable = readBoolean("Commands.mctop.Enabled", true); - - addxp = readString("Commands.addxp.Name", "addxp"); addxpEnable = readBoolean("Commands.addxp.Enabled", true); - - mcability = readString("Commands.mcability.Name", "mcability"); mcabilityEnable = readBoolean("Commands.mcability.Enabled", true); - - mcrefresh = readString("Commands.mcrefresh.Name", "mcrefresh"); mcrefreshEnable = readBoolean("Commands.mcrefresh.Enabled", true); - - mcmmo = readString("Commands.mcmmo.Name", "mcmmo"); mcmmoEnable = readBoolean("Commands.mcmmo.Enabled", true); - - mcc = readString("Commands.mcc.Name", "mcc"); mccEnable = readBoolean("Commands.mcc.Enabled", true); - - mcgod = readString("Commands.mcgod.Name", "mcgod"); mcgodEnable = readBoolean("Commands.mcgod.Enabled", true); - - stats = readString("Commands.stats.Name", "stats"); statsEnable = readBoolean("Commands.stats.Enabled", true); - - mmoedit = readString("Commands.mmoedit.Name", "mmoedit"); mmoeditEnable = readBoolean("Commands.mmoedit.Enabled", true); - - ptp = readString("Commands.ptp.Name", "ptp"); ptpEnable = readBoolean("Commands.ptp.Enabled", true); - - party = readString("Commands.party.Name", "party"); partyEnable = readBoolean("Commands.party.Enabled", true); - - myspawn = readString("Commands.myspawn.Name", "myspawn"); myspawnEnable = readBoolean("Commands.myspawn.Enabled", true); - - whois = readString("Commands.whois.Name", "whois"); whoisEnable = readBoolean("Commands.whois.Enabled", true); - - invite = readString("Commands.invite.Name", "invite"); inviteEnable = readBoolean("Commands.invite.Enabled", true); - - accept = readString("Commands.accept.Name", "accept"); acceptEnable = readBoolean("Commands.accept.Enabled", true); - - clearmyspawn = readString("Commands.clearmyspawn.Name", "clearmyspawn"); clearmyspawnEnable = readBoolean("Commands.clearmyspawn.Enabled", true); - - xplockEnable = readBoolean("Commands.xplock.Enabled", true); xplock = readString("Commands.xplock.Name", "xplock"); } } \ No newline at end of file diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index bfdf14871..8b12efb61 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -292,57 +292,39 @@ Abilities: Durability_Loss_Enabled: true Commands: invite: - Name: invite Enabled: true mctop: - Name: mctop Enabled: true xplock: - Name: xplock Enabled: true whois: - Name: whois Enabled: true mcc: - Name: mcc Enabled: true mmoedit: - Name: mmoedit Enabled: true accept: - Name: accept Enabled: true stats: - Name: stats Enabled: true mcability: - Name: mcability Enabled: true party: - Name: party Enabled: true xprate: - Name: xprate Enabled: true mcgod: - Name: mcgod Enabled: true mcmmo: - Name: mcmmo Enabled: true Donate_Message: true mcrefresh: - Name: mcrefresh Enabled: true myspawn: - Name: myspawn Enabled: true addxp: - Name: addxp Enabled: true clearmyspawn: - Name: clearmyspawn Enabled: true ptp: - Name: ptp Enabled: true \ No newline at end of file From 2c7730b47876c476b3c0c8feefb5b75e958aa2c9 Mon Sep 17 00:00:00 2001 From: NuclearW Date: Tue, 31 Jan 2012 03:34:49 -0500 Subject: [PATCH 3/5] Temporary fix for redstoneore duplication: Handle it the same way as a block we cannot use data for. Closes issue #64 --- .../java/com/gmail/nossr50/listeners/mcBlockListener.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java b/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java index 9daedef2f..087a5a35f 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java @@ -75,14 +75,15 @@ public class mcBlockListener implements Listener //Check if the blocks placed should be monitored so they do not give out XP in the future if(m.shouldBeWatched(block)) { - if(block.getTypeId() != 17 && block.getTypeId() != 39 && block.getTypeId() != 40 && block.getTypeId() != 91 && block.getTypeId() != 86) { + int id = block.getTypeId(); + if (id == 17 || id == 39 || id == 40 || id == 91 || id == 86 || id == 73) { + plugin.misc.blockWatchList.add(block); + } else { //block.setData((byte) 5); //Change the byte //The following is a method to get around a breakage in 1.1-R2 and onward //it should be removed as soon as functionality to change a block //in this event returns. plugin.changeQueue.push(block); - } else if(block.getTypeId() == 17 || block.getTypeId() == 39 || block.getTypeId() == 40 || block.getTypeId() == 91 || block.getTypeId() == 86) { - plugin.misc.blockWatchList.add(block); } } From f937e44018e8bb525a0831ce33295d874cb32020 Mon Sep 17 00:00:00 2001 From: TheYeti Date: Tue, 31 Jan 2012 00:36:07 -0800 Subject: [PATCH 4/5] Removal of alias variables and update of all commands --- .../commands/general/AddxpCommand.java | 4 +-- .../commands/general/MmoeditCommand.java | 8 ++--- .../commands/general/WhoisCommand.java | 2 +- .../commands/general/XprateCommand.java | 8 ++--- .../gmail/nossr50/commands/mc/MccCommand.java | 26 ++++++++-------- .../nossr50/commands/mc/McmmoCommand.java | 2 +- .../nossr50/commands/party/InviteCommand.java | 4 +-- .../nossr50/commands/party/PartyCommand.java | 20 ++++++------- .../nossr50/commands/party/PtpCommand.java | 2 +- .../gmail/nossr50/config/LoadProperties.java | 7 ++--- .../nossr50/listeners/mcPlayerListener.java | 2 +- src/main/java/com/gmail/nossr50/mcMMO.java | 30 ------------------- .../java/com/gmail/nossr50/party/Party.java | 2 +- 13 files changed, 42 insertions(+), 75 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/general/AddxpCommand.java b/src/main/java/com/gmail/nossr50/commands/general/AddxpCommand.java index 77fd35ddb..398ebbc72 100644 --- a/src/main/java/com/gmail/nossr50/commands/general/AddxpCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/general/AddxpCommand.java @@ -62,7 +62,7 @@ public class AddxpCommand implements CommandExecutor { return true; } if (args.length < 2) { - player.sendMessage(ChatColor.RED + "Usage is /" + LoadProperties.addxp + " playername skillname xp"); + player.sendMessage(ChatColor.RED + "Usage is /addxp playername skillname xp"); return true; } if (args.length == 3) { @@ -78,7 +78,7 @@ public class AddxpCommand implements CommandExecutor { Users.getProfile(player).addXP(Skills.getSkillType(args[0]), newvalue, player); player.sendMessage(ChatColor.RED + args[0] + " has been modified."); } else { - player.sendMessage(ChatColor.RED + "Usage is /" + LoadProperties.addxp + " playername skillname xp"); + player.sendMessage(ChatColor.RED + "Usage is /addxp playername skillname xp"); } return true; diff --git a/src/main/java/com/gmail/nossr50/commands/general/MmoeditCommand.java b/src/main/java/com/gmail/nossr50/commands/general/MmoeditCommand.java index f715b93ff..336c1a8a1 100644 --- a/src/main/java/com/gmail/nossr50/commands/general/MmoeditCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/general/MmoeditCommand.java @@ -36,7 +36,7 @@ public class MmoeditCommand implements CommandExecutor { if (!(sender instanceof Player)) { if (args.length < 2) { - System.out.println("Usage is /" + LoadProperties.mmoedit + " playername skillname newvalue"); + System.out.println("Usage is /mmoedit playername skillname newvalue"); return true; } else if (args.length == 3) { if ((plugin.getServer().getPlayer(args[0]) != null) && m.isInt(args[2]) && Skills.isSkill(args[1])) { @@ -45,7 +45,7 @@ public class MmoeditCommand implements CommandExecutor { System.out.println(args[1] + " has been modified for " + plugin.getServer().getPlayer(args[0]).getName() + "."); } } else { - System.out.println("Usage is /" + LoadProperties.mmoedit + " playername skillname newvalue"); + System.out.println("Usage is /mmoedit playername skillname newvalue"); } return true; @@ -59,7 +59,7 @@ public class MmoeditCommand implements CommandExecutor { return true; } if (args.length < 2) { - player.sendMessage(ChatColor.RED + "Usage is /" + LoadProperties.mmoedit + " playername skillname newvalue"); + player.sendMessage(ChatColor.RED + "Usage is /mmoedit playername skillname newvalue"); return true; } if (args.length == 3) { @@ -75,7 +75,7 @@ public class MmoeditCommand implements CommandExecutor { player.sendMessage(ChatColor.RED + args[0] + " has been modified."); } } else { - player.sendMessage(ChatColor.RED + "Usage is /" + LoadProperties.mmoedit + " playername skillname newvalue"); + player.sendMessage(ChatColor.RED + "Usage is /mmoedit playername skillname newvalue"); } return true; diff --git a/src/main/java/com/gmail/nossr50/commands/general/WhoisCommand.java b/src/main/java/com/gmail/nossr50/commands/general/WhoisCommand.java index 413055beb..45264554b 100644 --- a/src/main/java/com/gmail/nossr50/commands/general/WhoisCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/general/WhoisCommand.java @@ -38,7 +38,7 @@ public class WhoisCommand implements CommandExecutor { } if (args.length < 1) { - player.sendMessage(ChatColor.RED + "Proper usage is /" + LoadProperties.whois + " "); + player.sendMessage(ChatColor.RED + "Proper usage is /whois "); return true; } // if split[1] is a player diff --git a/src/main/java/com/gmail/nossr50/commands/general/XprateCommand.java b/src/main/java/com/gmail/nossr50/commands/general/XprateCommand.java index 56f1f16c5..97a2a84cd 100644 --- a/src/main/java/com/gmail/nossr50/commands/general/XprateCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/general/XprateCommand.java @@ -27,8 +27,8 @@ public class XprateCommand implements CommandExecutor { if (!(sender instanceof Player)) { if(args.length <= 0) { - System.out.println(mcLocale.getString("Commands.xprate.proper", new Object[] {LoadProperties.xprate})); - System.out.println(mcLocale.getString("Commands.xprate.proper2", new Object[] {LoadProperties.xprate})); + System.out.println(mcLocale.getString("Commands.xprate.proper", new Object[] {"/xprate"})); + System.out.println(mcLocale.getString("Commands.xprate.proper2", new Object[] {"/xprate"})); } if(args.length == 1 && args[0].equalsIgnoreCase("reset")) @@ -81,8 +81,8 @@ public class XprateCommand implements CommandExecutor { } if(args.length <= 0) { - player.sendMessage(mcLocale.getString("Commands.xprate.proper", new Object[] {LoadProperties.xprate})); - player.sendMessage(mcLocale.getString("Commands.xprate.proper2", new Object[] {LoadProperties.xprate})); + player.sendMessage(mcLocale.getString("Commands.xprate.proper", new Object[] {"/xprate"})); + player.sendMessage(mcLocale.getString("Commands.xprate.proper2", new Object[] {"/xprate"})); } if(args.length == 1 && args[0].equalsIgnoreCase("reset")) { diff --git a/src/main/java/com/gmail/nossr50/commands/mc/MccCommand.java b/src/main/java/com/gmail/nossr50/commands/mc/MccCommand.java index 2607445bc..204defb78 100644 --- a/src/main/java/com/gmail/nossr50/commands/mc/MccCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/mc/MccCommand.java @@ -29,44 +29,44 @@ public class MccCommand implements CommandExecutor { if (mcPermissions.getInstance().party(player)) { player.sendMessage(mcLocale.getString("m.mccPartyCommands")); - player.sendMessage(LoadProperties.party + " " + mcLocale.getString("m.mccParty")); - player.sendMessage(LoadProperties.party + " q " + mcLocale.getString("m.mccPartyQ")); + player.sendMessage("/party " + mcLocale.getString("m.mccParty")); + player.sendMessage("/party q " + mcLocale.getString("m.mccPartyQ")); if (mcPermissions.getInstance().partyChat(player)) player.sendMessage("/p " + mcLocale.getString("m.mccPartyToggle")); - player.sendMessage(LoadProperties.invite + " " + mcLocale.getString("m.mccPartyInvite")); - player.sendMessage(LoadProperties.accept + " " + mcLocale.getString("m.mccPartyAccept")); + player.sendMessage("/invite " + mcLocale.getString("m.mccPartyInvite")); + player.sendMessage("/invite " + mcLocale.getString("m.mccPartyAccept")); if (mcPermissions.getInstance().partyTeleport(player)) - player.sendMessage(LoadProperties.ptp + " " + mcLocale.getString("m.mccPartyTeleport")); + player.sendMessage("/ptp " + mcLocale.getString("m.mccPartyTeleport")); } player.sendMessage(mcLocale.getString("m.mccOtherCommands")); - player.sendMessage(LoadProperties.stats + ChatColor.RED + " " + mcLocale.getString("m.mccStats")); + player.sendMessage("/stats " + ChatColor.RED + " " + mcLocale.getString("m.mccStats")); player.sendMessage("/mctop " + ChatColor.RED + mcLocale.getString("m.mccLeaderboards")); if (mcPermissions.getInstance().mySpawn(player)) { - player.sendMessage(LoadProperties.myspawn + " " + ChatColor.RED + mcLocale.getString("m.mccMySpawn")); - player.sendMessage(LoadProperties.clearmyspawn + " " + ChatColor.RED + mcLocale.getString("m.mccClearMySpawn")); + player.sendMessage("/myspawn " + ChatColor.RED + mcLocale.getString("m.mccMySpawn")); + player.sendMessage("/clearmyspawn " + ChatColor.RED + mcLocale.getString("m.mccClearMySpawn")); } if (mcPermissions.getInstance().mcAbility(player)) - player.sendMessage(LoadProperties.mcability + ChatColor.RED + " " + mcLocale.getString("m.mccToggleAbility")); + player.sendMessage("/mcability" + ChatColor.RED + " " + mcLocale.getString("m.mccToggleAbility")); if (mcPermissions.getInstance().adminChat(player)) player.sendMessage("/a " + ChatColor.RED + mcLocale.getString("m.mccAdminToggle")); if (mcPermissions.getInstance().whois(player)) - player.sendMessage(LoadProperties.whois + " " + mcLocale.getString("m.mccWhois")); + player.sendMessage("/whois " + mcLocale.getString("m.mccWhois")); if (mcPermissions.getInstance().mmoedit(player)) - player.sendMessage(LoadProperties.mmoedit + mcLocale.getString("m.mccMmoedit")); + player.sendMessage("/mmoedit" + mcLocale.getString("m.mccMmoedit")); if (mcPermissions.getInstance().mcgod(player)) - player.sendMessage(LoadProperties.mcgod + ChatColor.RED + " " + mcLocale.getString("m.mccMcGod")); + player.sendMessage("/mcgod" + ChatColor.RED + " " + mcLocale.getString("m.mccMcGod")); player.sendMessage(mcLocale.getString("m.mccSkillInfo")); - player.sendMessage(LoadProperties.mcmmo + " " + mcLocale.getString("m.mccModDescription")); + player.sendMessage("/mcmmo " + mcLocale.getString("m.mccModDescription")); return true; } diff --git a/src/main/java/com/gmail/nossr50/commands/mc/McmmoCommand.java b/src/main/java/com/gmail/nossr50/commands/mc/McmmoCommand.java index be1991725..d2babffc8 100644 --- a/src/main/java/com/gmail/nossr50/commands/mc/McmmoCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/mc/McmmoCommand.java @@ -27,7 +27,7 @@ public class McmmoCommand implements CommandExecutor { Player player = (Player) sender; player.sendMessage(ChatColor.RED + "-----[]" + ChatColor.GREEN + "mcMMO" + ChatColor.RED + "[]-----"); - String description = mcLocale.getString("mcMMO.Description", new Object[] { LoadProperties.mcc }); + String description = mcLocale.getString("mcMMO.Description", new Object[] { "/mcc" }); String[] mcSplit = description.split(","); for (String x : mcSplit) { diff --git a/src/main/java/com/gmail/nossr50/commands/party/InviteCommand.java b/src/main/java/com/gmail/nossr50/commands/party/InviteCommand.java index 84f2514d3..02554e04d 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/InviteCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/InviteCommand.java @@ -48,7 +48,7 @@ public class InviteCommand implements CommandExecutor { return true; } if (args.length < 1) { - player.sendMessage(ChatColor.RED + "Usage is /" + LoadProperties.invite + " "); + player.sendMessage(ChatColor.RED + "Usage is /invite "); return true; } if (PP.inParty() && args.length >= 1 && (plugin.getServer().getPlayer(args[0]) != null)) { @@ -61,7 +61,7 @@ public class InviteCommand implements CommandExecutor { // target.sendMessage(ChatColor.RED+"ALERT: "+ChatColor.GREEN+"You have received a party invite for "+PPt.getInvite()+" from "+player.getName()); target.sendMessage(mcLocale.getString("mcPlayerListener.ReceivedInvite1", new Object[] { PPt.getInvite(), player.getName() })); // target.sendMessage(ChatColor.YELLOW+"Type "+ChatColor.GREEN+LoadProperties.accept+ChatColor.YELLOW+" to accept the invite"); - target.sendMessage(mcLocale.getString("mcPlayerListener.ReceivedInvite2", new Object[] { LoadProperties.accept })); + target.sendMessage(mcLocale.getString("mcPlayerListener.ReceivedInvite2", new Object[] { "/accept" })); } else { player.sendMessage(mcLocale.getString("Party.Locked")); return true; diff --git a/src/main/java/com/gmail/nossr50/commands/party/PartyCommand.java b/src/main/java/com/gmail/nossr50/commands/party/PartyCommand.java index 9832b0a88..3e6b25b1e 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/PartyCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/PartyCommand.java @@ -42,9 +42,9 @@ public class PartyCommand implements CommandExecutor { } if (args.length == 0 && !PP.inParty()) { - player.sendMessage(mcLocale.getString("Party.Help1", new Object[] { LoadProperties.party })); - player.sendMessage(mcLocale.getString("Party.Help2", new Object[] { LoadProperties.party })); - player.sendMessage(mcLocale.getString("Party.Help3", new Object[] { LoadProperties.party })); + player.sendMessage(mcLocale.getString("Party.Help1", new Object[] { "/party "})); + player.sendMessage(mcLocale.getString("Party.Help2", new Object[] { "/party "})); + player.sendMessage(mcLocale.getString("Party.Help3", new Object[] { "/party " })); return true; } else if (args.length == 0 && PP.inParty()) { String tempList = ""; @@ -81,13 +81,13 @@ public class PartyCommand implements CommandExecutor { player.sendMessage(mcLocale.getString("mcPlayerListener.LeftParty")); return true; } else if (args[0].equalsIgnoreCase("?")) { - player.sendMessage(mcLocale.getString("Party.Help4", new Object[] { LoadProperties.party })); - player.sendMessage(mcLocale.getString("Party.Help2", new Object[] { LoadProperties.party })); - player.sendMessage(mcLocale.getString("Party.Help5", new Object[] { LoadProperties.party })); - player.sendMessage(mcLocale.getString("Party.Help6", new Object[] { LoadProperties.party })); - player.sendMessage(mcLocale.getString("Party.Help7", new Object[] { LoadProperties.party })); - player.sendMessage(mcLocale.getString("Party.Help8", new Object[] { LoadProperties.party })); - player.sendMessage(mcLocale.getString("Party.Help9", new Object[] { LoadProperties.party })); + player.sendMessage(mcLocale.getString("Party.Help4", new Object[] { "/party " })); + player.sendMessage(mcLocale.getString("Party.Help2", new Object[] { "/party " })); + player.sendMessage(mcLocale.getString("Party.Help5", new Object[] { "/party " })); + player.sendMessage(mcLocale.getString("Party.Help6", new Object[] { "/party " })); + player.sendMessage(mcLocale.getString("Party.Help7", new Object[] { "/party " })); + player.sendMessage(mcLocale.getString("Party.Help8", new Object[] { "/party " })); + player.sendMessage(mcLocale.getString("Party.Help9", new Object[] { "/party " })); } else if (args[0].equalsIgnoreCase("lock")) { if (PP.inParty()) { if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) { diff --git a/src/main/java/com/gmail/nossr50/commands/party/PtpCommand.java b/src/main/java/com/gmail/nossr50/commands/party/PtpCommand.java index cada2df24..175d444c1 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/PtpCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/PtpCommand.java @@ -40,7 +40,7 @@ public class PtpCommand implements CommandExecutor { return true; } if (args.length < 1) { - player.sendMessage(ChatColor.RED + "Usage is /" + LoadProperties.ptp + " "); + player.sendMessage(ChatColor.RED + "Usage is /ptp "); return true; } if (plugin.getServer().getPlayer(args[0]) == null) { diff --git a/src/main/java/com/gmail/nossr50/config/LoadProperties.java b/src/main/java/com/gmail/nossr50/config/LoadProperties.java index 87c39dde7..78c3b7732 100644 --- a/src/main/java/com/gmail/nossr50/config/LoadProperties.java +++ b/src/main/java/com/gmail/nossr50/config/LoadProperties.java @@ -44,10 +44,8 @@ public class LoadProperties { diamondTools, enderPearl, blazeRod, records, glowstoneDust, fishingDiamonds; - public static String xplock, MySQLtablePrefix, MySQLuserName, - MySQLserverName, MySQLdbName, MySQLdbPass, mctop, addxp, xprate, - mcability, mcmmo, mcc, mcrefresh, mcgod, stats, mmoedit, ptp, - party, myspawn, whois, invite, accept, clearmyspawn, nWood, nStone, + public static String MySQLtablePrefix, MySQLuserName, + MySQLserverName, MySQLdbName, MySQLdbPass, nWood, nStone, nIron, nGold, nDiamond, locale, nString, nLeather; public static int mfishing, mwatch, xpbar_x, xpbar_y, xpicon_x, xpicon_y, @@ -405,6 +403,5 @@ public class LoadProperties { inviteEnable = readBoolean("Commands.invite.Enabled", true); acceptEnable = readBoolean("Commands.accept.Enabled", true); clearmyspawnEnable = readBoolean("Commands.clearmyspawn.Enabled", true); - xplock = readString("Commands.xplock.Name", "xplock"); } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java index 02978a929..52a87642a 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java @@ -164,7 +164,7 @@ public class mcPlayerListener implements Listener Player player = event.getPlayer(); if(mcPermissions.getInstance().motd(player) && LoadProperties.enableMotd) { - player.sendMessage(mcLocale.getString("mcPlayerListener.MOTD", new Object[] {plugin.getDescription().getVersion(), LoadProperties.mcmmo})); + player.sendMessage(mcLocale.getString("mcPlayerListener.MOTD", new Object[] {plugin.getDescription().getVersion(), "/mcmmo"})); player.sendMessage(mcLocale.getString("mcPlayerListener.WIKI")); } //THIS IS VERY BAD WAY TO DO THINGS, NEED BETTER WAY diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 6d22a8993..f1f18acb6 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -275,36 +275,6 @@ public class mcMMO extends JavaPlugin aliasMap.put(mcLocale.getString("m.SkillUnarmed").toLowerCase(), "unarmed"); aliasMap.put(mcLocale.getString("m.SkillWoodCutting").toLowerCase(), "woodcutting"); - //Mc* commands - aliasMap.put(LoadProperties.mcability, "mcability"); - aliasMap.put(LoadProperties.mcc, "mcc"); - aliasMap.put(LoadProperties.mcgod, "mcgod"); - aliasMap.put(LoadProperties.mcmmo, "mcmmo"); - aliasMap.put(LoadProperties.mcrefresh, "mcrefresh"); - aliasMap.put(LoadProperties.mctop, "mctop"); - - //Party commands - aliasMap.put(LoadProperties.accept, "accept"); - //aliasMap.put(null, "a"); - aliasMap.put(LoadProperties.invite, "invite"); - aliasMap.put(LoadProperties.party, "party"); - //aliasMap.put(null, "p"); - aliasMap.put(LoadProperties.ptp, "ptp"); - - //Other commands - aliasMap.put(LoadProperties.addxp, "addxp"); - aliasMap.put(LoadProperties.clearmyspawn, "clearmyspawn"); - aliasMap.put(LoadProperties.mmoedit, "mmoedit"); - //aliasMap.put(key, "mmoupdate"); - aliasMap.put(LoadProperties.myspawn, "myspawn"); - aliasMap.put(LoadProperties.stats, "stats"); - aliasMap.put(LoadProperties.whois, "whois"); - aliasMap.put(LoadProperties.xprate, "xprate"); - - //Spout commands - //aliasMap.put(null, "mchud"); - aliasMap.put(LoadProperties.xplock, "xplock"); - //Register commands //Skills commands diff --git a/src/main/java/com/gmail/nossr50/party/Party.java b/src/main/java/com/gmail/nossr50/party/Party.java index 771ffff89..2d48a4098 100644 --- a/src/main/java/com/gmail/nossr50/party/Party.java +++ b/src/main/java/com/gmail/nossr50/party/Party.java @@ -246,7 +246,7 @@ public class Party if(password == null) { //TODO: Needs more locale. - player.sendMessage("This party requires a password. Use "+LoadProperties.party+" to join it."); + player.sendMessage("This party requires a password. Use /party to join it."); return; } else if(!password.equalsIgnoreCase(getPartyPassword(newParty))) { From 563baea81231556285a0273403d16fdb97cf0c2e Mon Sep 17 00:00:00 2001 From: NuclearW Date: Tue, 31 Jan 2012 04:10:39 -0500 Subject: [PATCH 5/5] Selectively setExecutor for commands based on config. --- Changelog.txt | 1 + src/main/java/com/gmail/nossr50/mcMMO.java | 36 +++++++++++----------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 3d2319c5a..57abfe60f 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -10,6 +10,7 @@ Version 1.2.09-dev - New custom event for developers McMMOPlayerLevelUpEvent - New custom event for developers McMMOItemSpawnEvent - Changed LoadProperties from the old Configuration to FileConfiguration + - Removed aliasing from config.yml Version 1.2.08 - Changed Bukkit events to new event system diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index f1f18acb6..aa94c107e 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -292,34 +292,34 @@ public class mcMMO extends JavaPlugin getCommand("woodcutting").setExecutor(new WoodcuttingCommand()); //Mc* commands - getCommand("mcability").setExecutor(new McabilityCommand()); - getCommand("mcc").setExecutor(new MccCommand()); - getCommand("mcgod").setExecutor(new McgodCommand()); - getCommand("mcmmo").setExecutor(new McmmoCommand()); - getCommand("mcrefresh").setExecutor(new McrefreshCommand(this)); - getCommand("mctop").setExecutor(new MctopCommand()); + if(LoadProperties.mcabilityEnable) getCommand("mcability").setExecutor(new McabilityCommand()); + if(LoadProperties.mccEnable) getCommand("mcc").setExecutor(new MccCommand()); + if(LoadProperties.mcgodEnable) getCommand("mcgod").setExecutor(new McgodCommand()); + if(LoadProperties.mcmmoEnable) getCommand("mcmmo").setExecutor(new McmmoCommand()); + if(LoadProperties.mcrefreshEnable) getCommand("mcrefresh").setExecutor(new McrefreshCommand(this)); + if(LoadProperties.mctopEnable) getCommand("mctop").setExecutor(new MctopCommand()); //Party commands - getCommand("accept").setExecutor(new AcceptCommand()); + if(LoadProperties.acceptEnable) getCommand("accept").setExecutor(new AcceptCommand()); getCommand("a").setExecutor(new ACommand()); - getCommand("invite").setExecutor(new InviteCommand(this)); - getCommand("party").setExecutor(new PartyCommand()); + if(LoadProperties.inviteEnable) getCommand("invite").setExecutor(new InviteCommand(this)); + if(LoadProperties.partyEnable) getCommand("party").setExecutor(new PartyCommand()); getCommand("p").setExecutor(new PCommand()); - getCommand("ptp").setExecutor(new PtpCommand(this)); + if(LoadProperties.ptpEnable) getCommand("ptp").setExecutor(new PtpCommand(this)); //Other commands - getCommand("addxp").setExecutor(new AddxpCommand(this)); - getCommand("clearmyspawn").setExecutor(new ClearmyspawnCommand()); - getCommand("mmoedit").setExecutor(new MmoeditCommand(this)); + if(LoadProperties.addxpEnable) getCommand("addxp").setExecutor(new AddxpCommand(this)); + if(LoadProperties.clearmyspawnEnable) getCommand("clearmyspawn").setExecutor(new ClearmyspawnCommand()); + if(LoadProperties.mmoeditEnable) getCommand("mmoedit").setExecutor(new MmoeditCommand(this)); getCommand("mmoupdate").setExecutor(new MmoupdateCommand()); - getCommand("myspawn").setExecutor(new MyspawnCommand()); - getCommand("stats").setExecutor(new StatsCommand()); - getCommand("whois").setExecutor(new WhoisCommand(this)); - getCommand("xprate").setExecutor(new XprateCommand()); + if(LoadProperties.myspawnEnable) getCommand("myspawn").setExecutor(new MyspawnCommand()); + if(LoadProperties.statsEnable) getCommand("stats").setExecutor(new StatsCommand()); + if(LoadProperties.whoisEnable) getCommand("whois").setExecutor(new WhoisCommand(this)); + if(LoadProperties.xprateEnable) getCommand("xprate").setExecutor(new XprateCommand()); //Spout commands getCommand("mchud").setExecutor(new MchudCommand()); - getCommand("xplock").setExecutor(new XplockCommand()); + if(LoadProperties.xplockEnable) getCommand("xplock").setExecutor(new XplockCommand()); }