AdvancedConfig.java 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944
  1. package com.gmail.nossr50.config;
  2. import com.gmail.nossr50.datatypes.interactions.NotificationType;
  3. import com.gmail.nossr50.datatypes.skills.SubSkillType;
  4. import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
  5. import com.gmail.nossr50.mcMMO;
  6. import net.md_5.bungee.api.ChatColor;
  7. import java.io.File;
  8. import java.util.ArrayList;
  9. import java.util.List;
  10. public class AdvancedConfig extends BukkitConfig {
  11. public AdvancedConfig(File dataFolder) {
  12. super("advanced.yml", dataFolder);
  13. validate();
  14. }
  15. @Override
  16. protected boolean validateKeys() {
  17. // Validate all the settings!
  18. List<String> reason = new ArrayList<>();
  19. /* GENERAL */
  20. if (getAbilityLength() < 1) {
  21. reason.add("Skills.General.Ability.Length.<mode>.IncreaseLevel should be at least 1!");
  22. }
  23. if (getEnchantBuff() < 1) {
  24. reason.add("Skills.General.Ability.EnchantBuff should be at least 1!");
  25. }
  26. /* ACROBATICS */
  27. if (getMaximumProbability(SubSkillType.ACROBATICS_DODGE) < 1) {
  28. reason.add("Skills.Acrobatics.Dodge.ChanceMax should be at least 1!");
  29. }
  30. if (getMaxBonusLevel(SubSkillType.ACROBATICS_DODGE) < 1) {
  31. reason.add("Skills.Acrobatics.Dodge.MaxBonusLevel should be at least 1!");
  32. }
  33. if (getDodgeDamageModifier() <= 1) {
  34. reason.add("Skills.Acrobatics.Dodge.DamageModifier should be greater than 1!");
  35. }
  36. if (getMaximumProbability(SubSkillType.ACROBATICS_ROLL) < 1) {
  37. reason.add("Skills.Acrobatics.Roll.ChanceMax should be at least 1!");
  38. }
  39. if (getMaxBonusLevel(SubSkillType.ACROBATICS_ROLL) < 1) {
  40. reason.add("Skills.Acrobatics.Roll.MaxBonusLevel should be at least 1!");
  41. }
  42. if (getRollDamageThreshold() < 0) {
  43. reason.add("Skills.Acrobatics.Roll.DamageThreshold should be at least 0!");
  44. }
  45. if (getGracefulRollDamageThreshold() < 0) {
  46. reason.add("Skills.Acrobatics.GracefulRoll.DamageThreshold should be at least 0!");
  47. }
  48. if (getCatalysisMinSpeed() <= 0) {
  49. reason.add("Skills.Alchemy.Catalysis.MinSpeed must be greater than 0!");
  50. }
  51. if (getCatalysisMaxSpeed() < getCatalysisMinSpeed()) {
  52. reason.add("Skills.Alchemy.Catalysis.MaxSpeed should be at least Skills.Alchemy.Catalysis.MinSpeed!");
  53. }
  54. /* ARCHERY */
  55. if (getSkillShotRankDamageMultiplier() <= 0) {
  56. reason.add("Skills.Archery.SkillShot.RankDamageMultiplier should be greater than 0!");
  57. }
  58. if (getMaximumProbability(SubSkillType.ARCHERY_DAZE) < 1) {
  59. reason.add("Skills.Archery.Daze.ChanceMax should be at least 1!");
  60. }
  61. if (getMaxBonusLevel(SubSkillType.ARCHERY_DAZE) < 1) {
  62. reason.add("Skills.Archery.Daze.MaxBonusLevel should be at least 1!");
  63. }
  64. if (getDazeBonusDamage() < 0) {
  65. reason.add("Skills.Archery.Daze.BonusDamage should be at least 0!");
  66. }
  67. if (getMaximumProbability(SubSkillType.ARCHERY_ARROW_RETRIEVAL) < 1) {
  68. reason.add("Skills.Archery.Retrieve.ChanceMax should be at least 1!");
  69. }
  70. if (getMaxBonusLevel(SubSkillType.ARCHERY_ARROW_RETRIEVAL) < 1) {
  71. reason.add("Skills.Archery.Retrieve.MaxBonusLevel should be at least 1!");
  72. }
  73. if (getForceMultiplier() < 0) {
  74. reason.add("Skills.Archery.ForceMultiplier should be at least 0!");
  75. }
  76. /* AXES */
  77. if (getAxeMasteryRankDamageMultiplier() < 0) {
  78. reason.add("Skills.Axes.AxeMastery.RankDamageMultiplier should be at least 0!");
  79. }
  80. if (getMaximumProbability(SubSkillType.AXES_CRITICAL_STRIKES) < 1) {
  81. reason.add("Skills.Axes.CriticalHit.ChanceMax should be at least 1!");
  82. }
  83. if (getMaxBonusLevel(SubSkillType.AXES_CRITICAL_STRIKES) < 1) {
  84. reason.add("Skills.Axes.CriticalHit.MaxBonusLevel should be at least 1!");
  85. }
  86. if (getCriticalStrikesPVPModifier() < 1) {
  87. reason.add("Skills.Axes.CriticalStrikes.PVP_Modifier should be at least 1!");
  88. }
  89. if (getCriticalStrikesPVPModifier() < 1) {
  90. reason.add("Skills.Axes.CriticalStrikes.PVE_Modifier should be at least 1!");
  91. }
  92. if (getGreaterImpactChance() < 1) {
  93. reason.add("Skills.Axes.GreaterImpact.Chance should be at least 1!");
  94. }
  95. if (getGreaterImpactModifier() < 1) {
  96. reason.add("Skills.Axes.GreaterImpact.KnockbackModifier should be at least 1!");
  97. }
  98. if (getGreaterImpactBonusDamage() < 1) {
  99. reason.add("Skills.Axes.GreaterImpact.BonusDamage should be at least 1!");
  100. }
  101. if (getImpactChance() < 1) {
  102. reason.add("Skills.Axes.ArmorImpact.Chance should be at least 1!");
  103. }
  104. if (getSkullSplitterModifier() < 1) {
  105. reason.add("Skills.Axes.SkullSplitter.DamageModifier should be at least 1!");
  106. }
  107. /* FISHING */
  108. /*List<Fishing.Tier> fishingTierList = Arrays.asList(Fishing.Tier.values());
  109. for (int rank : fishingTierList) {
  110. if (getFishingTierLevel(tier) < 0) {
  111. reason.add("Skills.Fishing.Rank_Levels.Rank_" + rank + " should be at least 0!");
  112. }
  113. if (getShakeChance(tier) < 0) {
  114. reason.add("Skills.Fishing.Shake_Chance.Rank_" + rank + " should be at least 0!");
  115. }
  116. if (getFishingVanillaXPModifier(tier) < 0) {
  117. reason.add("Skills.Fishing.VanillaXPMultiplier.Rank_" + rank + " should be at least 0!");
  118. }
  119. if (tier != Fishing.Tier.EIGHT) {
  120. Fishing.Tier nextTier = fishingTierList.get(fishingTierList.indexOf(tier) - 1);
  121. if (getFishingTierLevel(tier) > getFishingTierLevel(nextTier)) {
  122. reason.add("Skills.Fishing.Rank_Levels.Rank_" + rank + " should be less than or equal to Skills.Fishing.Rank_Levels.Rank_" + nextrank + "!");
  123. }
  124. if (getShakeChance(tier) > getShakeChance(nextTier)) {
  125. reason.add("Skills.Fishing.Shake_Chance.Rank_" + rank + " should be less than or equal to Skills.Fishing.Shake_Chance.Rank_" + nextrank + "!");
  126. }
  127. if (getFishingVanillaXPModifier(tier) > getFishingVanillaXPModifier(nextTier)) {
  128. reason.add("Skills.Fishing.VanillaXPMultiplier.Rank_" + rank + " should be less than or equal to Skills.Fishing.VanillaXPMultiplier.Rank_" + nextrank + "!");
  129. }
  130. }
  131. }*/
  132. if (getFishermanDietRankChange() < 1) {
  133. reason.add("Skills.Fishing.FishermansDiet.RankChange should be at least 1!");
  134. }
  135. /*if (getIceFishingUnlockLevel() < 0) {
  136. reason.add("Skills.Fishing.IceFishing.UnlockLevel should be at least 0!");
  137. }
  138. if (getMasterAnglerUnlockLevel() < 0) {
  139. reason.add("Skills.Fishing.MasterAngler.UnlockLevel should be at least 0!");
  140. }*/
  141. if (getMasterAnglerBoatModifier() < 1) {
  142. reason.add("Skills.Fishing.MasterAngler.BoatModifier should be at least 1!");
  143. }
  144. if (getMasterAnglerBiomeModifier() < 1) {
  145. reason.add("Skills.Fishing.MasterAngler.BiomeModifier should be at least 1!");
  146. }
  147. /* HERBALISM */
  148. if (getFarmerDietRankChange() < 1) {
  149. reason.add("Skills.Herbalism.FarmersDiet.RankChange should be at least 1!");
  150. }
  151. if (getGreenThumbStageChange() < 1) {
  152. reason.add("Skills.Herbalism.GreenThumb.StageChange should be at least 1!");
  153. }
  154. if (getMaximumProbability(SubSkillType.HERBALISM_GREEN_THUMB) < 1) {
  155. reason.add("Skills.Herbalism.GreenThumb.ChanceMax should be at least 1!");
  156. }
  157. if (getMaxBonusLevel(SubSkillType.HERBALISM_GREEN_THUMB) < 1) {
  158. reason.add("Skills.Herbalism.GreenThumb.MaxBonusLevel should be at least 1!");
  159. }
  160. if (getMaximumProbability(SubSkillType.HERBALISM_DOUBLE_DROPS) < 1) {
  161. reason.add("Skills.Herbalism.DoubleDrops.ChanceMax should be at least 1!");
  162. }
  163. if (getMaxBonusLevel(SubSkillType.HERBALISM_DOUBLE_DROPS) < 1) {
  164. reason.add("Skills.Herbalism.DoubleDrops.MaxBonusLevel should be at least 1!");
  165. }
  166. if (getMaximumProbability(SubSkillType.HERBALISM_HYLIAN_LUCK) < 1) {
  167. reason.add("Skills.Herbalism.HylianLuck.ChanceMax should be at least 1!");
  168. }
  169. if (getMaxBonusLevel(SubSkillType.HERBALISM_HYLIAN_LUCK) < 1) {
  170. reason.add("Skills.Herbalism.HylianLuck.MaxBonusLevel should be at least 1!");
  171. }
  172. if (getMaximumProbability(SubSkillType.HERBALISM_SHROOM_THUMB) < 1) {
  173. reason.add("Skills.Herbalism.ShroomThumb.ChanceMax should be at least 1!");
  174. }
  175. if (getMaxBonusLevel(SubSkillType.HERBALISM_SHROOM_THUMB) < 1) {
  176. reason.add("Skills.Herbalism.ShroomThumb.MaxBonusLevel should be at least 1!");
  177. }
  178. /* MINING */
  179. if (getMaximumProbability(SubSkillType.MINING_DOUBLE_DROPS) < 1) {
  180. reason.add("Skills.Mining.DoubleDrops.ChanceMax should be at least 1!");
  181. }
  182. if (getMaxBonusLevel(SubSkillType.MINING_DOUBLE_DROPS) < 1) {
  183. reason.add("Skills.Mining.DoubleDrops.MaxBonusLevel should be at least 1!");
  184. }
  185. /* REPAIR */
  186. if (getRepairMasteryMaxBonus() < 1) {
  187. reason.add("Skills.Repair.RepairMastery.MaxBonusPercentage should be at least 1!");
  188. }
  189. if (getRepairMasteryMaxLevel() < 1) {
  190. reason.add("Skills.Repair.RepairMastery.MaxBonusLevel should be at least 1!");
  191. }
  192. if (getMaximumProbability(SubSkillType.REPAIR_SUPER_REPAIR) < 1) {
  193. reason.add("Skills.Repair.SuperRepair.ChanceMax should be at least 1!");
  194. }
  195. if (getMaxBonusLevel(SubSkillType.REPAIR_SUPER_REPAIR) < 1) {
  196. reason.add("Skills.Repair.SuperRepair.MaxBonusLevel should be at least 1!");
  197. }
  198. /* SMELTING */
  199. if (getBurnModifierMaxLevel() < 1) {
  200. reason.add("Skills.Smelting.FuelEfficiency.MaxBonusLevel should be at least 1!");
  201. }
  202. if (getMaxBonusLevel(SubSkillType.SMELTING_SECOND_SMELT) < 1) {
  203. reason.add("Skills.Smelting.SecondSmelt.MaxBonusLevel should be at least 1!");
  204. }
  205. if (getMaximumProbability(SubSkillType.SMELTING_SECOND_SMELT) < 1) {
  206. reason.add("Skills.Smelting.SecondSmelt.ChanceMax should be at least 1!");
  207. }
  208. if (getFluxMiningChance() < 1) {
  209. reason.add("Skills.Smelting.FluxMining.Chance should be at least 1!");
  210. }
  211. /* SWORDS */
  212. if (getMaximumProbability(SubSkillType.SWORDS_COUNTER_ATTACK) < 1) {
  213. reason.add("Skills.Swords.CounterAttack.ChanceMax should be at least 1!");
  214. }
  215. if (getMaxBonusLevel(SubSkillType.SWORDS_COUNTER_ATTACK) < 1) {
  216. reason.add("Skills.Swords.CounterAttack.MaxBonusLevel should be at least 1!");
  217. }
  218. if (getCounterModifier() < 1) {
  219. reason.add("Skills.Swords.CounterAttack.DamageModifier should be at least 1!");
  220. }
  221. if (getSerratedStrikesModifier() < 1) {
  222. reason.add("Skills.Swords.SerratedStrikes.DamageModifier should be at least 1!");
  223. }
  224. if (getSerratedStrikesTicks() < 1) {
  225. reason.add("Skills.Swords.SerratedStrikes.RuptureTicks should be at least 1!");
  226. }
  227. /* TAMING */
  228. if (getMaximumProbability(SubSkillType.TAMING_GORE) < 1) {
  229. reason.add("Skills.Taming.Gore.ChanceMax should be at least 1!");
  230. }
  231. if (getMaxBonusLevel(SubSkillType.TAMING_GORE) < 1) {
  232. reason.add("Skills.Taming.Gore.MaxBonusLevel should be at least 1!");
  233. }
  234. /*if (getGoreRuptureTicks() < 1) {
  235. reason.add("Skills.Taming.Gore.RuptureTicks should be at least 1!");
  236. }*/
  237. if (getGoreModifier() < 1) {
  238. reason.add("Skills.Taming.Gore.Modifier should be at least 1!");
  239. }
  240. /*if (getFastFoodUnlock() < 0) {
  241. reason.add("Skills.Taming.FastFood.UnlockLevel should be at least 0!");
  242. }*/
  243. if (getFastFoodChance() < 1) {
  244. reason.add("Skills.Taming.FastFood.Chance should be at least 1!");
  245. }
  246. /*if (getEnviromentallyAwareUnlock() < 0) {
  247. reason.add("Skills.Taming.EnvironmentallyAware.UnlockLevel should be at least 0!");
  248. }*/
  249. /*if (getThickFurUnlock() < 0) {
  250. reason.add("Skills.Taming.ThickFur.UnlockLevel should be at least 0!");
  251. }*/
  252. if (getThickFurModifier() < 1) {
  253. reason.add("Skills.Taming.ThickFur.Modifier should be at least 1!");
  254. }
  255. /*if (getHolyHoundUnlock() < 0) {
  256. reason.add("Skills.Taming.HolyHound.UnlockLevel should be at least 0!");
  257. }
  258. if (getShockProofUnlock() < 0) {
  259. reason.add("Skills.Taming.ShockProof.UnlockLevel should be at least 0!");
  260. }*/
  261. if (getShockProofModifier() < 1) {
  262. reason.add("Skills.Taming.ShockProof.Modifier should be at least 1!");
  263. }
  264. /*if (getSharpenedClawsUnlock() < 0) {
  265. reason.add("Skills.Taming.SharpenedClaws.UnlockLevel should be at least 0!");
  266. }*/
  267. if (getSharpenedClawsBonus() < 1) {
  268. reason.add("Skills.Taming.SharpenedClaws.Bonus should be at least 1!");
  269. }
  270. if (getMaxHorseJumpStrength() < 0 || getMaxHorseJumpStrength() > 2) {
  271. reason.add("Skills.Taming.CallOfTheWild.MaxHorseJumpStrength should be between 0 and 2!");
  272. }
  273. /* UNARMED */
  274. if (getMaximumProbability(SubSkillType.UNARMED_DISARM) < 1) {
  275. reason.add("Skills.Unarmed.Disarm.ChanceMax should be at least 1!");
  276. }
  277. if (getMaxBonusLevel(SubSkillType.UNARMED_DISARM) < 1) {
  278. reason.add("Skills.Unarmed.Disarm.MaxBonusLevel should be at least 1!");
  279. }
  280. if (getMaximumProbability(SubSkillType.UNARMED_ARROW_DEFLECT) < 1) {
  281. reason.add("Skills.Unarmed.ArrowDeflect.ChanceMax should be at least 1!");
  282. }
  283. if (getMaxBonusLevel(SubSkillType.UNARMED_ARROW_DEFLECT) < 1) {
  284. reason.add("Skills.Unarmed.ArrowDeflect.MaxBonusLevel should be at least 1!");
  285. }
  286. if (getMaximumProbability(SubSkillType.UNARMED_IRON_GRIP) < 1) {
  287. reason.add("Skills.Unarmed.IronGrip.ChanceMax should be at least 1!");
  288. }
  289. if (getMaxBonusLevel(SubSkillType.UNARMED_IRON_GRIP) < 1) {
  290. reason.add("Skills.Unarmed.IronGrip.MaxBonusLevel should be at least 1!");
  291. }
  292. /* WOODCUTTING */
  293. /*if (getLeafBlowUnlockLevel() < 0) {
  294. reason.add("Skills.Woodcutting.LeafBlower.UnlockLevel should be at least 0!");
  295. }*/
  296. if (getMaximumProbability(SubSkillType.WOODCUTTING_HARVEST_LUMBER) < 1) {
  297. reason.add("Skills.Woodcutting.HarvestLumber.ChanceMax should be at least 1!");
  298. }
  299. if (getMaxBonusLevel(SubSkillType.WOODCUTTING_HARVEST_LUMBER) < 1) {
  300. reason.add("Skills.Woodcutting.HarvestLumber.MaxBonusLevel should be at least 1!");
  301. }
  302. return noErrorsInConfig(reason);
  303. }
  304. @Override
  305. protected void loadKeys() {
  306. }
  307. /* GENERAL */
  308. public boolean canApplyLimitBreakPVE() {
  309. return config.getBoolean("Skills.General.LimitBreak.AllowPVE", false);
  310. }
  311. public int getStartingLevel() {
  312. return config.getInt("Skills.General.StartingLevel", 1);
  313. }
  314. public boolean allowPlayerTips() {
  315. return config.getBoolean("Feedback.PlayerTips", true);
  316. }
  317. /**
  318. * This returns the maximum level at which superabilities will stop lengthening from scaling alongside skill level.
  319. * It returns a different value depending on whether the server is in retro mode
  320. *
  321. * @return the level at which abilities stop increasing in length
  322. */
  323. public int getAbilityLengthCap() {
  324. if (!mcMMO.isRetroModeEnabled())
  325. return config.getInt("Skills.General.Ability.Length.Standard.CapLevel", 50);
  326. else
  327. return config.getInt("Skills.General.Ability.Length.RetroMode.CapLevel", 500);
  328. }
  329. /**
  330. * This returns the frequency at which abilities will increase in length
  331. * It returns a different value depending on whether the server is in retro mode
  332. *
  333. * @return the number of levels required per ability length increase
  334. */
  335. public int getAbilityLength() {
  336. if (!mcMMO.isRetroModeEnabled())
  337. return config.getInt("Skills.General.Ability.Length.Standard.IncreaseLevel", 5);
  338. else
  339. return config.getInt("Skills.General.Ability.Length.RetroMode.IncreaseLevel", 50);
  340. }
  341. public int getEnchantBuff() {
  342. return config.getInt("Skills.General.Ability.EnchantBuff", 5);
  343. }
  344. /**
  345. * Grabs the max bonus level for a skill used in RNG calculations
  346. * All max level values in the config are multiplied by 10 if the server is in retro mode as the values in the config are based around the new 1-100 skill system scaling
  347. * A value of 10 in the file will be returned as 100 for retro mode servers to accommodate the change in scaling
  348. *
  349. * @param subSkillType target subskill
  350. *
  351. * @return the level at which this skills max benefits will be reached on the curve
  352. */
  353. public int getMaxBonusLevel(SubSkillType subSkillType) {
  354. String keyPath = subSkillType.getAdvConfigAddress() + ".MaxBonusLevel.";
  355. return mcMMO.isRetroModeEnabled() ? config.getInt(keyPath + "RetroMode", 1000) : config.getInt(keyPath + "Standard", 100);
  356. }
  357. public int getMaxBonusLevel(AbstractSubSkill abstractSubSkill) {
  358. return getMaxBonusLevel(abstractSubSkill.getSubSkillType());
  359. }
  360. public double getMaximumProbability(SubSkillType subSkillType) {
  361. return config.getDouble(subSkillType.getAdvConfigAddress() + ".ChanceMax", 100.0D);
  362. }
  363. public double getMaximumProbability(AbstractSubSkill abstractSubSkill) {
  364. return getMaximumProbability(abstractSubSkill.getSubSkillType());
  365. }
  366. /* Notification Settings */
  367. public boolean doesSkillCommandSendBlankLines() {
  368. return config.getBoolean("Feedback.SkillCommand.BlankLinesAboveHeader", true);
  369. }
  370. public boolean doesNotificationUseActionBar(NotificationType notificationType) {
  371. return config.getBoolean("Feedback.ActionBarNotifications." + notificationType.toString() + ".Enabled", true);
  372. }
  373. public boolean doesNotificationSendCopyToChat(NotificationType notificationType) {
  374. return config.getBoolean("Feedback.ActionBarNotifications." + notificationType.toString() + ".SendCopyOfMessageToChat", false);
  375. }
  376. public boolean useTitlesForXPEvent() {
  377. return config.getBoolean("Feedback.Events.XP.SendTitles", true);
  378. }
  379. public boolean sendAbilityNotificationToOtherPlayers() {
  380. return config.getBoolean("Feedback.Events.AbilityActivation.SendNotificationToOtherPlayers", true);
  381. }
  382. /*
  383. * JSON Style Settings
  384. */
  385. /*public ChatColor getJSONStatHoverElementColor(StatType statType, boolean isPrefix)
  386. {
  387. String keyAddress = isPrefix ? "Prefix" : "Value";
  388. String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Color";
  389. return getChatColorFromKey(keyLocation);
  390. }*/
  391. /**
  392. * Used to color our details header in our JSON Hover Object tooltips
  393. *
  394. * @return the ChatColor for this element
  395. */
  396. /*public ChatColor getJSONStatHoverDetailsColor()
  397. {
  398. String keyLocation = "Style.JSON.Hover.Details.Header.Color";
  399. return getChatColorFromKey(keyLocation);
  400. }
  401. public boolean isJSONDetailsHeaderBold()
  402. {
  403. return config.getBoolean("Style.JSON.Hover.Details.Header.Bold");
  404. }
  405. public boolean isJSONDetailsHeaderItalic()
  406. {
  407. return config.getBoolean("Style.JSON.Hover.Details.Header.Italics");
  408. }
  409. public boolean isJSONDetailsHeaderUnderlined()
  410. {
  411. return config.getBoolean("Style.JSON.Hover.Details.Header.Underlined");
  412. }
  413. public ChatColor getJSONStatHoverDescriptionColor()
  414. {
  415. String keyLocation = "Style.JSON.Hover.Details.Description.Color";
  416. return getChatColorFromKey(keyLocation);
  417. }
  418. public boolean isJSONDetailsDescriptionBold()
  419. {
  420. return config.getBoolean("Style.JSON.Hover.Details.Description.Bold");
  421. }
  422. public boolean isJSONDetailsDescriptionItalic()
  423. {
  424. return config.getBoolean("Style.JSON.Hover.Details.Description.Italics");
  425. }
  426. public boolean isJSONDetailsDescriptionUnderlined()
  427. {
  428. return config.getBoolean("Style.JSON.Hover.Details.Description.Underlined");
  429. }
  430. public ChatColor getJSONActionBarColor(NotificationType notificationType)
  431. {
  432. return getChatColor(config.getString("Style.JSON.Notification."+notificationType.toString()+".Color"));
  433. }*/
  434. private ChatColor getChatColorFromKey(String keyLocation) {
  435. String colorName = config.getString(keyLocation);
  436. return getChatColor(colorName);
  437. }
  438. private ChatColor getChatColor(String configColor) {
  439. for (ChatColor chatColor : ChatColor.values()) {
  440. if (configColor.equalsIgnoreCase(chatColor.getName()))
  441. return chatColor;
  442. }
  443. //Invalid Color
  444. mcMMO.p.getLogger().warning(configColor + " is an invalid color value");
  445. return ChatColor.WHITE;
  446. }
  447. /*public boolean isJSONStatHoverElementBold(StatType statType, boolean isPrefix)
  448. {
  449. String keyAddress = isPrefix ? "Prefix" : "Value";
  450. String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Bold";
  451. return config.getBoolean(keyLocation);
  452. }
  453. public boolean isJSONStatHoverElementItalic(StatType statType, boolean isPrefix)
  454. {
  455. String keyAddress = isPrefix ? "Prefix" : "Value";
  456. String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Italics";
  457. return config.getBoolean(keyLocation);
  458. }
  459. public boolean isJSONStatHoverElementUnderlined(StatType statType, boolean isPrefix)
  460. {
  461. String keyAddress = isPrefix ? "Prefix" : "Value";
  462. String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Underline";
  463. return config.getBoolean(keyLocation);
  464. }*/
  465. /**
  466. * Some SubSkills have the ability to retain classic functionality
  467. *
  468. * @param subSkillType SubSkillType with classic functionality
  469. *
  470. * @return true if the subskill is in classic mode
  471. */
  472. public boolean isSubSkillClassic(SubSkillType subSkillType) {
  473. return config.getBoolean(subSkillType.getAdvConfigAddress() + ".Classic");
  474. }
  475. /* ACROBATICS */
  476. public double getDodgeDamageModifier() {
  477. return config.getDouble("Skills.Acrobatics.Dodge.DamageModifier", 2.0D);
  478. }
  479. public double getRollDamageThreshold() {
  480. return config.getDouble("Skills.Acrobatics.Roll.DamageThreshold", 7.0D);
  481. }
  482. public double getGracefulRollDamageThreshold() {
  483. return config.getDouble("Skills.Acrobatics.GracefulRoll.DamageThreshold", 14.0D);
  484. }
  485. /* ALCHEMY */
  486. public int getCatalysisMaxBonusLevel() {
  487. if (mcMMO.isRetroModeEnabled()) {
  488. return config.getInt("Skills.Alchemy.Catalysis.MaxBonusLevel.RetroMode", 1000);
  489. } else {
  490. return config.getInt("Skills.Alchemy.Catalysis.MaxBonusLevel.Standard", 100);
  491. }
  492. }
  493. public double getCatalysisMinSpeed() {
  494. return config.getDouble("Skills.Alchemy.Catalysis.MinSpeed", 1.0D);
  495. }
  496. public double getCatalysisMaxSpeed() {
  497. return config.getDouble("Skills.Alchemy.Catalysis.MaxSpeed", 4.0D);
  498. }
  499. /* ARCHERY */
  500. public double getSkillShotRankDamageMultiplier() {
  501. return config.getDouble("Skills.Archery.SkillShot.RankDamageMultiplier", 10.0D);
  502. }
  503. public double getSkillShotDamageMax() {
  504. return config.getDouble("Skills.Archery.SkillShot.MaxDamage", 9.0D);
  505. }
  506. public double getDazeBonusDamage() {
  507. return config.getDouble("Skills.Archery.Daze.BonusDamage", 4.0D);
  508. }
  509. public double getForceMultiplier() {
  510. return config.getDouble("Skills.Archery.ForceMultiplier", 2.0D);
  511. }
  512. /* AXES */
  513. public double getAxeMasteryRankDamageMultiplier() {
  514. return config.getDouble("Skills.Axes.AxeMastery.RankDamageMultiplier", 1.0D);
  515. }
  516. public double getCriticalStrikesPVPModifier() {
  517. return config.getDouble("Skills.Axes.CriticalStrikes.PVP_Modifier", 1.5D);
  518. }
  519. public double getCriticalStrikesPVEModifier() {
  520. return config.getDouble("Skills.Axes.CriticalStrikes.PVE_Modifier", 2.0D);
  521. }
  522. public double getGreaterImpactChance() {
  523. return config.getDouble("Skills.Axes.GreaterImpact.Chance", 25.0D);
  524. }
  525. public double getGreaterImpactModifier() {
  526. return config.getDouble("Skills.Axes.GreaterImpact.KnockbackModifier", 1.5D);
  527. }
  528. public double getGreaterImpactBonusDamage() {
  529. return config.getDouble("Skills.Axes.GreaterImpact.BonusDamage", 2.0D);
  530. }
  531. public double getImpactChance() {
  532. return config.getDouble("Skills.Axes.ArmorImpact.Chance", 25.0D);
  533. }
  534. public double getImpactDurabilityDamageMultiplier() {
  535. return config.getDouble("Skills.Axes.ArmorImpact.DamagePerRank", 6.5D);
  536. }
  537. public double getSkullSplitterModifier() {
  538. return config.getDouble("Skills.Axes.SkullSplitter.DamageModifier", 2.0D);
  539. }
  540. /* EXCAVATION */
  541. //Nothing to configure, everything is already configurable in config.yml
  542. /* FISHING */
  543. public double getShakeChance(int rank) {
  544. return config.getDouble("Skills.Fishing.ShakeChance.Rank_" + rank);
  545. }
  546. public int getFishingVanillaXPModifier(int rank) {
  547. return config.getInt("Skills.Fishing.VanillaXPMultiplier.Rank_" + rank);
  548. }
  549. public int getFishingReductionMinWaitTicks() {
  550. return config.getInt("Skills.Fishing.MasterAngler.Tick_Reduction_Per_Rank.Min_Wait", 10);
  551. }
  552. public int getFishingReductionMaxWaitTicks() {
  553. return config.getInt("Skills.Fishing.MasterAngler.Tick_Reduction_Per_Rank.Max_Wait", 30);
  554. }
  555. public int getFishingBoatReductionMinWaitTicks() {
  556. return config.getInt("Skills.Fishing.MasterAngler.Boat_Tick_Reduction.Min_Wait", 10);
  557. }
  558. public int getFishingBoatReductionMaxWaitTicks() {
  559. return config.getInt("Skills.Fishing.MasterAngler.Boat_Tick_Reduction.Max_Wait", 30);
  560. }
  561. public int getFishingReductionMinWaitCap() {
  562. return config.getInt("Skills.Fishing.MasterAngler.Tick_Reduction_Caps.Min_Wait", 40);
  563. }
  564. public int getFishingReductionMaxWaitCap() {
  565. return config.getInt("Skills.Fishing.MasterAngler.Tick_Reduction_Caps.Max_Wait", 100);
  566. }
  567. public int getFishermanDietRankChange() {
  568. return config.getInt("Skills.Fishing.FishermansDiet.RankChange", 200);
  569. }
  570. public double getMasterAnglerBoatModifier() {
  571. return config.getDouble("Skills.Fishing.MasterAngler.BoatModifier", 2.0);
  572. }
  573. public double getMasterAnglerBiomeModifier() {
  574. return config.getDouble("Skills.Fishing.MasterAngler.BiomeModifier", 2.0);
  575. }
  576. /* HERBALISM */
  577. public int getFarmerDietRankChange() {
  578. return config.getInt("Skills.Herbalism.FarmersDiet.RankChange", 200);
  579. }
  580. public int getGreenThumbStageChange() {
  581. return config.getInt("Skills.Herbalism.GreenThumb.StageChange", 200);
  582. }
  583. /* MINING */
  584. public boolean getDoubleDropSilkTouchEnabled() {
  585. return config.getBoolean("Skills.Mining.DoubleDrops.SilkTouch", true);
  586. }
  587. public boolean getAllowMiningTripleDrops() {
  588. return config.getBoolean("Skills.Mining.SuperBreaker.AllowTripleDrops", true);
  589. }
  590. public int getBlastMiningRankLevel(int rank) {
  591. return config.getInt("Skills.Mining.BlastMining.Rank_Levels.Rank_" + rank);
  592. }
  593. public double getBlastDamageDecrease(int rank) {
  594. return config.getDouble("Skills.Mining.BlastMining.BlastDamageDecrease.Rank_" + rank);
  595. }
  596. public double getOreBonus(int rank) {
  597. return config.getDouble("Skills.Mining.BlastMining.OreBonus.Rank_" + rank);
  598. }
  599. public boolean isBlastMiningBonusDropsEnabled() {
  600. return config.getBoolean("Skills.Mining.BlastMining.Bonus_Drops.Enabled", true);
  601. }
  602. public double getDebrisReduction(int rank) {
  603. return config.getDouble("Skills.Mining.BlastMining.DebrisReduction.Rank_" + rank);
  604. }
  605. public int getDropMultiplier(int rank) {
  606. return config.getInt("Skills.Mining.BlastMining.DropMultiplier.Rank_" + rank);
  607. }
  608. public double getBlastRadiusModifier(int rank) {
  609. return config.getDouble("Skills.Mining.BlastMining.BlastRadiusModifier.Rank_" + rank);
  610. }
  611. /* REPAIR */
  612. public double getRepairMasteryMaxBonus() {
  613. return config.getDouble("Skills.Repair.RepairMastery.MaxBonusPercentage", 200.0D);
  614. }
  615. public int getRepairMasteryMaxLevel() {
  616. return config.getInt("Skills.Repair.RepairMastery.MaxBonusLevel", 100);
  617. }
  618. public boolean getAllowEnchantedRepairMaterials() {
  619. return config.getBoolean("Skills.Repair.Use_Enchanted_Materials", false);
  620. }
  621. public boolean getArcaneForgingEnchantLossEnabled() {
  622. return config.getBoolean("Skills.Repair.ArcaneForging.May_Lose_Enchants", true);
  623. }
  624. public double getArcaneForgingKeepEnchantsChance(int rank) {
  625. return config.getDouble("Skills.Repair.ArcaneForging.Keep_Enchants_Chance.Rank_" + rank);
  626. }
  627. public boolean getArcaneForgingDowngradeEnabled() {
  628. return config.getBoolean("Skills.Repair.ArcaneForging.Downgrades_Enabled", true);
  629. }
  630. public double getArcaneForgingDowngradeChance(int rank) {
  631. return config.getDouble("Skills.Repair.ArcaneForging.Downgrades_Chance.Rank_" + rank);
  632. }
  633. public boolean getArcaneSalvageEnchantDowngradeEnabled() {
  634. return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantDowngradeEnabled", true);
  635. }
  636. public boolean getArcaneSalvageEnchantLossEnabled() {
  637. return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantLossEnabled", true);
  638. }
  639. public double getArcaneSalvageExtractFullEnchantsChance(int rank) {
  640. return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + rank);
  641. }
  642. public double getArcaneSalvageExtractPartialEnchantsChance(int rank) {
  643. return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + rank);
  644. }
  645. /* SMELTING */
  646. public int getBurnModifierMaxLevel() {
  647. if (mcMMO.isRetroModeEnabled())
  648. return config.getInt("Skills.Smelting.FuelEfficiency.RetroMode.MaxBonusLevel", 1000);
  649. else
  650. return config.getInt("Skills.Smelting.FuelEfficiency.Standard.MaxBonusLevel", 100);
  651. }
  652. public double getFluxMiningChance() {
  653. return config.getDouble("Skills.Smelting.FluxMining.Chance", 33.0D);
  654. }
  655. /* SWORDS */
  656. public double getRuptureTickDamage(boolean isTargetPlayer, int rank) {
  657. String root = "Skills.Swords.Rupture.Rupture_Mechanics.Tick_Interval_Damage.Against_";
  658. String targetType = isTargetPlayer ? "Players" : "Mobs";
  659. String key = root + targetType + ".Rank_" + rank;
  660. return config.getDouble(key, 1.0D);
  661. }
  662. public int getRuptureDurationSeconds(boolean isTargetPlayer) {
  663. String root = "Skills.Swords.Rupture.Rupture_Mechanics.Duration_In_Seconds.Against_";
  664. String targetType = isTargetPlayer ? "Players" : "Mobs";
  665. return config.getInt(root + targetType, 5);
  666. }
  667. public double getRuptureExplosionDamage(boolean isTargetPlayer, int rank) {
  668. String root = "Skills.Swords.Rupture.Rupture_Mechanics.Explosion_Damage.Against_";
  669. String targetType = isTargetPlayer ? "Players" : "Mobs";
  670. String key = root + targetType + ".Rank_" + rank;
  671. return config.getDouble(key, 40.0D);
  672. }
  673. public double getRuptureChanceToApplyOnHit(int rank) {
  674. String root = "Skills.Swords.Rupture.Rupture_Mechanics.Chance_To_Apply_On_Hit.Rank_";
  675. return config.getDouble(root + rank, 33);
  676. }
  677. public double getCounterModifier() {
  678. return config.getDouble("Skills.Swords.CounterAttack.DamageModifier", 2.0D);
  679. }
  680. public double getSerratedStrikesModifier() {
  681. return config.getDouble("Skills.Swords.SerratedStrikes.DamageModifier", 4.0D);
  682. }
  683. public int getSerratedStrikesTicks() {
  684. return config.getInt("Skills.Swords.SerratedStrikes.RuptureTicks", 5);
  685. }
  686. /* TAMING */
  687. public double getGoreModifier() {
  688. return config.getDouble("Skills.Taming.Gore.Modifier", 2.0D);
  689. }
  690. public double getFastFoodChance() {
  691. return config.getDouble("Skills.Taming.FastFoodService.Chance", 50.0D);
  692. }
  693. public double getPummelChance() {
  694. return config.getDouble("Skills.Taming.Pummel.Chance", 10.0D);
  695. }
  696. public double getThickFurModifier() {
  697. return config.getDouble("Skills.Taming.ThickFur.Modifier", 2.0D);
  698. }
  699. public double getShockProofModifier() {
  700. return config.getDouble("Skills.Taming.ShockProof.Modifier", 6.0D);
  701. }
  702. public double getSharpenedClawsBonus() {
  703. return config.getDouble("Skills.Taming.SharpenedClaws.Bonus", 2.0D);
  704. }
  705. public double getMinHorseJumpStrength() {
  706. return config.getDouble("Skills.Taming.CallOfTheWild.MinHorseJumpStrength", 0.7D);
  707. }
  708. public double getMaxHorseJumpStrength() {
  709. return config.getDouble("Skills.Taming.CallOfTheWild.MaxHorseJumpStrength", 2.0D);
  710. }
  711. /* UNARMED */
  712. public boolean isSteelArmDamageCustom() {
  713. return config.getBoolean("Skills.Unarmed.SteelArmStyle.Damage_Override", false);
  714. }
  715. public double getSteelArmOverride(int rank, double def) {
  716. String key = "Rank_" + rank;
  717. return config.getDouble("Skills.Unarmed.SteelArmStyle.Override." + key, def);
  718. }
  719. public boolean getDisarmProtected() {
  720. return config.getBoolean("Skills.Unarmed.Disarm.AntiTheft", false);
  721. }
  722. /* WOODCUTTING */
  723. public boolean isKnockOnWoodXPOrbEnabled() {
  724. return config.getBoolean("Skills.Woodcutting.TreeFeller.Knock_On_Wood.Add_XP_Orbs_To_Drops", true);
  725. }
  726. }