MainConfig.java 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048
  1. package com.gmail.nossr50.config;
  2. import com.gmail.nossr50.database.SQLDatabaseManager;
  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.mcMMO;
  8. import com.gmail.nossr50.util.StringUtils;
  9. import org.bukkit.Material;
  10. import org.bukkit.configuration.ConfigurationSection;
  11. import org.bukkit.entity.EntityType;
  12. import java.util.ArrayList;
  13. import java.util.List;
  14. import java.util.Set;
  15. public class MainConfig extends ConfigValidated {
  16. public MainConfig() {
  17. //super(McmmoCore.getDataFolderPath().getAbsoluteFile(), "config.yml", true);
  18. super(mcMMO.p.getDataFolder().getAbsoluteFile(), "config.yml", true);
  19. }
  20. /**
  21. * This grabs an instance of this config class from the Config Manager
  22. * This method is deprecated and will be removed in the future
  23. * @see mcMMO#getConfigManager()
  24. * @return the instance of this config
  25. * @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
  26. */
  27. @Deprecated
  28. public static MainConfig getInstance() {
  29. return mcMMO.getConfigManager().getMainConfig();
  30. }
  31. @Override
  32. public void unload() {
  33. //do nothing
  34. }
  35. /**
  36. * The version of this config
  37. *
  38. * @return
  39. */
  40. @Override
  41. public double getConfigVersion() {
  42. return 1;
  43. }
  44. @Override
  45. public List<String> validateKeys() {
  46. // Validate all the settings!
  47. List<String> reason = new ArrayList<String>();
  48. /* General Settings */
  49. if (getSaveInterval() <= 0) {
  50. reason.add("General.Save_Interval should be greater than 0!");
  51. }
  52. /* MySQL Settings */
  53. for (SQLDatabaseManager.PoolIdentifier identifier : SQLDatabaseManager.PoolIdentifier.values()) {
  54. if (getMySQLMaxConnections(identifier) <= 0) {
  55. reason.add("MySQL.Database.MaxConnections." + StringUtils.getCapitalized(identifier.toString()) + " should be greater than 0!");
  56. }
  57. if (getMySQLMaxPoolSize(identifier) <= 0) {
  58. reason.add("MySQL.Database.MaxPoolSize." + StringUtils.getCapitalized(identifier.toString()) + " should be greater than 0!");
  59. }
  60. }
  61. /* Mob Healthbar */
  62. if (getMobHealthbarTime() == 0) {
  63. reason.add("Mob_Healthbar.Display_Time cannot be 0! Set to -1 to disable or set a valid value.");
  64. }
  65. /* Scoreboards */
  66. /*if (getRankScoreboardTime() != -1 && getRankScoreboardTime() <= 0) {
  67. reason.add("Scoreboard.Types.Rank.Display_Time should be greater than 0, or -1!");
  68. }
  69. if (getStatsScoreboardTime() != -1 && getStatsScoreboardTime() <= 0) {
  70. reason.add("Scoreboard.Types.Stats.Display_Time should be greater than 0, or -1!");
  71. }
  72. if (getTopScoreboardTime() != -1 && getTopScoreboardTime() <= 0) {
  73. reason.add("Scoreboard.Types.Top.Display_Time should be greater than 0, or -1!");
  74. }
  75. if (getInspectScoreboardTime() != -1 && getInspectScoreboardTime() <= 0) {
  76. reason.add("Scoreboard.Types.Inspect.Display_Time should be greater than 0, or -1!");
  77. }
  78. if (getSkillScoreboardTime() != -1 && getSkillScoreboardTime() <= 0) {
  79. reason.add("Scoreboard.Types.Skill.Display_Time should be greater than 0, or -1!");
  80. }
  81. if (getSkillLevelUpTime() != -1 && getSkillScoreboardTime() <= 0) {
  82. reason.add("Scoreboard.Types.Skill.Display_Time should be greater than 0, or -1!");
  83. }
  84. if (!(getRankUseChat() || getRankUseBoard())) {
  85. reason.add("Either Board or Print in Scoreboard.Types.Rank must be true!");
  86. }
  87. if (!(getTopUseChat() || getTopUseBoard())) {
  88. reason.add("Either Board or Print in Scoreboard.Types.Top must be true!");
  89. }
  90. if (!(getStatsUseChat() || getStatsUseBoard())) {
  91. reason.add("Either Board or Print in Scoreboard.Types.Stats must be true!");
  92. }
  93. if (!(getInspectUseChat() || getInspectUseBoard())) {
  94. reason.add("Either Board or Print in Scoreboard.Types.Inspect must be true!");
  95. }*/
  96. /* Database Purging */
  97. if (getPurgeInterval() < -1) {
  98. reason.add("Database_Purging.Purge_Interval should be greater than, or equal to -1!");
  99. }
  100. if (getOldUsersCutoff() != -1 && getOldUsersCutoff() <= 0) {
  101. reason.add("Database_Purging.Old_User_Cutoff should be greater than 0 or -1!");
  102. }
  103. /* Hardcore Mode */
  104. if (getHardcoreDeathStatPenaltyPercentage() < 0.01 || getHardcoreDeathStatPenaltyPercentage() > 100) {
  105. reason.add("Hardcore.Death_Stat_Loss.Penalty_Percentage only accepts values from 0.01 to 100!");
  106. }
  107. if (getHardcoreVampirismStatLeechPercentage() < 0.01 || getHardcoreVampirismStatLeechPercentage() > 100) {
  108. reason.add("Hardcore.Vampirism.Leech_Percentage only accepts values from 0.01 to 100!");
  109. }
  110. /* Items */
  111. if (getChimaeraUseCost() < 1 || getChimaeraUseCost() > 64) {
  112. reason.add("Items.Chimaera_Wing.Use_Cost only accepts values from 1 to 64!");
  113. }
  114. if (getChimaeraRecipeCost() < 1 || getChimaeraRecipeCost() > 9) {
  115. reason.add("Items.Chimaera_Wing.Recipe_Cost only accepts values from 1 to 9!");
  116. }
  117. if (getChimaeraItem() == null) {
  118. reason.add("Items.Chimaera_Wing.Item_Name is invalid!");
  119. }
  120. /* Particles */
  121. if (getLevelUpEffectsTier() < 1) {
  122. reason.add("Particles.LevelUp_Tier should be at least 1!");
  123. }
  124. /* PARTY SETTINGS */
  125. if (getAutoPartyKickInterval() < -1) {
  126. reason.add("Party.AutoKick_Interval should be at least -1!");
  127. }
  128. if (getAutoPartyKickTime() < 0) {
  129. reason.add("Party.Old_Party_Member_Cutoff should be at least 0!");
  130. }
  131. if (getPartyShareBonusBase() <= 0) {
  132. reason.add("Party.Sharing.ExpShare_bonus_base should be greater than 0!");
  133. }
  134. if (getPartyShareBonusIncrease() < 0) {
  135. reason.add("Party.Sharing.ExpShare_bonus_increase should be at least 0!");
  136. }
  137. if (getPartyShareBonusCap() <= 0) {
  138. reason.add("Party.Sharing.ExpShare_bonus_cap should be greater than 0!");
  139. }
  140. if (getPartyShareRange() <= 0) {
  141. reason.add("Party.Sharing.Range should be greater than 0!");
  142. }
  143. if (getPartyXpCurveMultiplier() < 1) {
  144. reason.add("Party.Leveling.Xp_Curve_Modifier should be at least 1!");
  145. }
  146. for (PartyFeature partyFeature : PartyFeature.values()) {
  147. if (getPartyFeatureUnlockLevel(partyFeature) < 0) {
  148. reason.add("Party.Leveling." + StringUtils.getPrettyPartyFeatureString(partyFeature).replace(" ", "") + "_UnlockLevel should be at least 0!");
  149. }
  150. }
  151. /* Inspect command distance */
  152. if (getInspectDistance() <= 0) {
  153. reason.add("Commands.inspect.Max_Distance should be greater than 0!");
  154. }
  155. if (getTreeFellerThreshold() <= 0) {
  156. reason.add("Abilities.Limits.Tree_Feller_Threshold should be greater than 0!");
  157. }
  158. if (getFishingLureModifier() < 0) {
  159. reason.add("Abilities.Fishing.Lure_Modifier should be at least 0!");
  160. }
  161. if (getDetonatorItem() == null) {
  162. reason.add("Skills.Mining.Detonator_Item is invalid!");
  163. }
  164. if (getRepairAnvilMaterial() == null) {
  165. reason.add("Skills.Repair.Anvil_Type is invalid!!");
  166. }
  167. if (getSalvageAnvilMaterial() == null) {
  168. reason.add("Skills.Repair.Salvage_Anvil_Type is invalid!");
  169. }
  170. if (getRepairAnvilMaterial() == getSalvageAnvilMaterial()) {
  171. reason.add("Cannot use the same item for Repair and Salvage anvils!");
  172. }
  173. if (getTamingCOTWMaterial(EntityType.WOLF) == null) {
  174. reason.add("Skills.Taming.Call_Of_The_Wild.Wolf.Item_Material is invalid!!");
  175. }
  176. if (getTamingCOTWMaterial(EntityType.OCELOT) == null) {
  177. reason.add("Skills.Taming.Call_Of_The_Wild.Ocelot.Item_Material is invalid!!");
  178. }
  179. if (getTamingCOTWMaterial(EntityType.HORSE) == null) {
  180. reason.add("Skills.Taming.Call_Of_The_Wild.Horse.Item_Material is invalid!!");
  181. }
  182. if (getTamingCOTWCost(EntityType.WOLF) <= 0) {
  183. reason.add("Skills.Taming.Call_Of_The_Wild.Wolf.Item_Amount should be greater than 0!");
  184. }
  185. if (getTamingCOTWCost(EntityType.OCELOT) <= 0) {
  186. reason.add("Skills.Taming.Call_Of_The_Wild.Ocelot.Item_Amount should be greater than 0!");
  187. }
  188. if (getTamingCOTWCost(EntityType.HORSE) <= 0) {
  189. reason.add("Skills.Taming.Call_Of_The_Wild.Horse.Item_Amount should be greater than 0!");
  190. }
  191. if (getTamingCOTWAmount(EntityType.WOLF) <= 0) {
  192. reason.add("Skills.Taming.Call_Of_The_Wild.Wolf.Summon_Amount should be greater than 0!");
  193. }
  194. if (getTamingCOTWAmount(EntityType.OCELOT) <= 0) {
  195. reason.add("Skills.Taming.Call_Of_The_Wild.Ocelot.Summon_Amount should be greater than 0!");
  196. }
  197. if (getTamingCOTWAmount(EntityType.HORSE) <= 0) {
  198. reason.add("Skills.Taming.Call_Of_The_Wild.Horse.Summon_Amount should be greater than 0!");
  199. }
  200. return reason;
  201. }
  202. /*
  203. * GENERAL SETTINGS
  204. */
  205. /* General Settings */
  206. public boolean getIsMetricsEnabled() {
  207. return getBooleanValue("Metrics.bstats", true);
  208. }
  209. //Retro mode will default the value to true if the config file doesn't contain the entry (server is from a previous mcMMO install)
  210. public boolean getIsRetroMode() {
  211. return getBooleanValue("General.RetroMode.Enabled", true);
  212. }
  213. public String getLocale() {
  214. return getStringValue("General.Locale", "en_us");
  215. }
  216. public boolean getMOTDEnabled() {
  217. return getBooleanValue("General.MOTD_Enabled", true);
  218. }
  219. public boolean getShowProfileLoadedMessage() {
  220. return getBooleanValue("General.Show_Profile_Loaded", true);
  221. }
  222. public boolean getDonateMessageEnabled() {
  223. return getBooleanValue("Commands.mcmmo.Donate_Message", true);
  224. }
  225. public int getSaveInterval() {
  226. return getIntValue("General.Save_Interval", 10);
  227. }
  228. public boolean getStatsTrackingEnabled() {
  229. return getBooleanValue("General.Stats_Tracking", true);
  230. }
  231. public boolean getUpdateCheckEnabled() {
  232. return getBooleanValue("General.Update_Check", true);
  233. }
  234. public boolean getPreferBeta() {
  235. return getBooleanValue("General.Prefer_Beta", false);
  236. }
  237. public boolean getVerboseLoggingEnabled() {
  238. return getBooleanValue("General.Verbose_Logging", false);
  239. }
  240. public String getPartyChatPrefix() {
  241. return getStringValue("Commands.partychat.Chat_Prefix_Format", "[[GREEN]]([[WHITE]]{0}[[GREEN]])");
  242. }
  243. public boolean getPartyChatColorLeaderName() {
  244. return getBooleanValue("Commands.partychat.Gold_Leader_Name", true);
  245. }
  246. public boolean getPartyDisplayNames() {
  247. return getBooleanValue("Commands.partychat.Use_Display_Names", true);
  248. }
  249. public String getPartyChatPrefixAlly() {
  250. return getStringValue("Commands.partychat.Chat_Prefix_Format_Ally", "[[GREEN]](A)[[RESET]]");
  251. }
  252. public String getAdminChatPrefix() {
  253. return getStringValue("Commands.adminchat.Chat_Prefix_Format", "[[AQUA]][[[WHITE]]{0}[[AQUA]]]");
  254. }
  255. public boolean getAdminDisplayNames() {
  256. return getBooleanValue("Commands.adminchat.Use_Display_Names", true);
  257. }
  258. public boolean getMatchOfflinePlayers() {
  259. return getBooleanValue("Commands.Generic.Match_OfflinePlayers", false);
  260. }
  261. public long getDatabasePlayerCooldown() {
  262. return config.getLong("Commands.Database.Player_Cooldown", 1750);
  263. }
  264. public boolean getLevelUpSoundsEnabled() {
  265. return getBooleanValue("General.LevelUp_Sounds", true);
  266. }
  267. public boolean getRefreshChunksEnabled() {
  268. return getBooleanValue("General.Refresh_Chunks", false);
  269. }
  270. public boolean getMobHealthbarEnabled() {
  271. return getBooleanValue("Mob_Healthbar.Enabled", true);
  272. }
  273. /* Mob Healthbar */
  274. public MobHealthbarType getMobHealthbarDefault() {
  275. try {
  276. return MobHealthbarType.valueOf(getStringValue("Mob_Healthbar.Display_Type", "HEARTS").toUpperCase().trim());
  277. } catch (IllegalArgumentException ex) {
  278. return MobHealthbarType.HEARTS;
  279. }
  280. }
  281. public int getMobHealthbarTime() {
  282. return getIntValue("Mob_Healthbar.Display_Time", 3);
  283. }
  284. /* Scoreboards */
  285. public boolean getScoreboardsEnabled() {
  286. return getBooleanValue("Scoreboard.UseScoreboards", true);
  287. }
  288. public boolean getPowerLevelTagsEnabled() {
  289. return getBooleanValue("Scoreboard.Power_Level_Tags", false);
  290. }
  291. public boolean getAllowKeepBoard() {
  292. return getBooleanValue("Scoreboard.Allow_Keep", true);
  293. }
  294. public int getTipsAmount() {
  295. return getIntValue("Scoreboard.Tips_Amount", 5);
  296. }
  297. public boolean getShowStatsAfterLogin() {
  298. return getBooleanValue("Scoreboard.Show_Stats_After_Login", false);
  299. }
  300. public boolean getScoreboardRainbows() {
  301. return getBooleanValue("Scoreboard.Rainbows", false);
  302. }
  303. public boolean getShowAbilityNames() {
  304. return getBooleanValue("Scoreboard.Ability_Names", true);
  305. }
  306. public boolean getRankUseChat() {
  307. return getBooleanValue("Scoreboard.Types.Rank.Print", false);
  308. }
  309. public boolean getRankUseBoard() {
  310. return getBooleanValue("Scoreboard.Types.Rank.Board", true);
  311. }
  312. public int getRankScoreboardTime() {
  313. return getIntValue("Scoreboard.Types.Rank.Display_Time", 10);
  314. }
  315. public boolean getTopUseChat() {
  316. return getBooleanValue("Scoreboard.Types.Top.Print", true);
  317. }
  318. public boolean getTopUseBoard() {
  319. return getBooleanValue("Scoreboard.Types.Top.Board", true);
  320. }
  321. public int getTopScoreboardTime() {
  322. return getIntValue("Scoreboard.Types.Top.Display_Time", 15);
  323. }
  324. public boolean getStatsUseChat() {
  325. return getBooleanValue("Scoreboard.Types.Stats.Print", true);
  326. }
  327. public boolean getStatsUseBoard() {
  328. return getBooleanValue("Scoreboard.Types.Stats.Board", true);
  329. }
  330. public int getStatsScoreboardTime() {
  331. return getIntValue("Scoreboard.Types.Stats.Display_Time", 10);
  332. }
  333. public boolean getInspectUseChat() {
  334. return getBooleanValue("Scoreboard.Types.Inspect.Print", true);
  335. }
  336. public boolean getInspectUseBoard() {
  337. return getBooleanValue("Scoreboard.Types.Inspect.Board", true);
  338. }
  339. public int getInspectScoreboardTime() {
  340. return getIntValue("Scoreboard.Types.Inspect.Display_Time", 25);
  341. }
  342. public boolean getCooldownUseChat() {
  343. return getBooleanValue("Scoreboard.Types.Cooldown.Print", false);
  344. }
  345. public boolean getCooldownUseBoard() {
  346. return getBooleanValue("Scoreboard.Types.Cooldown.Board", true);
  347. }
  348. public int getCooldownScoreboardTime() {
  349. return getIntValue("Scoreboard.Types.Cooldown.Display_Time", 41);
  350. }
  351. public boolean getSkillUseBoard() {
  352. return getBooleanValue("Scoreboard.Types.Skill.Board", true);
  353. }
  354. public int getSkillScoreboardTime() {
  355. return getIntValue("Scoreboard.Types.Skill.Display_Time", 30);
  356. }
  357. public boolean getSkillLevelUpBoard() {
  358. return getBooleanValue("Scoreboard.Types.Skill.LevelUp_Board", true);
  359. }
  360. public int getSkillLevelUpTime() {
  361. return getIntValue("Scoreboard.Types.Skill.LevelUp_Time", 5);
  362. }
  363. /* Database Purging */
  364. public int getPurgeInterval() {
  365. return getIntValue("Database_Purging.Purge_Interval", -1);
  366. }
  367. public int getOldUsersCutoff() {
  368. return getIntValue("Database_Purging.Old_User_Cutoff", 6);
  369. }
  370. /* Backups */
  371. public boolean getBackupsEnabled() {
  372. return getBooleanValue("Backups.Enabled", true);
  373. }
  374. public boolean getKeepLast24Hours() {
  375. return getBooleanValue("Backups.Keep.Last_24_Hours", true);
  376. }
  377. public boolean getKeepDailyLastWeek() {
  378. return getBooleanValue("Backups.Keep.Daily_Last_Week", true);
  379. }
  380. public boolean getKeepWeeklyPastMonth() {
  381. return getBooleanValue("Backups.Keep.Weekly_Past_Months", true);
  382. }
  383. /* mySQL */
  384. public boolean getUseMySQL() {
  385. return getBooleanValue("MySQL.Enabled", false);
  386. }
  387. public String getMySQLTablePrefix() {
  388. return getStringValue("MySQL.Database.TablePrefix", "mcmmo_");
  389. }
  390. public String getMySQLDatabaseName() {
  391. return getStringIncludingInts("MySQL.Database.Name");
  392. }
  393. public String getMySQLUserName() {
  394. return getStringIncludingInts("MySQL.Database.User_Name");
  395. }
  396. public int getMySQLServerPort() {
  397. return getIntValue("MySQL.Server.Port", 3306);
  398. }
  399. public String getMySQLServerName() {
  400. return getStringValue("MySQL.Server.Address", "localhost");
  401. }
  402. public String getMySQLUserPassword() {
  403. return getStringIncludingInts("MySQL.Database.User_Password");
  404. }
  405. public int getMySQLMaxConnections(SQLDatabaseManager.PoolIdentifier identifier) {
  406. return getIntValue("MySQL.Database.MaxConnections." + StringUtils.getCapitalized(identifier.toString()), 30);
  407. }
  408. public int getMySQLMaxPoolSize(SQLDatabaseManager.PoolIdentifier identifier) {
  409. return getIntValue("MySQL.Database.MaxPoolSize." + StringUtils.getCapitalized(identifier.toString()), 10);
  410. }
  411. public boolean getMySQLSSL() {
  412. return getBooleanValue("MySQL.Server.SSL", true);
  413. }
  414. private String getStringIncludingInts(String key) {
  415. String str = getStringValue(key);
  416. if (str == null) {
  417. str = String.valueOf(getIntValue(key));
  418. }
  419. if (str.equals("0")) {
  420. str = "No value set for '" + key + "'";
  421. }
  422. return str;
  423. }
  424. /* Hardcore Mode */
  425. public boolean getHardcoreStatLossEnabled(PrimarySkillType primarySkillType) {
  426. return getBooleanValue("Hardcore.Death_Stat_Loss.Enabled." + StringUtils.getCapitalized(primarySkillType.toString()), false);
  427. }
  428. public void setHardcoreStatLossEnabled(PrimarySkillType primarySkillType, boolean enabled) {
  429. config.set("Hardcore.Death_Stat_Loss.Enabled." + StringUtils.getCapitalized(primarySkillType.toString()), enabled);
  430. }
  431. public double getHardcoreDeathStatPenaltyPercentage() {
  432. return getDoubleValue("Hardcore.Death_Stat_Loss.Penalty_Percentage", 75.0D);
  433. }
  434. public void setHardcoreDeathStatPenaltyPercentage(double value) {
  435. config.set("Hardcore.Death_Stat_Loss.Penalty_Percentage", value);
  436. }
  437. public int getHardcoreDeathStatPenaltyLevelThreshold() {
  438. return getIntValue("Hardcore.Death_Stat_Loss.Level_Threshold", 0);
  439. }
  440. public boolean getHardcoreVampirismEnabled(PrimarySkillType primarySkillType) {
  441. return getBooleanValue("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(primarySkillType.toString()), false);
  442. }
  443. public void setHardcoreVampirismEnabled(PrimarySkillType primarySkillType, boolean enabled) {
  444. config.set("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(primarySkillType.toString()), enabled);
  445. }
  446. public double getHardcoreVampirismStatLeechPercentage() {
  447. return getDoubleValue("Hardcore.Vampirism.Leech_Percentage", 5.0D);
  448. }
  449. public void setHardcoreVampirismStatLeechPercentage(double value) {
  450. config.set("Hardcore.Vampirism.Leech_Percentage", value);
  451. }
  452. public int getHardcoreVampirismLevelThreshold() {
  453. return getIntValue("Hardcore.Vampirism.Level_Threshold", 0);
  454. }
  455. /* SMP Mods */
  456. public boolean getToolModsEnabled() {
  457. return getBooleanValue("Mods.Tool_Mods_Enabled", false);
  458. }
  459. public boolean getArmorModsEnabled() {
  460. return getBooleanValue("Mods.Armor_Mods_Enabled", false);
  461. }
  462. public boolean getBlockModsEnabled() {
  463. return getBooleanValue("Mods.Block_Mods_Enabled", false);
  464. }
  465. public boolean getEntityModsEnabled() {
  466. return getBooleanValue("Mods.Entity_Mods_Enabled", false);
  467. }
  468. /* Items */
  469. public int getChimaeraUseCost() {
  470. return getIntValue("Items.Chimaera_Wing.Use_Cost", 1);
  471. }
  472. public int getChimaeraRecipeCost() {
  473. return getIntValue("Items.Chimaera_Wing.Recipe_Cost", 5);
  474. }
  475. public Material getChimaeraItem() {
  476. return Material.matchMaterial(getStringValue("Items.Chimaera_Wing.Item_Name", "Feather"));
  477. }
  478. public boolean getChimaeraEnabled() {
  479. return getBooleanValue("Items.Chimaera_Wing.Enabled", true);
  480. }
  481. public boolean getChimaeraPreventUseUnderground() {
  482. return getBooleanValue("Items.Chimaera_Wing.Prevent_Use_Underground", true);
  483. }
  484. public boolean getChimaeraUseBedSpawn() {
  485. return getBooleanValue("Items.Chimaera_Wing.Use_Bed_Spawn", true);
  486. }
  487. public int getChimaeraCooldown() {
  488. return getIntValue("Items.Chimaera_Wing.Cooldown", 240);
  489. }
  490. public int getChimaeraWarmup() {
  491. return getIntValue("Items.Chimaera_Wing.Warmup", 5);
  492. }
  493. public int getChimaeraRecentlyHurtCooldown() {
  494. return getIntValue("Items.Chimaera_Wing.RecentlyHurt_Cooldown", 60);
  495. }
  496. public boolean getChimaeraSoundEnabled() {
  497. return getBooleanValue("Items.Chimaera_Wing.Sound_Enabled", true);
  498. }
  499. public boolean getFluxPickaxeSoundEnabled() {
  500. return getBooleanValue("Items.Flux_Pickaxe.Sound_Enabled", true);
  501. }
  502. /* Particles */
  503. public boolean getAbilityActivationEffectEnabled() {
  504. return getBooleanValue("Particles.Ability_Activation", true);
  505. }
  506. public boolean getAbilityDeactivationEffectEnabled() {
  507. return getBooleanValue("Particles.Ability_Deactivation", true);
  508. }
  509. public boolean getBleedEffectEnabled() {
  510. return getBooleanValue("Particles.Bleed", true);
  511. }
  512. public boolean getDodgeEffectEnabled() {
  513. return getBooleanValue("Particles.Dodge", true);
  514. }
  515. public boolean getFluxEffectEnabled() {
  516. return getBooleanValue("Particles.Flux", true);
  517. }
  518. public boolean getGreaterImpactEffectEnabled() {
  519. return getBooleanValue("Particles.Greater_Impact", true);
  520. }
  521. public boolean getCallOfTheWildEffectEnabled() {
  522. return getBooleanValue("Particles.Call_of_the_Wild", true);
  523. }
  524. public boolean getLevelUpEffectsEnabled() {
  525. return getBooleanValue("Particles.LevelUp_Enabled", true);
  526. }
  527. public int getLevelUpEffectsTier() {
  528. return getIntValue("Particles.LevelUp_Tier", 100);
  529. }
  530. public boolean getLargeFireworks() {
  531. return getBooleanValue("Particles.LargeFireworks", true);
  532. }
  533. /* PARTY SETTINGS */
  534. public boolean getPartyFriendlyFire() {
  535. return getBooleanValue("Party.FriendlyFire", false);
  536. }
  537. public int getPartyMaxSize() {
  538. return getIntValue("Party.MaxSize", -1);
  539. }
  540. public int getAutoPartyKickInterval() {
  541. return getIntValue("Party.AutoKick_Interval", 12);
  542. }
  543. public int getAutoPartyKickTime() {
  544. return getIntValue("Party.Old_Party_Member_Cutoff", 7);
  545. }
  546. public double getPartyShareBonusBase() {
  547. return getDoubleValue("Party.Sharing.ExpShare_bonus_base", 1.1D);
  548. }
  549. public double getPartyShareBonusIncrease() {
  550. return getDoubleValue("Party.Sharing.ExpShare_bonus_increase", 0.05D);
  551. }
  552. public double getPartyShareBonusCap() {
  553. return getDoubleValue("Party.Sharing.ExpShare_bonus_cap", 1.5D);
  554. }
  555. public double getPartyShareRange() {
  556. return getDoubleValue("Party.Sharing.Range", 75.0D);
  557. }
  558. public int getPartyLevelCap() {
  559. int cap = getIntValue("Party.Leveling.Level_Cap", 10);
  560. return (cap <= 0) ? Integer.MAX_VALUE : cap;
  561. }
  562. public int getPartyXpCurveMultiplier() {
  563. return getIntValue("Party.Leveling.Xp_Curve_Modifier", 3);
  564. }
  565. public boolean getPartyXpNearMembersNeeded() {
  566. return getBooleanValue("Party.Leveling.Near_Members_Needed", false);
  567. }
  568. public boolean getPartyInformAllMembers() {
  569. return getBooleanValue("Party.Leveling.Inform_All_Party_Members_On_LevelUp", false);
  570. }
  571. public int getPartyFeatureUnlockLevel(PartyFeature partyFeature) {
  572. return getIntValue("Party.Leveling." + StringUtils.getPrettyPartyFeatureString(partyFeature).replace(" ", "") + "_UnlockLevel", 0);
  573. }
  574. /* Party Teleport Settings */
  575. public int getPTPCommandCooldown() {
  576. return getIntValue("Commands.ptp.Cooldown", 120);
  577. }
  578. public int getPTPCommandWarmup() {
  579. return getIntValue("Commands.ptp.Warmup", 5);
  580. }
  581. public int getPTPCommandRecentlyHurtCooldown() {
  582. return getIntValue("Commands.ptp.RecentlyHurt_Cooldown", 60);
  583. }
  584. public int getPTPCommandTimeout() {
  585. return getIntValue("Commands.ptp.Request_Timeout", 300);
  586. }
  587. public boolean getPTPCommandConfirmRequired() {
  588. return getBooleanValue("Commands.ptp.Accept_Required", true);
  589. }
  590. public boolean getPTPCommandWorldPermissions() {
  591. return getBooleanValue("Commands.ptp.World_Based_Permissions", false);
  592. }
  593. /* Inspect command distance */
  594. public double getInspectDistance() {
  595. return getDoubleValue("Commands.inspect.Max_Distance", 30.0D);
  596. }
  597. /*
  598. * ABILITY SETTINGS
  599. */
  600. /* General Settings */
  601. public boolean getUrlLinksEnabled() {
  602. return getBooleanValue("Commands.Skills.URL_Links");
  603. }
  604. public boolean getAbilityMessagesEnabled() {
  605. return getBooleanValue("Abilities.Messages", true);
  606. }
  607. public boolean getAbilitiesEnabled() {
  608. return getBooleanValue("Abilities.Enabled", true);
  609. }
  610. public boolean getAbilitiesOnlyActivateWhenSneaking() {
  611. return getBooleanValue("Abilities.Activation.Only_Activate_When_Sneaking", false);
  612. }
  613. public boolean getAbilitiesGateEnabled() {
  614. return getBooleanValue("Abilities.Activation.Level_Gate_Abilities");
  615. }
  616. public int getCooldown(SuperAbilityType ability) {
  617. return getIntValue("Abilities.Cooldowns." + ability.toString());
  618. }
  619. public int getMaxLength(SuperAbilityType ability) {
  620. return getIntValue("Abilities.Max_Seconds." + ability.toString());
  621. }
  622. /* Durability Settings */
  623. public int getAbilityToolDamage() {
  624. return getIntValue("Abilities.Tools.Durability_Loss", 1);
  625. }
  626. /* Thresholds */
  627. public int getTreeFellerThreshold() {
  628. return getIntValue("Abilities.Limits.Tree_Feller_Threshold", 500);
  629. }
  630. /*
  631. * SKILL SETTINGS
  632. */
  633. public boolean getDoubleDropsEnabled(PrimarySkillType skill, Material material) {
  634. return getBooleanValue("Double_Drops." + StringUtils.getCapitalized(skill.toString()) + "." + StringUtils.getPrettyItemString(material).replace(" ", "_"));
  635. }
  636. public boolean getDoubleDropsDisabled(PrimarySkillType skill) {
  637. String skillName = StringUtils.getCapitalized(skill.toString());
  638. ConfigurationSection section = config.getConfigurationSection("Double_Drops." + skillName);
  639. if (section == null)
  640. return false;
  641. Set<String> keys = section.getKeys(false);
  642. boolean disabled = true;
  643. for (String key : keys) {
  644. if (getBooleanValue("Double_Drops." + skillName + "." + key)) {
  645. disabled = false;
  646. break;
  647. }
  648. }
  649. return disabled;
  650. }
  651. /* Axes */
  652. public int getAxesGate() {
  653. return getIntValue("Skills.Axes.Ability_Activation_Level_Gate", 10);
  654. }
  655. /* Acrobatics */
  656. public boolean getDodgeLightningDisabled() {
  657. return getBooleanValue("Skills.Acrobatics.Prevent_Dodge_Lightning", false);
  658. }
  659. public int getXPAfterTeleportCooldown() {
  660. return getIntValue("Skills.Acrobatics.XP_After_Teleport_Cooldown", 5);
  661. }
  662. /* Alchemy */
  663. public boolean getEnabledForHoppers() {
  664. return getBooleanValue("Skills.Alchemy.Enabled_for_Hoppers", true);
  665. }
  666. public boolean getPreventHopperTransferIngredients() {
  667. return getBooleanValue("Skills.Alchemy.Prevent_Hopper_Transfer_Ingredients", false);
  668. }
  669. public boolean getPreventHopperTransferBottles() {
  670. return getBooleanValue("Skills.Alchemy.Prevent_Hopper_Transfer_Bottles", false);
  671. }
  672. /* Fishing */
  673. public boolean getFishingDropsEnabled() {
  674. return getBooleanValue("Skills.Fishing.Drops_Enabled", true);
  675. }
  676. public boolean getFishingOverrideTreasures() {
  677. return getBooleanValue("Skills.Fishing.Override_Vanilla_Treasures", true);
  678. }
  679. public boolean getFishingExtraFish() {
  680. return getBooleanValue("Skills.Fishing.Extra_Fish", true);
  681. }
  682. public double getFishingLureModifier() {
  683. return getDoubleValue("Skills.Fishing.Lure_Modifier", 4.0D);
  684. }
  685. /* Mining */
  686. public Material getDetonatorItem() {
  687. return Material.matchMaterial(getStringValue("Skills.Mining.Detonator_Name", "FLINT_AND_STEEL"));
  688. }
  689. public int getMiningGate() {
  690. return getIntValue("Skills.Mining.Ability_Activation_Level_Gate", 10);
  691. }
  692. /* Excavation */
  693. public int getExcavationGate() {
  694. return getIntValue("Skills.Excavation.Ability_Activation_Level_Gate", 10);
  695. }
  696. /* Repair */
  697. public boolean getRepairAnvilMessagesEnabled() {
  698. return getBooleanValue("Skills.Repair.Anvil_Messages", true);
  699. }
  700. public boolean getRepairAnvilPlaceSoundsEnabled() {
  701. return getBooleanValue("Skills.Repair.Anvil_Placed_Sounds", true);
  702. }
  703. public boolean getRepairAnvilUseSoundsEnabled() {
  704. return getBooleanValue("Skills.Repair.Anvil_Use_Sounds", true);
  705. }
  706. public Material getRepairAnvilMaterial() {
  707. return Material.matchMaterial(getStringValue("Skills.Repair.Anvil_Material", "IRON_BLOCK"));
  708. }
  709. public boolean getRepairConfirmRequired() {
  710. return getBooleanValue("Skills.Repair.Confirm_Required", true);
  711. }
  712. /* Salvage */
  713. public boolean getSalvageAnvilMessagesEnabled() {
  714. return getBooleanValue("Skills.Salvage.Anvil_Messages", true);
  715. }
  716. public boolean getSalvageAnvilPlaceSoundsEnabled() {
  717. return getBooleanValue("Skills.Salvage.Anvil_Placed_Sounds", true);
  718. }
  719. public boolean getSalvageAnvilUseSoundsEnabled() {
  720. return getBooleanValue("Skills.Salvage.Anvil_Use_Sounds", true);
  721. }
  722. public Material getSalvageAnvilMaterial() {
  723. return Material.matchMaterial(getStringValue("Skills.Salvage.Anvil_Material", "GOLD_BLOCK"));
  724. }
  725. public boolean getSalvageConfirmRequired() {
  726. return getBooleanValue("Skills.Salvage.Confirm_Required", true);
  727. }
  728. /* Unarmed */
  729. public boolean getUnarmedBlockCrackerSmoothbrickToCracked() {
  730. return getBooleanValue("Skills.Unarmed.Block_Cracker.SmoothBrick_To_CrackedBrick", true);
  731. }
  732. public boolean getUnarmedItemPickupDisabled() {
  733. return getBooleanValue("Skills.Unarmed.Item_Pickup_Disabled_Full_Inventory", true);
  734. }
  735. public boolean getUnarmedItemsAsUnarmed() {
  736. return getBooleanValue("Skills.Unarmed.Items_As_Unarmed", false);
  737. }
  738. public int getUnarmedGate() {
  739. return getIntValue("Skills.Unarmed.Ability_Activation_Level_Gate", 10);
  740. }
  741. /* Swords */
  742. public int getSwordsGate() {
  743. return getIntValue("Skills.Swords.Ability_Activation_Level_Gate", 10);
  744. }
  745. /* Taming */
  746. public Material getTamingCOTWMaterial(EntityType type) {
  747. return Material.matchMaterial(getStringValue("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Item_Material"));
  748. }
  749. public int getTamingCOTWCost(EntityType type) {
  750. return getIntValue("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Item_Amount");
  751. }
  752. public int getTamingCOTWAmount(EntityType type) {
  753. return getIntValue("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Summon_Amount");
  754. }
  755. public int getTamingCOTWLength(EntityType type) {
  756. return getIntValue("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Summon_Length");
  757. }
  758. public int getTamingCOTWMaxAmount(EntityType type) {
  759. return getIntValue("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Summon_Max_Amount");
  760. }
  761. public double getTamingCOTWRange() {
  762. return getDoubleValue("Skills.Taming.Call_Of_The_Wild.Range", 40.0D);
  763. }
  764. /* Woodcutting */
  765. public boolean getWoodcuttingDoubleDropsEnabled(BlockData material) {
  766. return getBooleanValue("Double_Drops.Woodcutting." + StringUtils.getFriendlyConfigBlockDataString(material));
  767. }
  768. public boolean getTreeFellerSoundsEnabled() {
  769. return getBooleanValue("Skills.Woodcutting.Tree_Feller_Sounds", true);
  770. }
  771. public int getWoodcuttingGate() {
  772. return getIntValue("Skills.Woodcutting.Ability_Activation_Level_Gate", 10);
  773. }
  774. /* AFK Leveling */
  775. public boolean getAcrobaticsPreventAFK() {
  776. return getBooleanValue("Skills.Acrobatics.Prevent_AFK_Leveling", true);
  777. }
  778. public int getAcrobaticsAFKMaxTries() {
  779. return getIntValue("Skills.Acrobatics.Max_Tries_At_Same_Location", 3);
  780. }
  781. public boolean getHerbalismPreventAFK() {
  782. return getBooleanValue("Skills.Herbalism.Prevent_AFK_Leveling", true);
  783. }
  784. /* Level Caps */
  785. public int getPowerLevelCap() {
  786. int cap = getIntValue("General.Power_Level_Cap", 0);
  787. return (cap <= 0) ? Integer.MAX_VALUE : cap;
  788. }
  789. public int getLevelCap(PrimarySkillType skill) {
  790. int cap = getIntValue("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Level_Cap");
  791. return (cap <= 0) ? Integer.MAX_VALUE : cap;
  792. }
  793. /*public int isSuperAbilityUnlocked(PrimarySkillType skill) {
  794. return getIntValue("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Ability_Activation_Level_Gate");
  795. }*/
  796. public boolean getTruncateSkills() {
  797. return getBooleanValue("General.TruncateSkills", false);
  798. }
  799. /* PVP & PVE Settings */
  800. public boolean getPVPEnabled(PrimarySkillType skill) {
  801. return getBooleanValue("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVP", true);
  802. }
  803. public boolean getPVEEnabled(PrimarySkillType skill) {
  804. return getBooleanValue("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVE", true);
  805. }
  806. //public float getMasterVolume() { return (float) getDoubleValue("Sounds.MasterVolume", 1.0); }
  807. }