GeneralConfig.java 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010
  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 BukkitConfig {
  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() {
  128. return config.getBoolean("Metrics.bstats", true);
  129. }
  130. //Retro mode will default the value to true if the config file doesn't contain the entry (server is from a previous mcMMO install)
  131. public boolean getIsRetroMode() {
  132. return config.getBoolean("General.RetroMode.Enabled", true);
  133. }
  134. public String getLocale() {
  135. return config.getString("General.Locale", "en_US");
  136. }
  137. public boolean getMOTDEnabled() {
  138. return config.getBoolean("General.MOTD_Enabled", true);
  139. }
  140. public boolean getShowProfileLoadedMessage() {
  141. return config.getBoolean("General.Show_Profile_Loaded", true);
  142. }
  143. public boolean getDonateMessageEnabled() {
  144. return config.getBoolean("Commands.mcmmo.Donate_Message", true);
  145. }
  146. public int getSaveInterval() {
  147. return config.getInt("General.Save_Interval", 10);
  148. }
  149. public boolean getStatsTrackingEnabled() {
  150. return config.getBoolean("General.Stats_Tracking", true);
  151. }
  152. public boolean getUpdateCheckEnabled() {
  153. return config.getBoolean("General.Update_Check", true);
  154. }
  155. public boolean getPreferBeta() {
  156. return config.getBoolean("General.Prefer_Beta", false);
  157. }
  158. public boolean getVerboseLoggingEnabled() {
  159. return config.getBoolean("General.Verbose_Logging", false);
  160. }
  161. public boolean getMatchOfflinePlayers() {
  162. return config.getBoolean("Commands.Generic.Match_OfflinePlayers", false);
  163. }
  164. public long getDatabasePlayerCooldown() {
  165. return config.getLong("Commands.Database.Player_Cooldown", 1750);
  166. }
  167. public boolean getLevelUpSoundsEnabled() {
  168. return config.getBoolean("General.LevelUp_Sounds", true);
  169. }
  170. public boolean getRefreshChunksEnabled() {
  171. return config.getBoolean("General.Refresh_Chunks", false);
  172. }
  173. public boolean getMobHealthbarEnabled() {
  174. return config.getBoolean("Mob_Healthbar.Enabled", true);
  175. }
  176. /* Mob Healthbar */
  177. public MobHealthbarType getMobHealthbarDefault() {
  178. try {
  179. return MobHealthbarType.valueOf(config.getString("Mob_Healthbar.Display_Type", "HEARTS").toUpperCase(Locale.ENGLISH).trim());
  180. } catch (IllegalArgumentException ex) {
  181. return MobHealthbarType.HEARTS;
  182. }
  183. }
  184. public int getMobHealthbarTime() {
  185. return Math.max(1, config.getInt("Mob_Healthbar.Display_Time", 3));
  186. }
  187. /* Scoreboards */
  188. public boolean getScoreboardsEnabled() {
  189. return config.getBoolean("Scoreboard.UseScoreboards", true);
  190. }
  191. public boolean getPowerLevelTagsEnabled() {
  192. return config.getBoolean("Scoreboard.Power_Level_Tags", false);
  193. }
  194. public boolean getAllowKeepBoard() {
  195. return config.getBoolean("Scoreboard.Allow_Keep", true);
  196. }
  197. public int getTipsAmount() {
  198. return config.getInt("Scoreboard.Tips_Amount", 5);
  199. }
  200. public boolean getShowStatsAfterLogin() {
  201. return config.getBoolean("Scoreboard.Show_Stats_After_Login", false);
  202. }
  203. public boolean getScoreboardRainbows() {
  204. return config.getBoolean("Scoreboard.Rainbows", false);
  205. }
  206. public boolean getShowAbilityNames() {
  207. return config.getBoolean("Scoreboard.Ability_Names", true);
  208. }
  209. public boolean getRankUseChat() {
  210. return config.getBoolean("Scoreboard.Types.Rank.Print", false);
  211. }
  212. public boolean getRankUseBoard() {
  213. return config.getBoolean("Scoreboard.Types.Rank.Board", true);
  214. }
  215. public int getRankScoreboardTime() {
  216. return config.getInt("Scoreboard.Types.Rank.Display_Time", 10);
  217. }
  218. public boolean getTopUseChat() {
  219. return config.getBoolean("Scoreboard.Types.Top.Print", true);
  220. }
  221. public boolean getTopUseBoard() {
  222. return config.getBoolean("Scoreboard.Types.Top.Board", true);
  223. }
  224. public int getTopScoreboardTime() {
  225. return config.getInt("Scoreboard.Types.Top.Display_Time", 15);
  226. }
  227. public boolean getStatsUseChat() {
  228. return config.getBoolean("Scoreboard.Types.Stats.Print", true);
  229. }
  230. public boolean getStatsUseBoard() {
  231. return config.getBoolean("Scoreboard.Types.Stats.Board", true);
  232. }
  233. public int getStatsScoreboardTime() {
  234. return config.getInt("Scoreboard.Types.Stats.Display_Time", 10);
  235. }
  236. public boolean getInspectUseChat() {
  237. return config.getBoolean("Scoreboard.Types.Inspect.Print", true);
  238. }
  239. public boolean getInspectUseBoard() {
  240. return config.getBoolean("Scoreboard.Types.Inspect.Board", true);
  241. }
  242. public int getInspectScoreboardTime() {
  243. return config.getInt("Scoreboard.Types.Inspect.Display_Time", 25);
  244. }
  245. public boolean getCooldownUseChat() {
  246. return config.getBoolean("Scoreboard.Types.Cooldown.Print", false);
  247. }
  248. public boolean getCooldownUseBoard() {
  249. return config.getBoolean("Scoreboard.Types.Cooldown.Board", true);
  250. }
  251. public int getCooldownScoreboardTime() {
  252. return config.getInt("Scoreboard.Types.Cooldown.Display_Time", 41);
  253. }
  254. public boolean getSkillUseBoard() {
  255. return config.getBoolean("Scoreboard.Types.Skill.Board", true);
  256. }
  257. public int getSkillScoreboardTime() {
  258. return config.getInt("Scoreboard.Types.Skill.Display_Time", 30);
  259. }
  260. public boolean getSkillLevelUpBoard() {
  261. return config.getBoolean("Scoreboard.Types.Skill.LevelUp_Board", true);
  262. }
  263. public int getSkillLevelUpTime() {
  264. return config.getInt("Scoreboard.Types.Skill.LevelUp_Time", 5);
  265. }
  266. /* Database Purging */
  267. public int getPurgeInterval() {
  268. return config.getInt("Database_Purging.Purge_Interval", -1);
  269. }
  270. public int getOldUsersCutoff() {
  271. return config.getInt("Database_Purging.Old_User_Cutoff", 6);
  272. }
  273. /* Backups */
  274. public boolean getBackupsEnabled() {
  275. return config.getBoolean("Backups.Enabled", true);
  276. }
  277. public boolean getKeepLast24Hours() {
  278. return config.getBoolean("Backups.Keep.Last_24_Hours", true);
  279. }
  280. public boolean getKeepDailyLastWeek() {
  281. return config.getBoolean("Backups.Keep.Daily_Last_Week", true);
  282. }
  283. public boolean getKeepWeeklyPastMonth() {
  284. return config.getBoolean("Backups.Keep.Weekly_Past_Months", true);
  285. }
  286. /* mySQL */
  287. public boolean getUseMySQL() {
  288. return config.getBoolean("MySQL.Enabled", false);
  289. }
  290. public String getMySQLTablePrefix() {
  291. return config.getString("MySQL.Database.TablePrefix", "mcmmo_");
  292. }
  293. public String getMySQLDatabaseName() {
  294. return getStringIncludingInts("MySQL.Database.Name");
  295. }
  296. public String getMySQLUserName() {
  297. return getStringIncludingInts("MySQL.Database.User_Name");
  298. }
  299. public int getMySQLServerPort() {
  300. return config.getInt("MySQL.Server.Port", 3306);
  301. }
  302. public String getMySQLServerName() {
  303. return config.getString("MySQL.Server.Address", "localhost");
  304. }
  305. public String getMySQLUserPassword() {
  306. return getStringIncludingInts("MySQL.Database.User_Password");
  307. }
  308. public int getMySQLMaxConnections(PoolIdentifier identifier) {
  309. return config.getInt("MySQL.Database.MaxConnections." + StringUtils.getCapitalized(identifier.toString()), 30);
  310. }
  311. public int getMySQLMaxPoolSize(PoolIdentifier identifier) {
  312. return config.getInt("MySQL.Database.MaxPoolSize." + StringUtils.getCapitalized(identifier.toString()), 10);
  313. }
  314. public boolean getMySQLSSL() {
  315. return config.getBoolean("MySQL.Server.SSL", true);
  316. }
  317. public boolean getMySQLDebug() {
  318. return config.getBoolean("MySQL.Debug", false);
  319. }
  320. public boolean getMySQLPublicKeyRetrieval() {
  321. return config.getBoolean("MySQL.Server.allowPublicKeyRetrieval", true);
  322. }
  323. private String getStringIncludingInts(String key) {
  324. String str = config.getString(key);
  325. if (str == null) {
  326. str = String.valueOf(config.getInt(key));
  327. }
  328. if (str.equals("0")) {
  329. str = "No value set for '" + key + "'";
  330. }
  331. return str;
  332. }
  333. /* Hardcore Mode */
  334. public boolean getHardcoreStatLossEnabled(PrimarySkillType primarySkillType) {
  335. return config.getBoolean("Hardcore.Death_Stat_Loss.Enabled." + StringUtils.getCapitalized(primarySkillType.toString()), false);
  336. }
  337. public void setHardcoreStatLossEnabled(PrimarySkillType primarySkillType, boolean enabled) {
  338. config.set("Hardcore.Death_Stat_Loss.Enabled." + StringUtils.getCapitalized(primarySkillType.toString()), enabled);
  339. }
  340. public double getHardcoreDeathStatPenaltyPercentage() {
  341. return config.getDouble("Hardcore.Death_Stat_Loss.Penalty_Percentage", 75.0D);
  342. }
  343. public void setHardcoreDeathStatPenaltyPercentage(double value) {
  344. config.set("Hardcore.Death_Stat_Loss.Penalty_Percentage", value);
  345. }
  346. public int getHardcoreDeathStatPenaltyLevelThreshold() {
  347. return config.getInt("Hardcore.Death_Stat_Loss.Level_Threshold", 0);
  348. }
  349. public boolean getHardcoreVampirismEnabled(PrimarySkillType primarySkillType) {
  350. return config.getBoolean("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(primarySkillType.toString()), false);
  351. }
  352. public void setHardcoreVampirismEnabled(PrimarySkillType primarySkillType, boolean enabled) {
  353. config.set("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(primarySkillType.toString()), enabled);
  354. }
  355. public double getHardcoreVampirismStatLeechPercentage() {
  356. return config.getDouble("Hardcore.Vampirism.Leech_Percentage", 5.0D);
  357. }
  358. public void setHardcoreVampirismStatLeechPercentage(double value) {
  359. config.set("Hardcore.Vampirism.Leech_Percentage", value);
  360. }
  361. public int getHardcoreVampirismLevelThreshold() {
  362. return config.getInt("Hardcore.Vampirism.Level_Threshold", 0);
  363. }
  364. /* SMP Mods */
  365. public boolean getToolModsEnabled() {
  366. return config.getBoolean("Mods.Tool_Mods_Enabled", false);
  367. }
  368. public boolean getArmorModsEnabled() {
  369. return config.getBoolean("Mods.Armor_Mods_Enabled", false);
  370. }
  371. public boolean getBlockModsEnabled() {
  372. return config.getBoolean("Mods.Block_Mods_Enabled", false);
  373. }
  374. public boolean getEntityModsEnabled() {
  375. return config.getBoolean("Mods.Entity_Mods_Enabled", false);
  376. }
  377. /* Items */
  378. public int getChimaeraUseCost() {
  379. return config.getInt("Items.Chimaera_Wing.Use_Cost", 1);
  380. }
  381. public int getChimaeraRecipeCost() {
  382. return config.getInt("Items.Chimaera_Wing.Recipe_Cost", 5);
  383. }
  384. public Material getChimaeraItem() {
  385. return Material.matchMaterial(config.getString("Items.Chimaera_Wing.Item_Name", "Feather"));
  386. }
  387. public boolean getChimaeraEnabled() {
  388. return config.getBoolean("Items.Chimaera_Wing.Enabled", true);
  389. }
  390. public boolean getChimaeraPreventUseUnderground() {
  391. return config.getBoolean("Items.Chimaera_Wing.Prevent_Use_Underground", true);
  392. }
  393. public boolean getChimaeraUseBedSpawn() {
  394. return config.getBoolean("Items.Chimaera_Wing.Use_Bed_Spawn", true);
  395. }
  396. public int getChimaeraCooldown() {
  397. return config.getInt("Items.Chimaera_Wing.Cooldown", 240);
  398. }
  399. public int getChimaeraWarmup() {
  400. return config.getInt("Items.Chimaera_Wing.Warmup", 5);
  401. }
  402. public int getChimaeraRecentlyHurtCooldown() {
  403. return config.getInt("Items.Chimaera_Wing.RecentlyHurt_Cooldown", 60);
  404. }
  405. public boolean getChimaeraSoundEnabled() {
  406. return config.getBoolean("Items.Chimaera_Wing.Sound_Enabled", true);
  407. }
  408. public boolean getFluxPickaxeSoundEnabled() {
  409. return config.getBoolean("Items.Flux_Pickaxe.Sound_Enabled", true);
  410. }
  411. /* Particles */
  412. public boolean getAbilityActivationEffectEnabled() {
  413. return config.getBoolean("Particles.Ability_Activation", true);
  414. }
  415. public boolean getAbilityDeactivationEffectEnabled() {
  416. return config.getBoolean("Particles.Ability_Deactivation", true);
  417. }
  418. public boolean getBleedEffectEnabled() {
  419. return config.getBoolean("Particles.Bleed", true);
  420. }
  421. public boolean getDodgeEffectEnabled() {
  422. return config.getBoolean("Particles.Dodge", true);
  423. }
  424. public boolean getFluxEffectEnabled() {
  425. return config.getBoolean("Particles.Flux", true);
  426. }
  427. public boolean getGreaterImpactEffectEnabled() {
  428. return config.getBoolean("Particles.Greater_Impact", true);
  429. }
  430. public boolean getCallOfTheWildEffectEnabled() {
  431. return config.getBoolean("Particles.Call_of_the_Wild", true);
  432. }
  433. public boolean getLevelUpEffectsEnabled() {
  434. return config.getBoolean("Particles.LevelUp_Enabled", true);
  435. }
  436. public int getLevelUpEffectsTier() {
  437. return config.getInt("Particles.LevelUp_Tier", 100);
  438. }
  439. // public boolean getLargeFireworks() { return config.getBoolean("Particles.LargeFireworks", true); }
  440. /* PARTY SETTINGS */
  441. public boolean getPartyFriendlyFire() {
  442. return config.getBoolean("Party.FriendlyFire", false);
  443. }
  444. public int getPartyMaxSize() {
  445. return config.getInt("Party.MaxSize", -1);
  446. }
  447. public int getAutoPartyKickInterval() {
  448. return config.getInt("Party.AutoKick_Interval", 12);
  449. }
  450. public int getAutoPartyKickTime() {
  451. return config.getInt("Party.Old_Party_Member_Cutoff", 7);
  452. }
  453. public double getPartyShareBonusBase() {
  454. return config.getDouble("Party.Sharing.ExpShare_bonus_base", 1.1D);
  455. }
  456. public double getPartyShareBonusIncrease() {
  457. return config.getDouble("Party.Sharing.ExpShare_bonus_increase", 0.05D);
  458. }
  459. public double getPartyShareBonusCap() {
  460. return config.getDouble("Party.Sharing.ExpShare_bonus_cap", 1.5D);
  461. }
  462. public double getPartyShareRange() {
  463. return config.getDouble("Party.Sharing.Range", 75.0D);
  464. }
  465. public int getPartyLevelCap() {
  466. int cap = config.getInt("Party.Leveling.Level_Cap", 10);
  467. return (cap <= 0) ? Integer.MAX_VALUE : cap;
  468. }
  469. public int getPartyXpCurveMultiplier() {
  470. return config.getInt("Party.Leveling.Xp_Curve_Modifier", 3);
  471. }
  472. public boolean getPartyXpNearMembersNeeded() {
  473. return config.getBoolean("Party.Leveling.Near_Members_Needed", false);
  474. }
  475. public boolean getPartyInformAllMembers() {
  476. return config.getBoolean("Party.Leveling.Inform_All_Party_Members_On_LevelUp", false);
  477. }
  478. public int getPartyFeatureUnlockLevel(PartyFeature partyFeature) {
  479. return config.getInt("Party.Leveling." + StringUtils.getPrettyPartyFeatureString(partyFeature).replace(" ", "") + "_UnlockLevel", 0);
  480. }
  481. /* Party Teleport Settings */
  482. public int getPTPCommandCooldown() {
  483. return config.getInt("Commands.ptp.Cooldown", 120);
  484. }
  485. public int getPTPCommandWarmup() {
  486. return config.getInt("Commands.ptp.Warmup", 5);
  487. }
  488. public int getPTPCommandRecentlyHurtCooldown() {
  489. return config.getInt("Commands.ptp.RecentlyHurt_Cooldown", 60);
  490. }
  491. public int getPTPCommandTimeout() {
  492. return config.getInt("Commands.ptp.Request_Timeout", 300);
  493. }
  494. public boolean getPTPCommandConfirmRequired() {
  495. return config.getBoolean("Commands.ptp.Accept_Required", true);
  496. }
  497. public boolean getPTPCommandWorldPermissions() {
  498. return config.getBoolean("Commands.ptp.World_Based_Permissions", false);
  499. }
  500. /* Inspect command distance */
  501. public double getInspectDistance() {
  502. return config.getDouble("Commands.inspect.Max_Distance", 30.0D);
  503. }
  504. /*
  505. * ABILITY SETTINGS
  506. */
  507. /* General Settings */
  508. public boolean getUrlLinksEnabled() {
  509. return config.getBoolean("Commands.Skills.URL_Links");
  510. }
  511. public boolean getAbilityMessagesEnabled() {
  512. return config.getBoolean("Abilities.Messages", true);
  513. }
  514. public boolean getAbilitiesEnabled() {
  515. return config.getBoolean("Abilities.Enabled", true);
  516. }
  517. public boolean getAbilitiesOnlyActivateWhenSneaking() {
  518. return config.getBoolean("Abilities.Activation.Only_Activate_When_Sneaking", false);
  519. }
  520. public boolean getAbilitiesGateEnabled() {
  521. return config.getBoolean("Abilities.Activation.Level_Gate_Abilities");
  522. }
  523. public int getCooldown(SuperAbilityType ability) {
  524. return config.getInt("Abilities.Cooldowns." + ability.toString());
  525. }
  526. public int getMaxLength(SuperAbilityType ability) {
  527. return config.getInt("Abilities.Max_Seconds." + ability.toString());
  528. }
  529. /* Durability Settings */
  530. public int getAbilityToolDamage() {
  531. return config.getInt("Abilities.Tools.Durability_Loss", 1);
  532. }
  533. /* Thresholds */
  534. public int getTreeFellerThreshold() {
  535. return config.getInt("Abilities.Limits.Tree_Feller_Threshold", 1000);
  536. }
  537. /*
  538. * SKILL SETTINGS
  539. */
  540. public boolean getDoubleDropsEnabled(PrimarySkillType skill, Material material) {
  541. //TODO: Temporary measure to fix an exploit caused by a yet to be fixed Spigot bug (as of 7/3/2020)
  542. if (material.toString().equalsIgnoreCase("LILY_PAD"))
  543. return false;
  544. return config.getBoolean("Bonus_Drops." + StringUtils.getCapitalized(skill.toString()) + "." + StringUtils.getPrettyItemString(material).replace(" ", "_"));
  545. }
  546. public boolean getDoubleDropsDisabled(PrimarySkillType skill) {
  547. String skillName = StringUtils.getCapitalized(skill.toString());
  548. ConfigurationSection section = config.getConfigurationSection("Bonus_Drops." + skillName);
  549. if (section == null)
  550. return false;
  551. Set<String> keys = section.getKeys(false);
  552. boolean disabled = true;
  553. for (String key : keys) {
  554. if (config.getBoolean("Bonus_Drops." + skillName + "." + key)) {
  555. disabled = false;
  556. break;
  557. }
  558. }
  559. return disabled;
  560. }
  561. /* Axes */
  562. public int getAxesGate() {
  563. return config.getInt("Skills.Axes.Ability_Activation_Level_Gate", 10);
  564. }
  565. /* Acrobatics */
  566. public boolean getDodgeLightningDisabled() {
  567. return config.getBoolean("Skills.Acrobatics.Prevent_Dodge_Lightning", false);
  568. }
  569. public int getXPAfterTeleportCooldown() {
  570. return config.getInt("Skills.Acrobatics.XP_After_Teleport_Cooldown", 5);
  571. }
  572. /* Alchemy */
  573. public boolean getEnabledForHoppers() {
  574. return config.getBoolean("Skills.Alchemy.Enabled_for_Hoppers", true);
  575. }
  576. public boolean getPreventHopperTransferIngredients() {
  577. return config.getBoolean("Skills.Alchemy.Prevent_Hopper_Transfer_Ingredients", false);
  578. }
  579. public boolean getPreventHopperTransferBottles() {
  580. return config.getBoolean("Skills.Alchemy.Prevent_Hopper_Transfer_Bottles", false);
  581. }
  582. /* Fishing */
  583. public boolean getFishingDropsEnabled() {
  584. return config.getBoolean("Skills.Fishing.Drops_Enabled", true);
  585. }
  586. public boolean getFishingOverrideTreasures() {
  587. return config.getBoolean("Skills.Fishing.Override_Vanilla_Treasures", true);
  588. }
  589. public boolean getFishingExtraFish() {
  590. return config.getBoolean("Skills.Fishing.Extra_Fish", true);
  591. }
  592. public double getFishingLureModifier() {
  593. return config.getDouble("Skills.Fishing.Lure_Modifier", 4.0D);
  594. }
  595. /* Mining */
  596. public Material getDetonatorItem() {
  597. return Material.matchMaterial(config.getString("Skills.Mining.Detonator_Name", "FLINT_AND_STEEL"));
  598. }
  599. /* Excavation */
  600. public int getExcavationGate() {
  601. return config.getInt("Skills.Excavation.Ability_Activation_Level_Gate", 10);
  602. }
  603. /* Repair */
  604. public boolean getRepairAnvilMessagesEnabled() {
  605. return config.getBoolean("Skills.Repair.Anvil_Messages", true);
  606. }
  607. public boolean getRepairAnvilPlaceSoundsEnabled() {
  608. return config.getBoolean("Skills.Repair.Anvil_Placed_Sounds", true);
  609. }
  610. public boolean getRepairAnvilUseSoundsEnabled() {
  611. return config.getBoolean("Skills.Repair.Anvil_Use_Sounds", true);
  612. }
  613. public @Nullable Material getRepairAnvilMaterial() {
  614. return Material.matchMaterial(config.getString("Skills.Repair.Anvil_Material", "IRON_BLOCK"));
  615. }
  616. public boolean getRepairConfirmRequired() {
  617. return config.getBoolean("Skills.Repair.Confirm_Required", true);
  618. }
  619. public boolean getAllowVanillaInventoryRepair() {
  620. return config.getBoolean("Skills.Repair.Allow_Vanilla_Anvil_Repair", false);
  621. }
  622. public boolean getAllowVanillaAnvilRepair() {
  623. return config.getBoolean("Skills.Repair.Allow_Vanilla_Inventory_Repair", false);
  624. }
  625. public boolean getAllowVanillaGrindstoneRepair() {
  626. return config.getBoolean("Skills.Repair.Allow_Vanilla_Grindstone_Repair", false);
  627. }
  628. /* Salvage */
  629. public boolean getSalvageAnvilMessagesEnabled() {
  630. return config.getBoolean("Skills.Salvage.Anvil_Messages", true);
  631. }
  632. public boolean getSalvageAnvilPlaceSoundsEnabled() {
  633. return config.getBoolean("Skills.Salvage.Anvil_Placed_Sounds", true);
  634. }
  635. public boolean getSalvageAnvilUseSoundsEnabled() {
  636. return config.getBoolean("Skills.Salvage.Anvil_Use_Sounds", true);
  637. }
  638. public @Nullable Material getSalvageAnvilMaterial() {
  639. return Material.matchMaterial(config.getString("Skills.Salvage.Anvil_Material", "GOLD_BLOCK"));
  640. }
  641. public boolean getSalvageConfirmRequired() {
  642. return config.getBoolean("Skills.Salvage.Confirm_Required", true);
  643. }
  644. /* Unarmed */
  645. public boolean getUnarmedBlockCrackerSmoothbrickToCracked() {
  646. return config.getBoolean("Skills.Unarmed.Block_Cracker.SmoothBrick_To_CrackedBrick", true);
  647. }
  648. public boolean getUnarmedItemPickupDisabled() {
  649. return config.getBoolean("Skills.Unarmed.Item_Pickup_Disabled_Full_Inventory", true);
  650. }
  651. public boolean getUnarmedItemsAsUnarmed() {
  652. return config.getBoolean("Skills.Unarmed.Items_As_Unarmed", false);
  653. }
  654. public int getUnarmedGate() {
  655. return config.getInt("Skills.Unarmed.Ability_Activation_Level_Gate", 10);
  656. }
  657. /* Swords */
  658. public int getSwordsGate() {
  659. return config.getInt("Skills.Swords.Ability_Activation_Level_Gate", 10);
  660. }
  661. /* Taming */
  662. // public Material getTamingCOTWMaterial(EntityType type) { return Material.matchMaterial(config.getString("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Item_Material")); }
  663. // public int getTamingCOTWCost(EntityType type) { return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Item_Amount"); }
  664. // public int getTamingCOTWAmount(EntityType type) { return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Summon_Amount"); }
  665. // public int getTamingCOTWLength(EntityType type) { return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type)+ ".Summon_Length"); }
  666. // public int getTamingCOTWMaxAmount(EntityType type) { return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type)+ ".Summon_Max_Amount"); }
  667. public Material getTamingCOTWMaterial(String cotwEntity) {
  668. return Material.matchMaterial(config.getString("Skills.Taming.Call_Of_The_Wild." + cotwEntity + ".Item_Material"));
  669. }
  670. public int getTamingCOTWCost(String cotwEntity) {
  671. return config.getInt("Skills.Taming.Call_Of_The_Wild." + cotwEntity + ".Item_Amount");
  672. }
  673. public int getTamingCOTWAmount(String cotwEntity) {
  674. return config.getInt("Skills.Taming.Call_Of_The_Wild." + cotwEntity + ".Summon_Amount");
  675. }
  676. public int getTamingCOTWLength(String cotwEntity) {
  677. return config.getInt("Skills.Taming.Call_Of_The_Wild." + cotwEntity + ".Summon_Length");
  678. }
  679. public int getTamingCOTWMaxAmount(String cotwEntity) {
  680. return config.getInt("Skills.Taming.Call_Of_The_Wild." + cotwEntity + ".Per_Player_Limit", 1);
  681. }
  682. /* Woodcutting */
  683. public boolean getWoodcuttingDoubleDropsEnabled(BlockData material) {
  684. return config.getBoolean("Bonus_Drops.Woodcutting." + StringUtils.getFriendlyConfigBlockDataString(material));
  685. }
  686. public boolean getTreeFellerSoundsEnabled() {
  687. return config.getBoolean("Skills.Woodcutting.Tree_Feller_Sounds", true);
  688. }
  689. public int getWoodcuttingGate() {
  690. return config.getInt("Skills.Woodcutting.Ability_Activation_Level_Gate", 10);
  691. }
  692. /* AFK Leveling */
  693. public boolean getHerbalismPreventAFK() {
  694. return config.getBoolean("Skills.Herbalism.Prevent_AFK_Leveling", true);
  695. }
  696. /* Level Caps */
  697. public int getPowerLevelCap() {
  698. int cap = config.getInt("General.Power_Level_Cap", 0);
  699. return (cap <= 0) ? Integer.MAX_VALUE : cap;
  700. }
  701. public int getLevelCap(PrimarySkillType skill) {
  702. int cap = config.getInt("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Level_Cap");
  703. return (cap <= 0) ? Integer.MAX_VALUE : cap;
  704. }
  705. /*public int isSuperAbilityUnlocked(PrimarySkillType skill) {
  706. return config.getInt("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Ability_Activation_Level_Gate");
  707. }*/
  708. public boolean getTruncateSkills() {
  709. return config.getBoolean("General.TruncateSkills", false);
  710. }
  711. /* PVP & PVE Settings */
  712. public boolean getPVPEnabled(PrimarySkillType skill) {
  713. return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVP", true);
  714. }
  715. public boolean getPVEEnabled(PrimarySkillType skill) {
  716. return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVE", true);
  717. }
  718. //public float getMasterVolume() { return (float) config.getDouble("Sounds.MasterVolume", 1.0); }
  719. public boolean broadcastEventMessages() {
  720. return config.getBoolean("General.EventBroadcasts", true);
  721. }
  722. public boolean playerJoinEventInfo() {
  723. return config.getBoolean("General.EventInfoOnPlayerJoin", true);
  724. }
  725. public boolean adminNotifications() {
  726. return config.getBoolean("General.AdminNotifications", true);
  727. }
  728. public boolean shouldLevelUpBroadcasts() {
  729. return config.getBoolean("General.Level_Up_Chat_Broadcasts.Enabled", true);
  730. }
  731. public boolean shouldLevelUpBroadcastToConsole() {
  732. return config.getBoolean("General.Level_Up_Chat_Broadcasts.Broadcast_Targets.Send_To_Console", true);
  733. }
  734. public boolean isLevelUpBroadcastsPartyMembersOnly() {
  735. return config.getBoolean("General.Level_Up_Chat_Broadcasts.Broadcast_Targets.Only_Party_Members", false);
  736. }
  737. public boolean isLevelUpBroadcastsSameWorldOnly() {
  738. return config.getBoolean("General.Level_Up_Chat_Broadcasts.Broadcast_Targets.Only_Same_World", false);
  739. }
  740. public boolean shouldLevelUpBroadcastsRestrictDistance() {
  741. return config.getBoolean("General.Level_Up_Chat_Broadcasts.Broadcast_Targets.Distance_Restrictions.Restrict_Distance", false);
  742. }
  743. public int getLevelUpBroadcastRadius() {
  744. return config.getInt("General.Level_Up_Chat_Broadcasts.Broadcast_Targets.Distance_Restrictions.Restricted_Radius", 100);
  745. }
  746. public int getLevelUpBroadcastInterval() {
  747. return config.getInt("General.Level_Up_Chat_Broadcasts.Milestone_Interval", 100);
  748. }
  749. public boolean shouldPowerLevelUpBroadcasts() {
  750. return config.getBoolean("General.Level_Up_Chat_Broadcasts.Broadcast_Powerlevels.Enabled", true);
  751. }
  752. public boolean shouldPowerLevelUpBroadcastToConsole() {
  753. return config.getBoolean("General.Level_Up_Chat_Broadcasts.Broadcast_Powerlevels.Broadcast_Targets.Send_To_Console", true);
  754. }
  755. public boolean isPowerLevelUpBroadcastsPartyMembersOnly() {
  756. return config.getBoolean("General.Level_Up_Chat_Broadcasts.Broadcast_Powerlevels.Broadcast_Targets.Only_Party_Members", false);
  757. }
  758. public boolean isPowerLevelUpBroadcastsSameWorldOnly() {
  759. return config.getBoolean("General.Level_Up_Chat_Broadcasts.Broadcast_Powerlevels.Broadcast_Targets.Only_Same_World", false);
  760. }
  761. public boolean shouldPowerLevelUpBroadcastsRestrictDistance() {
  762. return config.getBoolean("General.Level_Up_Chat_Broadcasts.Broadcast_Powerlevels.Broadcast_Targets.Distance_Restrictions.Restrict_Distance", false);
  763. }
  764. public int getPowerLevelUpBroadcastRadius() {
  765. return config.getInt("General.Level_Up_Chat_Broadcasts.Broadcast_Powerlevels.Broadcast_Targets.Distance_Restrictions.Restricted_Radius", 100);
  766. }
  767. public int getPowerLevelUpBroadcastInterval() {
  768. return config.getInt("General.Level_Up_Chat_Broadcasts.Broadcast_Powerlevels.Milestone_Interval", 100);
  769. }
  770. public boolean isGreenThumbReplantableCrop(@NotNull Material material) {
  771. return config.getBoolean("Green_Thumb_Replanting_Crops." + StringUtils.getCapitalized(material.toString()), true);
  772. }
  773. public boolean isMasterySystemEnabled() { return config.getBoolean( "General.PowerLevel.Skill_Mastery.Enabled"); }
  774. }