LoadProperties.java 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. /*
  2. This file is part of mcMMO.
  3. mcMMO is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 3 of the License, or
  6. (at your option) any later version.
  7. mcMMO is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. package com.gmail.nossr50.config;
  15. import com.gmail.nossr50.mcMMO;
  16. import java.io.File;
  17. import java.io.IOException;
  18. import java.util.ArrayList;
  19. import java.util.HashMap;
  20. import java.util.Iterator;
  21. import java.util.List;
  22. import java.util.Map;
  23. import java.util.Set;
  24. import org.bukkit.configuration.ConfigurationSection;
  25. import org.bukkit.configuration.file.FileConfiguration;
  26. import org.bukkit.inventory.ItemStack;
  27. import com.gmail.nossr50.datatypes.HUDType;
  28. import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
  29. import com.gmail.nossr50.datatypes.treasure.FishingTreasure;
  30. import com.gmail.nossr50.datatypes.treasure.Treasure;
  31. public class LoadProperties {
  32. public static Boolean enableOnlyActivateWhenSneaking,
  33. enableAbilityMessages, enableAbilities, showDisplayName, showFaces,
  34. xplockEnable, xpbar, xpicon, partybar, xprateEnable, spoutEnabled,
  35. donateMessage, chimaeraWingEnable, xpGainsMobSpawners, myspawnEnable,
  36. mccEnable, mcmmoEnable, partyEnable, inviteEnable, acceptEnable,
  37. whoisEnable, statsEnable, addxpEnable, ptpEnable, mmoeditEnable,
  38. clearmyspawnEnable, mcgodEnable, mcabilityEnable, mctopEnable,
  39. mcrefreshEnable, aEnable, pEnable, enableMotd, enableMySpawn,
  40. enableCobbleToMossy, useMySQL, toolsLoseDurabilityFromAbilities,
  41. pvpxp, miningrequirespickaxe, excavationRequiresShovel,
  42. woodcuttingrequiresaxe, anvilmessages, mayDowngradeEnchants,
  43. mayLoseEnchants, fishingDrops, leatherArmor, ironArmor, goldArmor,
  44. diamondArmor, woodenTools, stoneTools, ironTools, goldTools,
  45. diamondTools, enderPearl, blazeRod, records, glowstoneDust,
  46. fishingDiamonds, aDisplayNames, pDisplayNames, enableSmoothToMossy,
  47. enableDirtToGrass, statsTracking, eventCallback, herbalismHungerBonus;
  48. public static String MySQLtablePrefix, MySQLuserName,
  49. MySQLserverName, MySQLdbName, MySQLdbPass, nWood, nStone,
  50. nIron, nGold, nDiamond, locale, nString, nLeather;
  51. public static int mshearing, mfishing, xpbar_x, xpbar_y, xpicon_x, xpicon_y,
  52. chimaeraId, msandstone, mbase, mpine, mbirch, mspruce, mmelon,
  53. mcactus, mmushroom, mflower, msugar, mpumpkin, mwheat, mgold,
  54. mdiamond, miron, mredstone, mlapis, mobsidian, mnetherrack,
  55. mglowstone, mcoal, mstone, MySQLport, xpGainMultiplier,
  56. superBreakerCooldown, greenTerraCooldown, gigaDrillBreakerCooldown,
  57. treeFellerCooldown, berserkCooldown, serratedStrikeCooldown,
  58. skullSplitterCooldown, abilityDurabilityLoss,
  59. feathersConsumedByChimaeraWing, bonesConsumedByCOTW,
  60. repairdiamondlevel, rWood, rStone, rIron, rGold, rDiamond, rString,
  61. rLeather, downgradeRank1, downgradeRank2, downgradeRank3,
  62. downgradeRank4, keepEnchantsRank1, keepEnchantsRank2,
  63. keepEnchantsRank3, keepEnchantsRank4, fishingDropChanceTier1,
  64. fishingDropChanceTier2, fishingDropChanceTier3,
  65. fishingDropChanceTier4, fishingDropChanceTier5, mnetherwart,
  66. mvines, mlilypad, mendstone, mmossstone,
  67. levelCapAcrobatics, levelCapArchery, levelCapAxes, levelCapExcavation,
  68. levelCapFishing, levelCapHerbalism, levelCapMining, levelCapRepair,
  69. levelCapSwords, levelCapTaming, levelCapUnarmed, levelCapWoodcutting,
  70. anvilID, saveInterval;
  71. public static double xpbackground_r, xpbackground_g, xpbackground_b,
  72. xpborder_r, xpborder_g, xpborder_b, fishing_r, fishing_g,
  73. fishing_b, acrobatics_r, acrobatics_g, acrobatics_b, archery_r,
  74. archery_g, archery_b, axes_r, axes_g, axes_b, excavation_r,
  75. excavation_g, excavation_b, herbalism_r, herbalism_g, herbalism_b,
  76. mining_r, mining_g, mining_b, repair_r, repair_g, repair_b,
  77. swords_r, swords_g, swords_b, taming_r, taming_g, taming_b,
  78. unarmed_r, unarmed_g, unarmed_b, woodcutting_r, woodcutting_g,
  79. woodcutting_b, pvpxprewardmodifier, tamingxpmodifier,
  80. miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier,
  81. sorceryxpmodifier, unarmedxpmodifier, herbalismxpmodifier,
  82. excavationxpmodifier, archeryxpmodifier, swordsxpmodifier,
  83. axesxpmodifier, acrobaticsxpmodifier;
  84. public static List<ExcavationTreasure> excavationFromDirt = new ArrayList<ExcavationTreasure>();
  85. public static List<ExcavationTreasure> excavationFromGrass = new ArrayList<ExcavationTreasure>();
  86. public static List<ExcavationTreasure> excavationFromSand = new ArrayList<ExcavationTreasure>();
  87. public static List<ExcavationTreasure> excavationFromGravel = new ArrayList<ExcavationTreasure>();
  88. public static List<ExcavationTreasure> excavationFromClay = new ArrayList<ExcavationTreasure>();
  89. public static List<ExcavationTreasure> excavationFromMycel = new ArrayList<ExcavationTreasure>();
  90. public static List<ExcavationTreasure> excavationFromSoulSand = new ArrayList<ExcavationTreasure>();
  91. public static List<FishingTreasure> fishingRewards = new ArrayList<FishingTreasure>();
  92. public static HUDType defaulthud;
  93. protected static File configFile;
  94. protected static File dataFolder;
  95. protected final mcMMO plugin;
  96. protected static FileConfiguration config;
  97. public LoadProperties(mcMMO plugin) {
  98. this.plugin = plugin;
  99. dataFolder = plugin.getDataFolder();
  100. configFile = new File(dataFolder, File.separator + "config.yml");
  101. config = plugin.getConfig();
  102. }
  103. public void load() {
  104. // If not exist, copy from the jar
  105. if (!configFile.exists()) {
  106. dataFolder.mkdir();
  107. plugin.saveDefaultConfig();
  108. }
  109. addDefaults();
  110. loadKeys();
  111. }
  112. private Boolean readBoolean(String root, Boolean def) {
  113. Boolean result = config.getBoolean(root, def);
  114. return result;
  115. }
  116. private Double readDouble(String root, Double def) {
  117. Double result = config.getDouble(root, def);
  118. return result;
  119. }
  120. private Integer readInteger(String root, Integer def) {
  121. Integer result = config.getInt(root, def);
  122. return result;
  123. }
  124. public static String readString(String root, String def) {
  125. String result = config.getString(root, def);
  126. return result;
  127. }
  128. private static void saveConfig() {
  129. try {
  130. config.save(configFile);
  131. } catch (IOException e) {
  132. e.printStackTrace();
  133. }
  134. }
  135. private void addDefaults() {
  136. // Load from included config.yml
  137. config.options().copyDefaults(true);
  138. saveConfig();
  139. }
  140. private void loadKeys() {
  141. plugin.getLogger().info("Loading Config File...");
  142. // Setup default HUD
  143. String temp = readString("Spout.HUD.Default", "STANDARD");
  144. for (HUDType x : HUDType.values()) {
  145. if (x.toString().equalsIgnoreCase(temp)) {
  146. defaulthud = x;
  147. }
  148. }
  149. enableAbilityMessages = readBoolean("Abilities.Messages", true);
  150. enableAbilities = readBoolean("Abilities.Enabled", true);
  151. donateMessage = readBoolean("Commands.mcmmo.Donate_Message", true);
  152. xpGainsMobSpawners = readBoolean("Experience.Gains.Mobspawners.Enabled", false);
  153. bonesConsumedByCOTW = readInteger("Skills.Taming.Call_Of_The_Wild.Bones_Required", 10);
  154. xpbar = readBoolean("Spout.XP.Bar.Enabled", true);
  155. // web_url = readString("Spout.Images.URL_DIR",
  156. // "http://mcmmo.rycochet.net/mcmmo/");
  157. xpicon = readBoolean("Spout.XP.Icon.Enabled", true);
  158. xpbar_x = readInteger("Spout.XP.Bar.X_POS", 95);
  159. xpbar_y = readInteger("Spout.XP.Bar.Y_POS", 6);
  160. xpicon_x = readInteger("Spout.XP.Icon.X_POS", 78);
  161. xpicon_y = readInteger("Spout.XP.Icon.Y_POS", 2);
  162. showFaces = readBoolean("Spout.Party.HUD.Show_Faces", true);
  163. showDisplayName = readBoolean("Spout.Party.HUD.Show_Display_Name", false);
  164. partybar = readBoolean("Spout.Party.HUD.Enabled", true);
  165. acrobatics_r = readDouble("Spout.HUD.Retro.Colors.Acrobatics.RED", 0.3);
  166. acrobatics_g = readDouble("Spout.HUD.Retro.Colors.Acrobatics.GREEN", 0.3);
  167. acrobatics_b = readDouble("Spout.HUD.Retro.Colors.Acrobatics.BLUE", 0.75);
  168. archery_r = readDouble("Spout.HUD.Retro.Colors.Archery.RED", 0.3);
  169. archery_g = readDouble("Spout.HUD.Retro.Colors.Archery.GREEN", 0.3);
  170. archery_b = readDouble("Spout.HUD.Retro.Colors.Archery.BLUE", 0.75);
  171. axes_r = readDouble("Spout.HUD.Retro.Colors.Axes.RED", 0.3);
  172. axes_g = readDouble("Spout.HUD.Retro.Colors.Axes.GREEN", 0.3);
  173. axes_b = readDouble("Spout.HUD.Retro.Colors.Axes.BLUE", 0.75);
  174. excavation_r = readDouble("Spout.HUD.Retro.Colors.Excavation.RED", 0.3);
  175. excavation_g = readDouble("Spout.HUD.Retro.Colors.Excavation.GREEN", 0.3);
  176. excavation_b = readDouble("Spout.HUD.Retro.Colors.Excavation.BLUE", 0.75);
  177. herbalism_r = readDouble("Spout.HUD.Retro.Colors.Herbalism.RED", 0.3);
  178. herbalism_g = readDouble("Spout.HUD.Retro.Colors.Herbalism.GREEN", 0.3);
  179. herbalism_b = readDouble("Spout.HUD.Retro.Colors.Herbalism.BLUE", 0.75);
  180. mining_r = readDouble("Spout.HUD.Retro.Colors.Mining.RED", 0.3);
  181. mining_g = readDouble("Spout.HUD.Retro.Colors.Mining.GREEN", 0.3);
  182. mining_b = readDouble("Spout.HUD.Retro.Colors.Mining.BLUE", 0.75);
  183. repair_r = readDouble("Spout.HUD.Retro.Colors.Repair.RED", 0.3);
  184. repair_g = readDouble("Spout.HUD.Retro.Colors.Repair.GREEN", 0.3);
  185. repair_b = readDouble("Spout.HUD.Retro.Colors.Repair.BLUE", 0.75);
  186. swords_r = readDouble("Spout.HUD.Retro.Colors.Swords.RED", 0.3);
  187. swords_g = readDouble("Spout.HUD.Retro.Colors.Swords.GREEN", 0.3);
  188. swords_b = readDouble("Spout.HUD.Retro.Colors.Swords.BLUE", 0.75);
  189. taming_r = readDouble("Spout.HUD.Retro.Colors.Taming.RED", 0.3);
  190. taming_g = readDouble("Spout.HUD.Retro.Colors.Taming.GREEN", 0.3);
  191. taming_b = readDouble("Spout.HUD.Retro.Colors.Taming.BLUE", 0.75);
  192. unarmed_r = readDouble("Spout.HUD.Retro.Colors.Unarmed.RED", 0.3);
  193. unarmed_g = readDouble("Spout.HUD.Retro.Colors.Unarmed.GREEN", 0.3);
  194. unarmed_b = readDouble("Spout.HUD.Retro.Colors.Unarmed.BLUE", 0.75);
  195. woodcutting_r = readDouble("Spout.HUD.Retro.Colors.Woodcutting.RED", 0.3);
  196. woodcutting_g = readDouble("Spout.HUD.Retro.Colors.Woodcutting.GREEN", 0.3);
  197. woodcutting_b = readDouble("Spout.HUD.Retro.Colors.Woodcutting.BLUE", 0.75);
  198. fishing_r = readDouble("Spout.HUD.Retro.Colors.Fishing.RED", 0.3);
  199. fishing_g = readDouble("Spout.HUD.Retro.Colors.Fishing.GREEN", 0.3);
  200. fishing_b = readDouble("Spout.HUD.Retro.Colors.Fishing.BLUE", 0.75);
  201. xpborder_r = readDouble("Spout.HUD.Retro.Colors.Border.RED", 0.0);
  202. xpborder_g = readDouble("Spout.HUD.Retro.Colors.Border.GREEN", 0.0);
  203. xpborder_b = readDouble("Spout.HUD.Retro.Colors.Border.BLUE", 0.0);
  204. xpbackground_r = readDouble("Spout.HUD.Retro.Colors.Background.RED", 0.75);
  205. xpbackground_g = readDouble("Spout.HUD.Retro.Colors.Background.GREEN", 0.75);
  206. xpbackground_b = readDouble("Spout.HUD.Retro.Colors.Background.BLUE", 0.75);
  207. mbase = readInteger("Experience.Excavation.Base", 40);
  208. msugar = readInteger("Experience.Herbalism.Sugar_Cane", 30);
  209. mwheat = readInteger("Experience.Herbalism.Wheat", 50);
  210. mcactus = readInteger("Experience.Herbalism.Cactus", 30);
  211. mpumpkin = readInteger("Experience.Herbalism.Pumpkin", 20);
  212. mflower = readInteger("Experience.Herbalism.Flowers", 100);
  213. mmushroom = readInteger("Experience.Herbalism.Mushrooms", 150);
  214. mmelon = readInteger("Experience.Herbalism.Melon", 20);
  215. mnetherwart = readInteger("Experience.Herbalism.Nether_Wart", 50);
  216. mlilypad = readInteger("Experience.Herbalism.Lily_Pads", 100);
  217. mvines = readInteger("Experience.Herbalism.Vines", 10);
  218. herbalismHungerBonus = readBoolean("Skills.Herbalism.Hunger_Bonus", true);
  219. mpine = readInteger("Experience.Woodcutting.Pine", 70);
  220. mbirch = readInteger("Experience.Woodcutting.Birch", 80);
  221. mspruce = readInteger("Experience.Woodcutting.Spruce", 90);
  222. mgold = readInteger("Experience.Mining.Gold", 250);
  223. mdiamond = readInteger("Experience.Mining.Diamond", 750);
  224. miron = readInteger("Experience.Mining.Iron", 250);
  225. mredstone = readInteger("Experience.Mining.Redstone", 150);
  226. mlapis = readInteger("Experience.Mining.Lapis", 400);
  227. mobsidian = readInteger("Experience.Mining.Obsidian", 150);
  228. mnetherrack = readInteger("Experience.Mining.Netherrack", 30);
  229. mglowstone = readInteger("Experience.Mining.Glowstone", 30);
  230. mcoal = readInteger("Experience.Mining.Coal", 100);
  231. mstone = readInteger("Experience.Mining.Stone", 30);
  232. msandstone = readInteger("Experience.Mining.Sandstone", 30);
  233. mendstone = readInteger("Experience.Mining.End_Stone", 150);
  234. mmossstone = readInteger("Experience.Mining.Moss_Stone", 30);
  235. mshearing = readInteger("Experience.Taming.Shearing", 250);
  236. mfishing = readInteger("Experience.Fishing.Base", 800);
  237. enableOnlyActivateWhenSneaking = readBoolean("Abilities.Activation.Only_Activate_When_Sneaking", false);
  238. greenTerraCooldown = readInteger("Abilities.Cooldowns.Green_Terra", 240);
  239. superBreakerCooldown = readInteger("Abilities.Cooldowns.Super_Breaker", 240);
  240. gigaDrillBreakerCooldown = readInteger("Abilities.Cooldowns.Giga_Drill_Breaker", 240);
  241. treeFellerCooldown = readInteger("Abilities.Cooldowns.Tree_Feller", 240);
  242. berserkCooldown = readInteger("Abilities.Cooldowns.Berserk", 240);
  243. serratedStrikeCooldown = readInteger("Abilities.Cooldowns.Serrated_Strikes", 240);
  244. skullSplitterCooldown = readInteger("Abilities.Cooldowns.Skull_Splitter", 240);
  245. MySQLserverName = readString("MySQL.Server.Address", "localhost");
  246. if (readString("MySQL.Database.User.Password", null) != null)
  247. MySQLdbPass = readString("MySQL.Database.User.Password", null);
  248. else
  249. MySQLdbPass = "";
  250. MySQLdbName = readString("MySQL.Database.Name", "DatabaseName");
  251. MySQLuserName = readString("MySQL.Database.User.Name", "UserName");
  252. MySQLtablePrefix = readString("MySQL.Database.TablePrefix", "mcmmo_");
  253. MySQLport = readInteger("MySQL.Server.Port", 3306);
  254. useMySQL = readBoolean("MySQL.Enabled", false);
  255. locale = readString("General.Locale", "en_us");
  256. enableMotd = readBoolean("General.MOTD.Enabled", true);
  257. enableMySpawn = readBoolean("General.MySpawn.Enabled", true);
  258. saveInterval = readInteger("General.Save_Interval", 10);
  259. statsTracking = readBoolean("General.Stats_Tracking", true);
  260. eventCallback = readBoolean("General.Event_Callback", true);
  261. enableCobbleToMossy = readBoolean("Skills.Herbalism.Green_Thumb.Cobble_To_Mossy", true);
  262. enableSmoothToMossy = readBoolean("Skills.Herbalism.Green_Thumb.SmoothBrick_To_MossyBrick", true);
  263. enableDirtToGrass = readBoolean("Skills.Herbalism.Green_Thumb.Dirt_To_Grass", true);
  264. xpGainMultiplier = readInteger("Experience.Gains.Multiplier.Global", 1);
  265. toolsLoseDurabilityFromAbilities = readBoolean("Abilities.Tools.Durability_Loss_Enabled", true);
  266. abilityDurabilityLoss = readInteger("Abilities.Tools.Durability_Loss", 2);
  267. feathersConsumedByChimaeraWing = readInteger("Items.Chimaera_Wing.Feather_Cost", 10);
  268. chimaeraId = readInteger("Items.Chimaera_Wing.Item_ID", 288);
  269. chimaeraWingEnable = readBoolean("Items.Chimaera_Wing.Enabled", true);
  270. pvpxp = readBoolean("Experience.PVP.Rewards", true);
  271. pvpxprewardmodifier = readDouble("Experience.Gains.Multiplier.PVP", 1.0);
  272. miningrequirespickaxe = readBoolean("Skills.Mining.Requires_Pickaxe", true);
  273. excavationRequiresShovel = readBoolean("Skills.Excavation.Requires_Shovel", true);
  274. woodcuttingrequiresaxe = readBoolean("Skills.Woodcutting.Requires_Axe", true);
  275. repairdiamondlevel = readInteger("Skills.Repair.Diamond.Level_Required", 50);
  276. sorceryxpmodifier = readDouble("Experience.Formula.Multiplier.Sorcery", 1.0);
  277. tamingxpmodifier = readDouble("Experience.Formula.Multiplier.Taming", 1.0);
  278. miningxpmodifier = readDouble("Experience.Formula.Multiplier.Mining", 1.0);
  279. repairxpmodifier = readDouble("Experience.Formula.Multiplier.Repair", 1.0);
  280. woodcuttingxpmodifier = readDouble("Experience.Formula.Multiplier.Woodcutting", 1.0);
  281. unarmedxpmodifier = readDouble("Experience.Formula.Multiplier.Unarmed", 1.0);
  282. herbalismxpmodifier = readDouble("Experience.Formula.Multiplier.Herbalism", 1.0);
  283. excavationxpmodifier = readDouble("Experience.Formula.Multiplier.Excavation", 1.0);
  284. archeryxpmodifier = readDouble("Experience.Formula.Multiplier.Archery", 1.0);
  285. swordsxpmodifier = readDouble("Experience.Formula.Multiplier.Swords", 1.0);
  286. axesxpmodifier = readDouble("Experience.Formula.Multiplier.Axes", 1.0);
  287. acrobaticsxpmodifier = readDouble("Experience.Formula.Multiplier.Acrobatics", 1.0);
  288. anvilmessages = readBoolean("Skills.Repair.Anvil_Messages", true);
  289. anvilID = readInteger("Skills.Repair.Anvil_ID", 42);
  290. rGold = readInteger("Skills.Repair.Gold.ID", 266);
  291. nGold = readString("Skills.Repair.Gold.Name", "Gold Bars");
  292. rStone = readInteger("Skills.Repair.Stone.ID", 4);
  293. nStone = readString("Skills.Repair.Stone.Name", "Cobblestone");
  294. rWood = readInteger("Skills.Repair.Wood.ID", 5);
  295. nWood = readString("Skills.Repair.Wood.Name", "Wood Planks");
  296. rDiamond = readInteger("Skills.Repair.Diamond.ID", 264);
  297. nDiamond = readString("Skills.Repair.Diamond.Name", "Diamond");
  298. rIron = readInteger("Skills.Repair.Iron.ID", 265);
  299. nIron = readString("Skills.Repair.Iron.Name", "Iron Bars");
  300. rString = readInteger("Skills.Repair.String.ID", 287);
  301. nString = readString("Skills.Repair.String.Name", "String");
  302. rLeather = readInteger("Skills.Repair.Leather.ID", 334);
  303. nLeather = readString("Skills.Repair.Leather.Name", "Leather");
  304. levelCapAcrobatics = readInteger("Skills.Acrobatics.Level_Cap", 0);
  305. levelCapArchery = readInteger("Skills.Archery.Level_Cap", 0);
  306. levelCapAxes = readInteger("Skills.Axes.Level_Cap", 0);
  307. levelCapExcavation = readInteger("Skills.Excavation.Level_Cap", 0);
  308. levelCapFishing = readInteger("Skills.Fishing.Level_Cap", 0);
  309. levelCapHerbalism = readInteger("Skills.Herbalism.Level_Cap", 0);
  310. levelCapMining = readInteger("Skills.Mining.Level_Cap", 0);
  311. levelCapRepair = readInteger("Skills.Repair.Level_Cap", 0);
  312. levelCapSwords = readInteger("Skills.Swords.Level_Cap", 0);
  313. levelCapTaming = readInteger("Skills.Taming.Level_Cap", 0);
  314. levelCapUnarmed = readInteger("Skills.Unarmed.Level_Cap", 0);
  315. levelCapWoodcutting = readInteger("Skills.Woodcutting.Level_Cap", 0);
  316. mayDowngradeEnchants = readBoolean("Arcane_Forging.Downgrades.Enabled", true);
  317. downgradeRank1 = readInteger("Arcane_Forging.Downgrades.Chance.Rank_1", 75);
  318. downgradeRank2 = readInteger("Arcane_Forging.Downgrades.Chance.Rank_2", 50);
  319. downgradeRank3 = readInteger("Arcane_Forging.Downgrades.Chance.Rank_3", 25);
  320. downgradeRank4 = readInteger("Arcane_Forging.Downgrades.Chance.Rank_4", 15);
  321. mayLoseEnchants = readBoolean("Arcane_Forging.May_Lose_Enchants.Enabled", true);
  322. keepEnchantsRank1 = readInteger("Arcane_Forging.Keep_Enchants.Chance.Rank_1", 10);
  323. keepEnchantsRank2 = readInteger("Arcane_Forging.Keep_Enchants.Chance.Rank_2", 20);
  324. keepEnchantsRank3 = readInteger("Arcane_Forging.Keep_Enchants.Chance.Rank_3", 30);
  325. keepEnchantsRank4 = readInteger("Arcane_Forging.Keep_Enchants.Chance.Rank_4", 40);
  326. fishingDrops = readBoolean("Fishing.Drops.Item_Drops_Enabled", true);
  327. fishingDropChanceTier1 = readInteger("Fishing.Drops.Drop_Chance.Tier_1", 20);
  328. fishingDropChanceTier2 = readInteger("Fishing.Drops.Drop_Chance.Tier_2", 25);
  329. fishingDropChanceTier3 = readInteger("Fishing.Drops.Drop_Chance.Tier_3", 30);
  330. fishingDropChanceTier4 = readInteger("Fishing.Drops.Drop_Chance.Tier_4", 35);
  331. fishingDropChanceTier5 = readInteger("Fishing.Drops.Drop_Chance.Tier_5", 40);
  332. leatherArmor = readBoolean("Fishing.Drops.Leather_Armor", true);
  333. ironArmor = readBoolean("Fishing.Drops.Iron_Armor", true);
  334. goldArmor = readBoolean("Fishing.Drops.Gold_Armor", true);
  335. diamondArmor = readBoolean("Fishing.Drops.Diamond_Armor", true);
  336. woodenTools = readBoolean("Fishing.Drops.Wooden_Tools", true);
  337. stoneTools = readBoolean("Fishing.Drops.Stone_Tools", true);
  338. ironTools = readBoolean("Fishing.Drops.Iron_Tools", true);
  339. goldTools = readBoolean("Fishing.Drops.Gold_Tools", true);
  340. diamondTools = readBoolean("Fishing.Drops.Diamond_Tools", true);
  341. enderPearl = readBoolean("Fishing.Drops.Ender_Pearl", true);
  342. blazeRod = readBoolean("Fishing.Drops.Blaze_Rod", true);
  343. records = readBoolean("Fishing.Drops.Records", true);
  344. glowstoneDust = readBoolean("Fishing.Drops.Glowstone_Dust", true);
  345. fishingDiamonds = readBoolean("Fishing.Drops.Diamonds", true);
  346. xplockEnable = readBoolean("Commands.xplock.Enabled", true);
  347. xprateEnable = readBoolean("Commands.xprate.Enabled", true);
  348. mctopEnable = readBoolean("Commands.mctop.Enabled", true);
  349. addxpEnable = readBoolean("Commands.addxp.Enabled", true);
  350. mcabilityEnable = readBoolean("Commands.mcability.Enabled", true);
  351. mcrefreshEnable = readBoolean("Commands.mcrefresh.Enabled", true);
  352. mcmmoEnable = readBoolean("Commands.mcmmo.Enabled", true);
  353. mccEnable = readBoolean("Commands.mcc.Enabled", true);
  354. mcgodEnable = readBoolean("Commands.mcgod.Enabled", true);
  355. statsEnable = readBoolean("Commands.stats.Enabled", true);
  356. mmoeditEnable = readBoolean("Commands.mmoedit.Enabled", true);
  357. ptpEnable = readBoolean("Commands.ptp.Enabled", true);
  358. partyEnable = readBoolean("Commands.party.Enabled", true);
  359. myspawnEnable = readBoolean("Commands.myspawn.Enabled", true);
  360. whoisEnable = readBoolean("Commands.whois.Enabled", true);
  361. inviteEnable = readBoolean("Commands.invite.Enabled", true);
  362. acceptEnable = readBoolean("Commands.accept.Enabled", true);
  363. clearmyspawnEnable = readBoolean("Commands.clearmyspawn.Enabled", true);
  364. aEnable = readBoolean("Commands.a.Enabled", true);
  365. pEnable = readBoolean("Commands.p.Enabled", true);
  366. aDisplayNames = readBoolean("Commands.a.Display_Names", true);
  367. pDisplayNames = readBoolean("Commands.p.Display_Names", true);
  368. // Load treasures
  369. Map<String, Treasure> treasures = new HashMap<String, Treasure>();
  370. ConfigurationSection treasureSection = config.getConfigurationSection("Treasures");
  371. Set<String> treasureConfigSet = treasureSection.getKeys(false);
  372. Iterator<String> iterator = treasureConfigSet.iterator();
  373. while(iterator.hasNext())
  374. {
  375. String treasureName = iterator.next();
  376. int id = config.getInt("Treasures." + treasureName + ".ID");
  377. int amount = config.getInt("Treasures." + treasureName + ".Amount");
  378. int data = config.getInt("Treasures." + treasureName + ".Data");
  379. int xp = config.getInt("Treasures." + treasureName + ".XP");
  380. Double dropChance = config.getDouble("Treasures." + treasureName + ".Drop_Chance");
  381. int dropLevel = config.getInt("Treasures." + treasureName + ".Drop_Level");
  382. ItemStack item = new ItemStack(id, amount, (byte) 0, (byte) data);
  383. if(readBoolean("Treasures." + treasureName + ".Drops_From.Fishing", false)) {
  384. int maxLevel = config.getInt("Treasures." + treasureName + ".Max_Levels");
  385. FishingTreasure fTreasure = new FishingTreasure(item, xp, dropChance, dropLevel, maxLevel);
  386. treasures.put(treasureName, fTreasure);
  387. } else {
  388. ExcavationTreasure eTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel);
  389. if(readBoolean("Treasures." + treasureName + ".Drops_From.Dirt", false))
  390. eTreasure.setDropsFromDirt();
  391. if(readBoolean("Treasures." + treasureName + ".Drops_From.Grass", false))
  392. eTreasure.setDropsFromGrass();
  393. if(readBoolean("Treasures." + treasureName + ".Drops_From.Sand", false))
  394. eTreasure.setDropsFromSand();
  395. if(readBoolean("Treasures." + treasureName + ".Drops_From.Gravel", false))
  396. eTreasure.setDropsFromGravel();
  397. if(readBoolean("Treasures." + treasureName + ".Drops_From.Clay", false))
  398. eTreasure.setDropsFromClay();
  399. if(readBoolean("Treasures." + treasureName + ".Drops_From.Mycelium", false))
  400. eTreasure.setDropsFromMycel();
  401. if(readBoolean("Treasures." + treasureName + ".Drops_From.Soul_Sand", false))
  402. eTreasure.setDropsFromSoulSand();
  403. treasures.put(treasureName, eTreasure);
  404. }
  405. }
  406. List<String> excavationTreasures = config.getStringList("Excavation.Treasure");
  407. List<String> fishingTreasures = config.getStringList("Excavation.Treasure");
  408. Iterator<String> treasureIterator = treasures.keySet().iterator();
  409. while(treasureIterator.hasNext()) {
  410. String treasureKey = treasureIterator.next();
  411. Treasure treasure = treasures.get(treasureKey);
  412. if(treasure instanceof FishingTreasure) {
  413. if(!fishingTreasures.contains(treasureKey)) continue;
  414. FishingTreasure fTreasure = (FishingTreasure) treasure;
  415. fishingRewards.add(fTreasure);
  416. } else if(treasure instanceof ExcavationTreasure) {
  417. if(!excavationTreasures.contains(treasureKey)) continue;
  418. ExcavationTreasure eTreasure = (ExcavationTreasure) treasure;
  419. if(eTreasure.getDropsFromDirt())
  420. excavationFromDirt.add(eTreasure);
  421. if(eTreasure.getDropsFromGrass())
  422. excavationFromGrass.add(eTreasure);
  423. if(eTreasure.getDropsFromSand())
  424. excavationFromSand.add(eTreasure);
  425. if(eTreasure.getDropsFromGravel())
  426. excavationFromGravel.add(eTreasure);
  427. if(eTreasure.getDropsFromClay())
  428. excavationFromClay.add(eTreasure);
  429. if(eTreasure.getDropsFromMycel())
  430. excavationFromMycel.add(eTreasure);
  431. if(eTreasure.getDropsFromSoulSand())
  432. excavationFromSoulSand.add(eTreasure);
  433. }
  434. }
  435. }
  436. }