GeneralConfig.java 32 KB

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