Config.java 30 KB

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