Config.java 34 KB

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