Config.java 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. package com.gmail.nossr50.config;
  2. import java.util.ArrayList;
  3. import java.util.List;
  4. import java.util.Set;
  5. import org.bukkit.Material;
  6. import org.bukkit.TreeSpecies;
  7. import org.bukkit.configuration.ConfigurationSection;
  8. import org.bukkit.entity.EntityType;
  9. import com.gmail.nossr50.datatypes.MobHealthbarType;
  10. import com.gmail.nossr50.datatypes.party.PartyFeature;
  11. import com.gmail.nossr50.datatypes.skills.AbilityType;
  12. import com.gmail.nossr50.datatypes.skills.SkillType;
  13. import com.gmail.nossr50.util.StringUtils;
  14. public class Config extends AutoUpdateConfigLoader {
  15. private static Config instance;
  16. private Config() {
  17. super("config.yml");
  18. validate();
  19. }
  20. public static Config getInstance() {
  21. if (instance == null) {
  22. instance = new Config();
  23. }
  24. return instance;
  25. }
  26. @Override
  27. protected boolean validateKeys() {
  28. // Validate all the settings!
  29. List<String> reason = new ArrayList<String>();
  30. /* General Settings */
  31. if (getSaveInterval() <= 0) {
  32. reason.add("General.Save_Interval should be greater than 0!");
  33. }
  34. /* Mob Healthbar */
  35. if (getMobHealthbarTime() == 0) {
  36. reason.add("Mob_Healthbar.Display_Time cannot be 0! Set to -1 to disable or set a valid value.");
  37. }
  38. /* Scoreboards */
  39. if (getRankScoreboardTime() != -1 && getRankScoreboardTime() <= 0) {
  40. reason.add("Scoreboard.Types.Rank.Display_Time should be greater than 0, or -1!");
  41. }
  42. if (getStatsScoreboardTime() != -1 && getStatsScoreboardTime() <= 0) {
  43. reason.add("Scoreboard.Types.Stats.Display_Time should be greater than 0, or -1!");
  44. }
  45. if (getTopScoreboardTime() != -1 && getTopScoreboardTime() <= 0) {
  46. reason.add("Scoreboard.Types.Top.Display_Time should be greater than 0, or -1!");
  47. }
  48. if (getInspectScoreboardTime() != -1 && getInspectScoreboardTime() <= 0) {
  49. reason.add("Scoreboard.Types.Inspect.Display_Time should be greater than 0, or -1!");
  50. }
  51. if (getSkillScoreboardTime() != -1 && getSkillScoreboardTime() <= 0) {
  52. reason.add("Scoreboard.Types.Skill.Display_Time should be greater than 0, or -1!");
  53. }
  54. if (getSkillLevelUpTime() != -1 && getSkillScoreboardTime() <= 0) {
  55. reason.add("Scoreboard.Types.Skill.Display_Time should be greater than 0, or -1!");
  56. }
  57. if (!(getRankUseChat() || getRankUseBoard())) {
  58. reason.add("Either Board or Print in Scoreboard.Types.Rank must be true!");
  59. }
  60. if (!(getTopUseChat() || getTopUseBoard())) {
  61. reason.add("Either Board or Print in Scoreboard.Types.Top must be true!");
  62. }
  63. if (!(getStatsUseChat() || getStatsUseBoard())) {
  64. reason.add("Either Board or Print in Scoreboard.Types.Stats must be true!");
  65. }
  66. if (!(getInspectUseChat() || getInspectUseBoard())) {
  67. reason.add("Either Board or Print in Scoreboard.Types.Inspect must be true!");
  68. }
  69. /* Database Purging */
  70. if (getPurgeInterval() < -1) {
  71. reason.add("Database_Purging.Purge_Interval should be greater than, or equal to -1!");
  72. }
  73. if (getOldUsersCutoff() != -1 && getOldUsersCutoff() <= 0) {
  74. reason.add("Database_Purging.Old_User_Cutoff should be greater than 0 or -1!");
  75. }
  76. /* Hardcore Mode */
  77. if (getHardcoreDeathStatPenaltyPercentage() < 0.01 || getHardcoreDeathStatPenaltyPercentage() > 100) {
  78. reason.add("Hardcore.Death_Stat_Loss.Penalty_Percentage only accepts values from 0.01 to 100!");
  79. }
  80. if (getHardcoreVampirismStatLeechPercentage() < 0.01 || getHardcoreVampirismStatLeechPercentage() > 100) {
  81. reason.add("Hardcore.Vampirism.Leech_Percentage only accepts values from 0.01 to 100!");
  82. }
  83. /* Items */
  84. if (getChimaeraUseCost() < 1 || getChimaeraUseCost() > 64) {
  85. reason.add("Items.Chimaera_Wing.Use_Cost only accepts values from 1 to 64!");
  86. }
  87. if (getChimaeraRecipeCost() < 1 || getChimaeraRecipeCost() > 9) {
  88. reason.add("Items.Chimaera_Wing.Recipe_Cost only accepts values from 1 to 9!");
  89. }
  90. if (getChimaeraItem() == null) {
  91. reason.add("Items.Chimaera_Wing.Item_Name is invalid!");
  92. }
  93. /* Particles */
  94. if (getLevelUpEffectsTier() < 1) {
  95. reason.add("Particles.LevelUp_Tier should be at least 1!");
  96. }
  97. /* PARTY SETTINGS */
  98. if (getAutoPartyKickInterval() < -1) {
  99. reason.add("Party.AutoKick_Interval should be at least -1!");
  100. }
  101. if (getAutoPartyKickTime() < 0) {
  102. reason.add("Party.Old_Party_Member_Cutoff should be at least 0!");
  103. }
  104. if (getPartyShareBonusBase() <= 0) {
  105. reason.add("Party.Sharing.ExpShare_bonus_base should be greater than 0!");
  106. }
  107. if (getPartyShareBonusIncrease() < 0) {
  108. reason.add("Party.Sharing.ExpShare_bonus_increase should be at least 0!");
  109. }
  110. if (getPartyShareBonusCap() <= 0) {
  111. reason.add("Party.Sharing.ExpShare_bonus_cap should be greater than 0!");
  112. }
  113. if (getPartyShareRange() <= 0) {
  114. reason.add("Party.Sharing.Range should be greater than 0!");
  115. }
  116. if (getPartyXpCurveMultiplier() < 1) {
  117. reason.add("Party.Leveling.Xp_Curve_Modifier should be at least 1!");
  118. }
  119. for (PartyFeature partyFeature : PartyFeature.values()) {
  120. if (getPartyFeatureUnlockLevel(partyFeature) < 0) {
  121. reason.add("Party.Leveling." + StringUtils.getPrettyPartyFeatureString(partyFeature).replace(" ", "") + "_UnlockLevel should be at least 0!");
  122. }
  123. }
  124. /* Inspect command distance */
  125. if (getInspectDistance() <= 0) {
  126. reason.add("Commands.inspect.Max_Distance should be greater than 0!");
  127. }
  128. if (getTreeFellerThreshold() <= 0) {
  129. reason.add("Abilities.Limits.Tree_Feller_Threshold should be greater than 0!");
  130. }
  131. if (getDetonatorItem() == null) {
  132. reason.add("Skills.Mining.Detonator_Item is invalid!");
  133. }
  134. if (getRepairAnvilMaterial() == null) {
  135. reason.add("Skills.Repair.Anvil_Type is invalid!!");
  136. }
  137. if (getSalvageAnvilMaterial() == null) {
  138. reason.add("Skills.Repair.Salvage_Anvil_Type is invalid!");
  139. }
  140. if (getRepairAnvilMaterial() == getSalvageAnvilMaterial()) {
  141. reason.add("Cannot use the same item for Repair and Salvage anvils!");
  142. }
  143. if (getTamingCOTWMaterial(EntityType.WOLF) == null) {
  144. reason.add("Skills.Taming.Call_Of_The_Wild.Wolf.Item_Material is invalid!!");
  145. }
  146. if (getTamingCOTWMaterial(EntityType.OCELOT) == null) {
  147. reason.add("Skills.Taming.Call_Of_The_Wild.Ocelot.Item_Material is invalid!!");
  148. }
  149. if (getTamingCOTWMaterial(EntityType.HORSE) == null) {
  150. reason.add("Skills.Taming.Call_Of_The_Wild.Horse.Item_Material is invalid!!");
  151. }
  152. if (getTamingCOTWCost(EntityType.WOLF) <= 0) {
  153. reason.add("Skills.Taming.Call_Of_The_Wild.Wolf.Item_Amount should be greater than 0!");
  154. }
  155. if (getTamingCOTWCost(EntityType.OCELOT) <= 0) {
  156. reason.add("Skills.Taming.Call_Of_The_Wild.Ocelot.Item_Amount should be greater than 0!");
  157. }
  158. if (getTamingCOTWCost(EntityType.HORSE) <= 0) {
  159. reason.add("Skills.Taming.Call_Of_The_Wild.Horse.Item_Amount should be greater than 0!");
  160. }
  161. if (getTamingCOTWAmount(EntityType.WOLF) <= 0) {
  162. reason.add("Skills.Taming.Call_Of_The_Wild.Wolf.Summon_Amount should be greater than 0!");
  163. }
  164. if (getTamingCOTWAmount(EntityType.OCELOT) <= 0) {
  165. reason.add("Skills.Taming.Call_Of_The_Wild.Ocelot.Summon_Amount should be greater than 0!");
  166. }
  167. if (getTamingCOTWAmount(EntityType.HORSE) <= 0) {
  168. reason.add("Skills.Taming.Call_Of_The_Wild.Horse.Summon_Amount should be greater than 0!");
  169. }
  170. return noErrorsInConfig(reason);
  171. }
  172. @Override
  173. protected void loadKeys() {}
  174. /*
  175. * GENERAL SETTINGS
  176. */
  177. /* General Settings */
  178. public String getLocale() { return config.getString("General.Locale", "en_us"); }
  179. public boolean getMOTDEnabled() { return config.getBoolean("General.MOTD_Enabled", true); }
  180. public boolean getDonateMessageEnabled() { return config.getBoolean("Commands.mcmmo.Donate_Message", true); }
  181. public int getSaveInterval() { return config.getInt("General.Save_Interval", 10); }
  182. public boolean getStatsTrackingEnabled() { return config.getBoolean("General.Stats_Tracking", true); }
  183. public boolean getUpdateCheckEnabled() { return config.getBoolean("General.Update_Check", true); }
  184. public boolean getPreferBeta() { return config.getBoolean("General.Prefer_Beta", false); }
  185. public boolean getEventCallbackEnabled() { return config.getBoolean("General.Event_Callback", true); }
  186. public boolean getVerboseLoggingEnabled() { return config.getBoolean("General.Verbose_Logging", false); }
  187. public String getPartyChatPrefix() { return config.getString("Commands.partychat.Chat_Prefix_Format", "[[GREEN]]([[WHITE]]{0}[[GREEN]])"); }
  188. public boolean getPartyChatColorLeaderName() { return config.getBoolean("Commands.partychat.Gold_Leader_Name", true); }
  189. public boolean getPartyDisplayNames() { return config.getBoolean("Commands.partychat.Use_Display_Names", true); }
  190. public String getPartyChatPrefixAlly() { return config.getString("Commands.partychat.Chat_Prefix_Format_Ally", "[[GREEN]](A)[[RESET]]"); }
  191. public String getAdminChatPrefix() { return config.getString("Commands.adminchat.Chat_Prefix_Format", "[[AQUA]][[[WHITE]]{0}[[AQUA]]]"); }
  192. public boolean getAdminDisplayNames() { return config.getBoolean("Commands.adminchat.Use_Display_Names", true); }
  193. public boolean getMatchOfflinePlayers() { return config.getBoolean("Commands.Generic.Match_OfflinePlayers", false); }
  194. public long getDatabasePlayerCooldown() { return config.getLong("Commands.Database.Player_Cooldown", 1750); }
  195. public boolean getLevelUpSoundsEnabled() { return config.getBoolean("General.LevelUp_Sounds", true); }
  196. /* Mob Healthbar */
  197. public MobHealthbarType getMobHealthbarDefault() {
  198. try {
  199. return MobHealthbarType.valueOf(config.getString("Mob_Healthbar.Display_Type", "HEARTS").toUpperCase().trim());
  200. }
  201. catch (IllegalArgumentException ex) {
  202. return MobHealthbarType.HEARTS;
  203. }
  204. }
  205. public int getMobHealthbarTime() { return config.getInt("Mob_Healthbar.Display_Time", 3); }
  206. /* Scoreboards */
  207. public boolean getRankUseChat() { return config.getBoolean("Scoreboard.Types.Rank.Print", false); }
  208. public boolean getRankUseBoard() { return config.getBoolean("Scoreboard.Types.Rank.Board", true); }
  209. public int getRankScoreboardTime() { return config.getInt("Scoreboard.Types.Rank.Display_Time", 10); }
  210. public boolean getTopUseChat() { return config.getBoolean("Scoreboard.Types.Top.Print", true); }
  211. public boolean getTopUseBoard() { return config.getBoolean("Scoreboard.Types.Top.Board", true); }
  212. public int getTopScoreboardTime() { return config.getInt("Scoreboard.Types.Top.Display_Time", 15); }
  213. public boolean getStatsUseChat() { return config.getBoolean("Scoreboard.Types.Stats.Print", true); }
  214. public boolean getStatsUseBoard() { return config.getBoolean("Scoreboard.Types.Stats.Board", true); }
  215. public int getStatsScoreboardTime() { return config.getInt("Scoreboard.Types.Stats.Display_Time", 10); }
  216. public boolean getInspectUseChat() { return config.getBoolean("Scoreboard.Types.Inspect.Print", true); }
  217. public boolean getInspectUseBoard() { return config.getBoolean("Scoreboard.Types.Inspect.Board", true); }
  218. public int getInspectScoreboardTime() { return config.getInt("Scoreboard.Types.Inspect.Display_Time", 25); }
  219. public boolean getCooldownUseChat() { return config.getBoolean("Scoreboard.Types.Cooldown.Print", false); }
  220. public boolean getCooldownUseBoard() { return config.getBoolean("Scoreboard.Types.Cooldown.Board", true); }
  221. public int getCooldownScoreboardTime() { return config.getInt("Scoreboard.Types.Cooldown.Display_Time", 41); }
  222. public boolean getSkillUseBoard() { return config.getBoolean("Scoreboard.Types.Skill.Board", true); }
  223. public int getSkillScoreboardTime() { return config.getInt("Scoreboard.Types.Skill.Display_Time", 30); }
  224. public boolean getSkillLevelUpBoard() { return config.getBoolean("Scoreboard.Types.Skill.LevelUp_Board", true); }
  225. public int getSkillLevelUpTime() { return config.getInt("Scoreboard.Types.Skill.LevelUp_Time", 5); }
  226. public boolean getPowerLevelTagsEnabled() { return config.getBoolean("Scoreboard.Power_Level_Tags", false); }
  227. public boolean getAllowKeepBoard() { return config.getBoolean("Scoreboard.Allow_Keep", true); }
  228. public boolean getScoreboardRainbows() { return config.getBoolean("Scoreboard.Rainbows", false); }
  229. /* Database Purging */
  230. public int getPurgeInterval() { return config.getInt("Database_Purging.Purge_Interval", -1); }
  231. public int getOldUsersCutoff() { return config.getInt("Database_Purging.Old_User_Cutoff", 6); }
  232. /* Backups */
  233. public boolean getBackupsEnabled() { return config.getBoolean("Backups.Enabled", true); }
  234. public boolean getKeepLast24Hours() { return config.getBoolean("Backups.Keep.Last_24_Hours", true); }
  235. public boolean getKeepDailyLastWeek() { return config.getBoolean("Backups.Keep.Daily_Last_Week", true); }
  236. public boolean getKeepWeeklyPastMonth() { return config.getBoolean("Backups.Keep.Weekly_Past_Months", true); }
  237. /* mySQL */
  238. public boolean getUseMySQL() { return config.getBoolean("MySQL.Enabled", false); }
  239. public String getMySQLTablePrefix() { return config.getString("MySQL.Database.TablePrefix", "mcmmo_"); }
  240. public String getMySQLDatabaseName() { return getStringIncludingInts("MySQL.Database.Name"); }
  241. public String getMySQLUserName() { return getStringIncludingInts("MySQL.Database.User_Name"); }
  242. public int getMySQLServerPort() { return config.getInt("MySQL.Server.Port", 3306); }
  243. public String getMySQLServerName() { return config.getString("MySQL.Server.Address", "localhost"); }
  244. public String getMySQLUserPassword() { return getStringIncludingInts("MySQL.Database.User_Password"); }
  245. private String getStringIncludingInts(String key) {
  246. String str = config.getString(key);
  247. if (str == null) {
  248. str = String.valueOf(config.getInt(key));
  249. }
  250. if (str.equals("0")) {
  251. str = "No value set for '" + key + "'";
  252. }
  253. return str;
  254. }
  255. /* Hardcore Mode */
  256. public boolean getHardcoreStatLossEnabled(SkillType skillType) { return config.getBoolean("Hardcore.Death_Stat_Loss.Enabled." + StringUtils.getCapitalized(skillType.toString()), false); }
  257. public void setHardcoreStatLossEnabled(SkillType skillType, boolean enabled) { config.set("Hardcore.Death_Stat_Loss.Enabled." + StringUtils.getCapitalized(skillType.toString()), enabled); }
  258. public double getHardcoreDeathStatPenaltyPercentage() { return config.getDouble("Hardcore.Death_Stat_Loss.Penalty_Percentage", 75.0D); }
  259. public void setHardcoreDeathStatPenaltyPercentage(double value) { config.set("Hardcore.Death_Stat_Loss.Penalty_Percentage", value); }
  260. public int getHardcoreDeathStatPenaltyLevelThreshold() { return config.getInt("Hardcore.Death_Stat_Loss.Level_Threshold", 0); }
  261. public boolean getHardcoreVampirismEnabled(SkillType skillType) { return config.getBoolean("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(skillType.toString()), false); }
  262. public void setHardcoreVampirismEnabled(SkillType skillType, boolean enabled) { config.set("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(skillType.toString()), enabled); }
  263. public double getHardcoreVampirismStatLeechPercentage() { return config.getDouble("Hardcore.Vampirism.Leech_Percentage", 5.0D); }
  264. public void setHardcoreVampirismStatLeechPercentage(double value) { config.set("Hardcore.Vampirism.Leech_Percentage", value); }
  265. public int getHardcoreVampirismLevelThreshold() { return config.getInt("Hardcore.Vampirism.Level_Threshold", 0); }
  266. /* SMP Mods */
  267. public boolean getToolModsEnabled() { return config.getBoolean("Mods.Tool_Mods_Enabled", false); }
  268. public boolean getArmorModsEnabled() { return config.getBoolean("Mods.Armor_Mods_Enabled", false); }
  269. public boolean getBlockModsEnabled() { return config.getBoolean("Mods.Block_Mods_Enabled", false); }
  270. public boolean getEntityModsEnabled() { return config.getBoolean("Mods.Entity_Mods_Enabled", false); }
  271. /* Items */
  272. public int getChimaeraUseCost() { return config.getInt("Items.Chimaera_Wing.Use_Cost", 1); }
  273. public int getChimaeraRecipeCost() { return config.getInt("Items.Chimaera_Wing.Recipe_Cost", 5); }
  274. public Material getChimaeraItem() { return Material.matchMaterial(config.getString("Items.Chimaera_Wing.Item_Name", "Feather")); }
  275. public boolean getChimaeraEnabled() { return config.getBoolean("Items.Chimaera_Wing.Enabled", true); }
  276. public boolean getChimaeraPreventUseUnderground() { return config.getBoolean("Items.Chimaera_Wing.Prevent_Use_Underground", true); }
  277. public int getChimaeraCooldown() { return config.getInt("Items.Chimaera_Wing.Cooldown", 240); }
  278. public int getChimaeraWarmup() { return config.getInt("Items.Chimaera_Wing.Warmup", 5); }
  279. public int getChimaeraRecentlyHurtCooldown() { return config.getInt("Items.Chimaera_Wing.RecentlyHurt_Cooldown", 60); }
  280. public boolean getChimaeraSoundEnabled() { return config.getBoolean("Items.Chimaera_Wing.Sound_Enabled", true); }
  281. /* Particles */
  282. public boolean getAbilityActivationEffectEnabled() { return config.getBoolean("Particles.Ability_Activation", true); }
  283. public boolean getAbilityDeactivationEffectEnabled() { return config.getBoolean("Particles.Ability_Deactivation", true); }
  284. public boolean getDodgeEffectEnabled() { return config.getBoolean("Particles.Dodge", true); }
  285. public boolean getBleedEffectEnabled() { return config.getBoolean("Particles.Bleed", true); }
  286. public boolean getGreaterImpactEffectEnabled() { return config.getBoolean("Particles.Greater_Impact", true); }
  287. public boolean getLevelUpEffectsEnabled() { return config.getBoolean("Particles.LevelUp_Enabled", true); }
  288. public int getLevelUpEffectsTier() { return config.getInt("Particles.LevelUp_Tier", 100); }
  289. public boolean getLargeFireworks() { return config.getBoolean("Particles.LargeFireworks", true); }
  290. /* PARTY SETTINGS */
  291. public int getAutoPartyKickInterval() { return config.getInt("Party.AutoKick_Interval", 12); }
  292. public int getAutoPartyKickTime() { return config.getInt("Party.Old_Party_Member_Cutoff", 7); }
  293. public double getPartyShareBonusBase() { return config.getDouble("Party.Sharing.ExpShare_bonus_base", 1.1D); }
  294. public double getPartyShareBonusIncrease() { return config.getDouble("Party.Sharing.ExpShare_bonus_increase", 0.05D); }
  295. public double getPartyShareBonusCap() { return config.getDouble("Party.Sharing.ExpShare_bonus_cap", 1.5D); }
  296. public double getPartyShareRange() { return config.getDouble("Party.Sharing.Range", 75.0D); }
  297. public int getPartyLevelCap() {
  298. int cap = config.getInt("Party.Leveling.Level_Cap", 10);
  299. return (cap <= 0) ? Integer.MAX_VALUE : cap;
  300. }
  301. public int getPartyXpCurveMultiplier() { return config.getInt("Party.Leveling.Xp_Curve_Modifier", 3); }
  302. public boolean getPartyXpNearMembersNeeded() { return config.getBoolean("Party.Leveling.Near_Members_Needed", false); }
  303. public boolean getPartyInformAllMembers() { return config.getBoolean("Party.Leveling.Inform_All_Party_Members_On_LevelUp", false); }
  304. public int getPartyFeatureUnlockLevel(PartyFeature partyFeature) { return config.getInt("Party.Leveling." + StringUtils.getPrettyPartyFeatureString(partyFeature).replace(" ", "") + "_UnlockLevel", 0); }
  305. /* Party Teleport Settings */
  306. public int getPTPCommandCooldown() { return config.getInt("Commands.ptp.Cooldown", 120); }
  307. public int getPTPCommandWarmup() { return config.getInt("Commands.ptp.Warmup", 5); }
  308. public int getPTPCommandRecentlyHurtCooldown() { return config.getInt("Commands.ptp.RecentlyHurt_Cooldown", 60); }
  309. public int getPTPCommandTimeout() { return config.getInt("Commands.ptp.Request_Timeout", 300); }
  310. public boolean getPTPCommandConfirmRequired() { return config.getBoolean("Commands.ptp.Accept_Required", true); }
  311. public boolean getPTPCommandWorldPermissions() { return config.getBoolean("Commands.ptp.World_Based_Permissions", false); }
  312. /* Inspect command distance */
  313. public double getInspectDistance() { return config.getDouble("Commands.inspect.Max_Distance", 30.0D); }
  314. /*
  315. * ABILITY SETTINGS
  316. */
  317. /* General Settings */
  318. public boolean getAbilityMessagesEnabled() { return config.getBoolean("Abilities.Messages", true); }
  319. public boolean getAbilitiesEnabled() { return config.getBoolean("Abilities.Enabled", true); }
  320. public boolean getAbilitiesOnlyActivateWhenSneaking() { return config.getBoolean("Abilities.Activation.Only_Activate_When_Sneaking", false); }
  321. public int getCooldown(AbilityType ability) { return config.getInt("Abilities.Cooldowns." + ability.toString()); }
  322. public int getMaxLength(AbilityType ability) { return config.getInt("Abilities.Max_Seconds." + ability.toString()); }
  323. /* Durability Settings */
  324. public int getAbilityToolDamage() { return config.getInt("Abilities.Tools.Durability_Loss", 1); }
  325. /* Thresholds */
  326. public int getTreeFellerThreshold() { return config.getInt("Abilities.Limits.Tree_Feller_Threshold", 500); }
  327. /*
  328. * SKILL SETTINGS
  329. */
  330. public boolean getDoubleDropsEnabled(SkillType skill, Material material) { return config.getBoolean("Double_Drops." + StringUtils.getCapitalized(skill.toString()) + "." + StringUtils.getPrettyItemString(material).replace(" ", "_")); }
  331. public boolean getDoubleDropsDisabled(SkillType skill) {
  332. String skillName = StringUtils.getCapitalized(skill.toString());
  333. ConfigurationSection section = config.getConfigurationSection("Double_Drops." + skillName);
  334. Set<String> keys = section.getKeys(false);
  335. boolean disabled = true;
  336. for (String key : keys) {
  337. if (config.getBoolean("Double_Drops." + skillName + "." + key)) {
  338. disabled = false;
  339. break;
  340. }
  341. }
  342. return disabled;
  343. }
  344. /* Acrobatics */
  345. public boolean getDodgeLightningDisabled() { return config.getBoolean("Skills.Acrobatics.Prevent_Dodge_Lightning", false); }
  346. public int getXPAfterTeleportCooldown() { return config.getInt("Skills.Acrobatics.XP_After_Teleport_Cooldown", 5); }
  347. /* Alchemy */
  348. public boolean getEnabledForHoppers() { return config.getBoolean("Skills.Alchemy.Enabled_for_Hoppers", true); }
  349. public boolean getPreventHopperTransfer() { return config.getBoolean("Skills.Alchemy.Prevent_Hopper_Transfer", false); }
  350. /* Fishing */
  351. public boolean getFishingDropsEnabled() { return config.getBoolean("Skills.Fishing.Drops_Enabled", true); }
  352. /* Mining */
  353. public Material getDetonatorItem() { return Material.matchMaterial(config.getString("Skills.Mining.Detonator_Name", "FLINT_AND_STEEL")); }
  354. /* Repair */
  355. public boolean getRepairAnvilMessagesEnabled() { return config.getBoolean("Skills.Repair.Anvil_Messages", true); }
  356. public boolean getRepairAnvilPlaceSoundsEnabled() { return config.getBoolean("Skills.Repair.Anvil_Placed_Sounds", true); }
  357. public boolean getRepairAnvilUseSoundsEnabled() { return config.getBoolean("Skills.Repair.Anvil_Use_Sounds", true); }
  358. public Material getRepairAnvilMaterial() { return Material.matchMaterial(config.getString("Skills.Repair.Anvil_Material", "IRON_BLOCK")); }
  359. public Material getSalvageAnvilMaterial() { return Material.matchMaterial(config.getString("Skills.Repair.Salvage_Anvil_Material", "GOLD_BLOCK")); }
  360. public boolean getSalvageTools() { return config.getBoolean("Skills.Repair.Salvage_tools", true); }
  361. public boolean getSalvageArmor() { return config.getBoolean("Skills.Repair.Salvage_armor", true); }
  362. public boolean getRepairConfirmRequired() { return config.getBoolean("Skills.Repair.Confirm_Required", true); }
  363. /* Unarmed */
  364. public boolean getUnarmedBlockCrackerSmoothbrickToCracked() { return config.getBoolean("Skills.Unarmed.Block_Cracker.SmoothBrick_To_CrackedBrick", true); }
  365. /* Taming */
  366. public Material getTamingCOTWMaterial(EntityType type) { return Material.matchMaterial(config.getString("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Item_Material")); }
  367. public int getTamingCOTWCost(EntityType type) { return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Item_Amount"); }
  368. public int getTamingCOTWAmount(EntityType type) { return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Summon_Amount"); }
  369. public double getTamingCOTWRange() { return config.getDouble("Skills.Taming.Call_Of_The_Wild.Range", 40.0D); }
  370. /* Woodcutting */
  371. public boolean getWoodcuttingDoubleDropsEnabled(TreeSpecies species) { return config.getBoolean("Double_Drops.Woodcutting." + StringUtils.getPrettyTreeSpeciesString(species).replace(" ", "_")); }
  372. public boolean getTreeFellerSoundsEnabled() { return config.getBoolean("Skills.Woodcutting.Tree_Feller_Sounds", true); }
  373. /* AFK Leveling */
  374. public boolean getAcrobaticsPreventAFK() { return config.getBoolean("Skills.Acrobatics.Prevent_AFK_Leveling", true); }
  375. public int getAcrobaticsAFKMaxTries() { return config.getInt("Skills.Acrobatics.Max_Tries_At_Same_Location", 3); }
  376. public boolean getHerbalismPreventAFK() { return config.getBoolean("Skills.Herbalism.Prevent_AFK_Leveling", true); }
  377. /* Level Caps */
  378. public int getPowerLevelCap() {
  379. int cap = config.getInt("General.Power_Level_Cap", 0);
  380. return (cap <= 0) ? Integer.MAX_VALUE : cap;
  381. }
  382. public int getLevelCap(SkillType skill) {
  383. int cap = config.getInt("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Level_Cap");
  384. return (cap <= 0) ? Integer.MAX_VALUE : cap;
  385. }
  386. /* PVP & PVE Settings */
  387. public boolean getPVPEnabled(SkillType skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVP", true); }
  388. public boolean getPVEEnabled(SkillType skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVE", true); }
  389. }