diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index 27214c69a..7b5f5f898 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -67,15 +67,6 @@ public class AdvancedConfig extends ConfigLoaderConfigurable { reason.add("Skills.Acrobatics.GracefulRoll.DamageThreshold should be at least 0!"); } - /* ALCHEMY */ - /*if (getCatalysisUnlockLevel() < 0) { - reason.add("Skills.Alchemy.Catalysis.UnlockLevel should be at least 0!"); - } - - if (getCatalysisMaxBonusLevel() <= getCatalysisUnlockLevel()) { - reason.add("Skills.Alchemy.Catalysis.MaxBonusLevel should be greater than Skills.Alchemy.Catalysis.UnlockLevel!"); - }*/ - if (getCatalysisMinSpeed() <= 0) { reason.add("Skills.Alchemy.Catalysis.MinSpeed must be greater than 0!"); } @@ -84,21 +75,6 @@ public class AdvancedConfig extends ConfigLoaderConfigurable { reason.add("Skills.Alchemy.Catalysis.MaxSpeed should be at least Skills.Alchemy.Catalysis.MinSpeed!"); } - /*List alchemyTierList = Arrays.asList(Alchemy.Tier.values()); - for (Alchemy.Tier tier : alchemyTierList) { - if (getConcoctionsTierLevel(tier) < 0) { - reason.add("Skills.Alchemy.Rank_Levels.Rank_" + rank + " should be at least 0!"); - } - - if (tier != Alchemy.Tier.fromNumerical(Alchemy.Tier.values().length)) { - Alchemy.Tier nextTier = alchemyTierList.get(alchemyTierList.indexOf(tier) - 1); - - if (getConcoctionsTierLevel(tier) > getConcoctionsTierLevel(nextTier)) { - reason.add("Skills.Alchemy.Rank_Levels.Rank_" + rank + " should be less than or equal to Skills.Alchemy.Rank_Levels.Rank_" + nextrank + "!"); - } - } - }*/ - /* ARCHERY */ if (getSkillShotRankDamageMultiplier() <= 0) { @@ -179,51 +155,10 @@ public class AdvancedConfig extends ConfigLoaderConfigurable { reason.add("Skills.Axes.SkullSplitter.DamageModifier should be at least 1!"); } - /* FISHING */ - /*List fishingTierList = Arrays.asList(Fishing.Tier.values()); - - for (int rank : fishingTierList) { - if (getFishingTierLevel(tier) < 0) { - reason.add("Skills.Fishing.Rank_Levels.Rank_" + rank + " should be at least 0!"); - } - - if (getShakeChance(tier) < 0) { - reason.add("Skills.Fishing.Shake_Chance.Rank_" + rank + " should be at least 0!"); - } - - if (getFishingVanillaXPModifier(tier) < 0) { - reason.add("Skills.Fishing.VanillaXPMultiplier.Rank_" + rank + " should be at least 0!"); - } - - if (tier != Fishing.Tier.EIGHT) { - Fishing.Tier nextTier = fishingTierList.get(fishingTierList.indexOf(tier) - 1); - - if (getFishingTierLevel(tier) > getFishingTierLevel(nextTier)) { - reason.add("Skills.Fishing.Rank_Levels.Rank_" + rank + " should be less than or equal to Skills.Fishing.Rank_Levels.Rank_" + nextrank + "!"); - } - - if (getShakeChance(tier) > getShakeChance(nextTier)) { - reason.add("Skills.Fishing.Shake_Chance.Rank_" + rank + " should be less than or equal to Skills.Fishing.Shake_Chance.Rank_" + nextrank + "!"); - } - - if (getFishingVanillaXPModifier(tier) > getFishingVanillaXPModifier(nextTier)) { - reason.add("Skills.Fishing.VanillaXPMultiplier.Rank_" + rank + " should be less than or equal to Skills.Fishing.VanillaXPMultiplier.Rank_" + nextrank + "!"); - } - } - }*/ - if (getFishermanDietRankChange() < 1) { reason.add("Skills.Fishing.FishermansDiet.RankChange should be at least 1!"); } - /*if (getIceFishingUnlockLevel() < 0) { - reason.add("Skills.Fishing.IceFishing.UnlockLevel should be at least 0!"); - } - - if (getMasterAnglerUnlockLevel() < 0) { - reason.add("Skills.Fishing.MasterAngler.UnlockLevel should be at least 0!"); - }*/ - if (getMasterAnglerBoatModifier() < 1) { reason.add("Skills.Fishing.MasterAngler.BoatModifier should be at least 1!"); } @@ -282,62 +217,6 @@ public class AdvancedConfig extends ConfigLoaderConfigurable { reason.add("Skills.Mining.DoubleDrops.MaxBonusLevel should be at least 1!"); } - /*List blastMiningTierList = Arrays.asList(BlastMining.Tier.values()); - - for (int rank : blastMiningTierList) { - if (getBlastMiningRankLevel(tier) < 0) { - reason.add("Skills.Mining.BlastMining.Rank_Levels.Rank_" + rank + " should be at least 0!"); - } - - if (getBlastDamageDecrease(tier) < 0) { - reason.add("Skills.Mining.BlastMining.BlastDamageDecrease.Rank_" + rank + " should be at least 0!"); - } - - if (getOreBonus(tier) < 0) { - reason.add("Skills.Mining.BlastMining.OreBonus.Rank_" + rank + " should be at least 0!"); - } - - if (getDebrisReduction(tier) < 0) { - reason.add("Skills.Mining.BlastMining.DebrisReduction.Rank_" + rank + " should be at least 0!"); - } - - if (getDropMultiplier(tier) < 0) { - reason.add("Skills.Mining.BlastMining.DropMultiplier.Rank_" + rank + " should be at least 0!"); - } - - if (getBlastRadiusModifier(tier) < 0) { - reason.add("Skills.Mining.BlastMining.BlastRadiusModifier.Rank_" + rank + " should be at least 0!"); - } - - if (tier != BlastMining.Tier.EIGHT) { - BlastMining.Tier nextTier = blastMiningTierList.get(blastMiningTierList.indexOf(tier) - 1); - - if (getBlastMiningRankLevel(tier) > getBlastMiningRankLevel(nextTier)) { - reason.add("Skills.Mining.BlastMining.Rank_Levels.Rank_" + rank + " should be less than or equal to Skills.Mining.BlastMining.Rank_Levels.Rank_" + nextrank + "!"); - } - - if (getBlastDamageDecrease(tier) > getBlastDamageDecrease(nextTier)) { - reason.add("Skills.Mining.BlastMining.BlastDamageDecrease.Rank_" + rank + " should be less than or equal to Skills.Mining.BlastMining.BlastDamageDecrease.Rank_" + nextrank + "!"); - } - - if (getOreBonus(tier) > getOreBonus(nextTier)) { - reason.add("Skills.Mining.BlastMining.OreBonus.Rank_" + rank + " should be less than or equal to Skills.Mining.BlastMining.OreBonus.Rank_" + nextrank + "!"); - } - - if (getDebrisReduction(tier) > getDebrisReduction(nextTier)) { - reason.add("Skills.Mining.BlastMining.DebrisReduction.Rank_" + rank + " should be less than or equal to Skills.Mining.BlastMining.DebrisReduction.Rank_" + nextrank + "!"); - } - - if (getDropMultiplier(tier) > getDropMultiplier(nextTier)) { - reason.add("Skills.Mining.BlastMining.DropMultiplier.Rank_" + rank + " should be less than or equal to Skills.Mining.BlastMining.DropMultiplier.Rank_" + nextrank + "!"); - } - - if (getBlastRadiusModifier(tier) > getBlastRadiusModifier(nextTier)) { - reason.add("Skills.Mining.BlastMining.BlastRadiusModifier.Rank_" + rank + " should be less than or equal to Skills.Mining.BlastMining.BlastRadiusModifier.Rank_" + nextrank + "!"); - } - } - }*/ - /* REPAIR */ if (getRepairMasteryMaxBonus() < 1) { reason.add("Skills.Repair.RepairMastery.MaxBonusPercentage should be at least 1!"); @@ -355,83 +234,6 @@ public class AdvancedConfig extends ConfigLoaderConfigurable { reason.add("Skills.Repair.SuperRepair.MaxBonusLevel should be at least 1!"); } - /*List arcaneForgingTierList = Arrays.asList(ArcaneForging.Tier.values()); - - for (ArcaneForging.Tier tier : arcaneForgingTierList) { - if (getArcaneForgingRankLevel(tier) < 0) { - reason.add("Skills.Repair.ArcaneForging.Rank_Levels.Rank_" + rank + " should be at least 0!"); - } - - if (getArcaneForgingDowngradeChance(tier) < 0 || getArcaneForgingDowngradeChance(tier) > 100) { - reason.add("Skills.Repair.ArcaneForging.Downgrades.Chance.Rank_" + rank + " only accepts values from 0 to 100!"); - } - - if (getArcaneForgingKeepEnchantsChance(tier) < 0 || getArcaneForgingKeepEnchantsChance(tier) > 100) { - reason.add("Skills.Repair.ArcaneForging.Keep_Enchants.Chance.Rank_" + rank + " only accepts values from 0 to 100!"); - } - - if (tier != ArcaneForging.Tier.EIGHT) { - ArcaneForging.Tier nextTier = arcaneForgingTierList.get(arcaneForgingTierList.indexOf(tier) - 1); - - if (getArcaneForgingRankLevel(tier) > getArcaneForgingRankLevel(nextTier)) { - reason.add("Skills.Repair.ArcaneForging.Rank_Levels.Rank_" + rank + " should be less than or equal to Skills.Repair.ArcaneForging.Rank_Levels.Rank_" + nextrank + "!"); - } - - if (getArcaneForgingDowngradeChance(nextTier) > getArcaneForgingDowngradeChance(tier)) { - reason.add("Skills.Repair.ArcaneForging.Downgrades.Chance.Rank_" + nextrank + " should be less than or equal to Skills.Repair.ArcaneForging.Downgrades.Chance.Rank_" + rank + "!"); - } - - if (getArcaneForgingKeepEnchantsChance(tier) > getArcaneForgingKeepEnchantsChance(nextTier)) { - reason.add("Skills.Repair.ArcaneForging.Keep_Enchants.Chance.Rank_" + rank + " should be less than or equal to Skills.Repair.ArcaneForging.Keep_Enchants.Chance.Rank_" + nextrank + "!"); - } - } - }*/ - - /* SALVAGE */ - /*if (getSalvageMaxPercentage() < 1) { - reason.add("Skills.Salvage.MaxPercentage should be at least 1!"); - } - - if (getSalvageMaxPercentageLevel() < 1) { - reason.add("Skills.Salvage.MaxPercentageLevel should be at least 1!"); - }*/ - - /*if (getAdvancedSalvageUnlockLevel() < 0) { - reason.add("Skills.Salvage.AdvancedSalvage.UnlockLevel should be at least 0!"); - }*/ - - /*List salvageTierList = Arrays.asList(Salvage.Tier.values()); - - for (Salvage.Tier tier : salvageTierList) { - if (getArcaneSalvageRankLevel(tier) < 0) { - reason.add("Skills.Salvage.ArcaneSalvage.Rank_Levels.Rank_" + rank + " should be at least 0!"); - } - - if (getArcaneSalvageExtractFullEnchantsChance(tier) < 0 || getArcaneSalvageExtractFullEnchantsChance(tier) > 100) { - reason.add("Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + rank + " only accepts values from 0 to 100!"); - } - - if (getArcaneSalvageExtractPartialEnchantsChance(tier) < 0 || getArcaneSalvageExtractPartialEnchantsChance(tier) > 100) { - reason.add("Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + rank + " only accepts values from 0 to 100!"); - } - - if (tier != Salvage.Tier.EIGHT) { - Salvage.Tier nextTier = salvageTierList.get(salvageTierList.indexOf(tier) - 1); - - if (getArcaneSalvageRankLevel(tier) > getArcaneSalvageRankLevel(nextTier)) { - reason.add("Skills.Salvage.ArcaneSalvage.Rank_Levels.Rank_" + rank + " should be less than or equal to Skills.Salvage.ArcaneSalvage.Rank_Levels.Rank_" + nextrank + "!"); - } - - if (getArcaneSalvageExtractFullEnchantsChance(tier) > getArcaneSalvageExtractFullEnchantsChance(nextTier)) { - reason.add("Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + rank + " should be less than or equal to Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + nextrank + "!"); - } - - if (getArcaneSalvageExtractPartialEnchantsChance(tier) > getArcaneSalvageExtractPartialEnchantsChance(nextTier)) { - reason.add("Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + rank + " should be less than or equal to Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + nextrank + "!"); - } - } - }*/ - /* SMELTING */ if (getBurnModifierMaxLevel() < 1) { reason.add("Skills.Smelting.FuelEfficiency.MaxBonusLevel should be at least 1!"); @@ -445,38 +247,10 @@ public class AdvancedConfig extends ConfigLoaderConfigurable { reason.add("Skills.Smelting.SecondSmelt.ChanceMax should be at least 1!"); } - /*if (getFluxMiningUnlockLevel() < 0) { - reason.add("Skills.Smelting.FluxMining.UnlockLevel should be at least 0!"); - }*/ - if (getFluxMiningChance() < 1) { reason.add("Skills.Smelting.FluxMining.Chance should be at least 1!"); } - /*List smeltingTierList = Arrays.asList(Smelting.Tier.values()); - - for (int rank : smeltingTierList) { - if (getSmeltingRankLevel(tier) < 0) { - reason.add("Skills.Smelting.Rank_Levels.Rank_" + rank + " should be at least 0!"); - } - - if (getSmeltingVanillaXPBoostMultiplier(tier) < 1) { - reason.add("Skills.Smelting.VanillaXPMultiplier.Rank_" + rank + " should be at least 1!"); - } - - if (tier != Smelting.Tier.EIGHT) { - Smelting.Tier nextTier = smeltingTierList.get(smeltingTierList.indexOf(tier) - 1); - - if (getSmeltingRankLevel(tier) > getSmeltingRankLevel(nextTier)) { - reason.add("Skills.Smelting.Rank_Levels.Rank_" + rank + " should be less than or equal to Skills.Smelting.Rank_Levels.Rank_" + nextrank + "!"); - } - - if (getSmeltingVanillaXPBoostMultiplier(tier) > getSmeltingVanillaXPBoostMultiplier(nextTier)) { - reason.add("Skills.Smelting.VanillaXPMultiplier.Rank_" + rank + " should be less than or equal to Skills.Smelting.VanillaXPMultiplier.Rank_" + nextrank + "!"); - } - } - }*/ - /* SWORDS */ if (getMaximumProbability(SubSkillType.SWORDS_RUPTURE) < 1) { reason.add("Skills.Swords.Rupture.ChanceMax should be at least 1!"); @@ -528,50 +302,22 @@ public class AdvancedConfig extends ConfigLoaderConfigurable { reason.add("Skills.Taming.Gore.MaxBonusLevel should be at least 1!"); } - /*if (getGoreRuptureTicks() < 1) { - reason.add("Skills.Taming.Gore.RuptureTicks should be at least 1!"); - }*/ - if (getGoreModifier() < 1) { reason.add("Skills.Taming.Gore.Modifier should be at least 1!"); } - /*if (getFastFoodUnlock() < 0) { - reason.add("Skills.Taming.FastFood.UnlockLevel should be at least 0!"); - }*/ - if (getFastFoodChance() < 1) { reason.add("Skills.Taming.FastFood.Chance should be at least 1!"); } - /*if (getEnviromentallyAwareUnlock() < 0) { - reason.add("Skills.Taming.EnvironmentallyAware.UnlockLevel should be at least 0!"); - }*/ - - /*if (getThickFurUnlock() < 0) { - reason.add("Skills.Taming.ThickFur.UnlockLevel should be at least 0!"); - }*/ - if (getThickFurModifier() < 1) { reason.add("Skills.Taming.ThickFur.Modifier should be at least 1!"); } - /*if (getHolyHoundUnlock() < 0) { - reason.add("Skills.Taming.HolyHound.UnlockLevel should be at least 0!"); - } - - if (getShockProofUnlock() < 0) { - reason.add("Skills.Taming.ShockProof.UnlockLevel should be at least 0!"); - }*/ - if (getShockProofModifier() < 1) { reason.add("Skills.Taming.ShockProof.Modifier should be at least 1!"); } - /*if (getSharpenedClawsUnlock() < 0) { - reason.add("Skills.Taming.SharpenedClaws.UnlockLevel should be at least 0!"); - }*/ - if (getSharpenedClawsBonus() < 1) { reason.add("Skills.Taming.SharpenedClaws.Bonus should be at least 1!"); } @@ -619,28 +365,11 @@ public class AdvancedConfig extends ConfigLoaderConfigurable { reason.add("Skills.Woodcutting.HarvestLumber.MaxBonusLevel should be at least 1!"); } - /* KRAKEN */ - if (getKrakenTriesBeforeRelease() < 1) { - reason.add("Kraken.Tries_Before_Release should be at least 1!"); - } - - if (getKrakenHealth() < 1) { - reason.add("Kraken.Health should be at least 1!"); - } - - if (getKrakenAttackInterval() < 1) { - reason.add("Kraken.Attack_Interval_Seconds should be at least 1!"); - } - - if (getKrakenAttackDamage() < 1) { - reason.add("Kraken.Attack_Damage should be at least 1!"); - } - return reason; } /* GENERAL */ - public int getStartingLevel() { return config.getInt("Skills.General.StartingLevel", 1); } + public int getStartingLevel() { return getIntValue("Skills.General.StartingLevel"); } /** * This returns the maximum level at which superabilities will stop lengthening from scaling alongside skill level. @@ -649,9 +378,9 @@ public class AdvancedConfig extends ConfigLoaderConfigurable { */ public int getAbilityLengthCap() { if(!mcMMO.isRetroModeEnabled()) - return config.getInt("Skills.General.Ability.Length.Standard.CapLevel", 50); + return getIntValue("Skills.General.Ability.Length.Standard.CapLevel"); else - return config.getInt("Skills.General.Ability.Length.RetroMode.CapLevel", 500); + return getIntValue("Skills.General.Ability.Length.RetroMode.CapLevel"); } /** @@ -661,12 +390,12 @@ public class AdvancedConfig extends ConfigLoaderConfigurable { */ public int getAbilityLength() { if(!mcMMO.isRetroModeEnabled()) - return config.getInt("Skills.General.Ability.Length.Standard.IncreaseLevel", 5); + return getIntValue("Skills.General.Ability.Length.Standard.IncreaseLevel"); else - return config.getInt("Skills.General.Ability.Length.RetroMode.IncreaseLevel", 50); + return getIntValue("Skills.General.Ability.Length.RetroMode.IncreaseLevel"); } - public int getEnchantBuff() { return config.getInt("Skills.General.Ability.EnchantBuff", 5); } + public int getEnchantBuff() { return getIntValue("Skills.General.Ability.EnchantBuff"); } /** * Grabs the max bonus level for a skill used in RNG calculations @@ -677,7 +406,7 @@ public class AdvancedConfig extends ConfigLoaderConfigurable { */ public int getMaxBonusLevel(SubSkillType subSkillType) { String keyPath = subSkillType.getAdvConfigAddress() + ".MaxBonusLevel."; - return mcMMO.isRetroModeEnabled() ? config.getInt(keyPath+"RetroMode", 1000) : config.getInt(keyPath+"Standard", 100); + return mcMMO.isRetroModeEnabled() ? getIntValue(keyPath+"RetroMode") : getIntValue(keyPath+"Standard"); } public int getMaxBonusLevel(AbstractSubSkill abstractSubSkill) { @@ -685,7 +414,7 @@ public class AdvancedConfig extends ConfigLoaderConfigurable { } public double getMaximumProbability(SubSkillType subSkillType) { - double maximumProbability = config.getDouble(subSkillType.getAdvConfigAddress() + ".ChanceMax", 100.0D); + double maximumProbability = getDoubleValue(subSkillType.getAdvConfigAddress() + ".ChanceMax"); return maximumProbability; } @@ -699,90 +428,26 @@ public class AdvancedConfig extends ConfigLoaderConfigurable { public boolean doesSkillCommandSendBlankLines() { - return config.getBoolean("Feedback.SkillCommand.BlankLinesAboveHeader", true); + return getBooleanValue("Feedback.SkillCommand.BlankLinesAboveHeader"); } public boolean doesNotificationUseActionBar(NotificationType notificationType) { - return config.getBoolean("Feedback.ActionBarNotifications."+notificationType.toString()+".Enabled", true); + return getBooleanValue("Feedback.ActionBarNotifications."+notificationType.toString()+".Enabled"); } public boolean doesNotificationSendCopyToChat(NotificationType notificationType) { - return config.getBoolean("Feedback.ActionBarNotifications."+notificationType.toString()+".SendCopyOfMessageToChat", false); + return getBooleanValue("Feedback.ActionBarNotifications."+notificationType.toString()+".SendCopyOfMessageToChat"); } public boolean useTitlesForXPEvent() { - return config.getBoolean("Feedback.Events.XP.SendTitles", true); + return getBooleanValue("Feedback.Events.XP.SendTitles"); } - /* - * JSON Style Settings - */ - - - /*public ChatColor getJSONStatHoverElementColor(StatType statType, boolean isPrefix) - { - String keyAddress = isPrefix ? "Prefix" : "Value"; - String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Color"; - - return getChatColorFromKey(keyLocation); - }*/ - - /** - * Used to color our details header in our JSON Hover Object tooltips - * @return the ChatColor for this element - */ - /*public ChatColor getJSONStatHoverDetailsColor() - { - String keyLocation = "Style.JSON.Hover.Details.Header.Color"; - return getChatColorFromKey(keyLocation); - } - - public boolean isJSONDetailsHeaderBold() - { - return config.getBoolean("Style.JSON.Hover.Details.Header.Bold"); - } - - public boolean isJSONDetailsHeaderItalic() - { - return config.getBoolean("Style.JSON.Hover.Details.Header.Italics"); - } - - public boolean isJSONDetailsHeaderUnderlined() - { - return config.getBoolean("Style.JSON.Hover.Details.Header.Underlined"); - } - - public ChatColor getJSONStatHoverDescriptionColor() - { - String keyLocation = "Style.JSON.Hover.Details.Description.Color"; - return getChatColorFromKey(keyLocation); - } - - public boolean isJSONDetailsDescriptionBold() - { - return config.getBoolean("Style.JSON.Hover.Details.Description.Bold"); - } - - public boolean isJSONDetailsDescriptionItalic() - { - return config.getBoolean("Style.JSON.Hover.Details.Description.Italics"); - } - - public boolean isJSONDetailsDescriptionUnderlined() - { - return config.getBoolean("Style.JSON.Hover.Details.Description.Underlined"); - } - - public ChatColor getJSONActionBarColor(NotificationType notificationType) - { - return getChatColor(config.getString("Style.JSON.Notification."+notificationType.toString()+".Color")); - }*/ - private ChatColor getChatColorFromKey(String keyLocation) { - String colorName = config.getString(keyLocation); + String colorName = getStringValue(keyLocation); return getChatColor(colorName); } @@ -798,27 +463,6 @@ public class AdvancedConfig extends ConfigLoaderConfigurable { return ChatColor.WHITE; } - /*public boolean isJSONStatHoverElementBold(StatType statType, boolean isPrefix) - { - String keyAddress = isPrefix ? "Prefix" : "Value"; - String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Bold"; - return config.getBoolean(keyLocation); - } - - public boolean isJSONStatHoverElementItalic(StatType statType, boolean isPrefix) - { - String keyAddress = isPrefix ? "Prefix" : "Value"; - String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Italics"; - return config.getBoolean(keyLocation); - } - - public boolean isJSONStatHoverElementUnderlined(StatType statType, boolean isPrefix) - { - String keyAddress = isPrefix ? "Prefix" : "Value"; - String keyLocation = "Style.JSON.Hover.Details." + StringUtils.getCapitalized(statType.toString()) +"."+keyAddress+".Underline"; - return config.getBoolean(keyLocation); - }*/ - /** * Some SubSkills have the ability to retain classic functionality * @param subSkillType SubSkillType with classic functionality @@ -826,45 +470,42 @@ public class AdvancedConfig extends ConfigLoaderConfigurable { */ public boolean isSubSkillClassic(SubSkillType subSkillType) { - return config.getBoolean(subSkillType.getAdvConfigAddress()+".Classic"); + return getBooleanValue(subSkillType.getAdvConfigAddress()+".Classic"); } /* ACROBATICS */ - public double getDodgeDamageModifier() { return config.getDouble("Skills.Acrobatics.Dodge.DamageModifier", 2.0D); } + public double getDodgeDamageModifier() { return getDoubleValue("Skills.Acrobatics.Dodge.DamageModifier"); } - public double getRollDamageThreshold() { return config.getDouble("Skills.Acrobatics.Roll.DamageThreshold", 7.0D); } + public double getRollDamageThreshold() { return getDoubleValue("Skills.Acrobatics.Roll.DamageThreshold"); } - public double getGracefulRollDamageThreshold() { return config.getDouble("Skills.Acrobatics.GracefulRoll.DamageThreshold", 14.0D); } + public double getGracefulRollDamageThreshold() { return getDoubleValue("Skills.Acrobatics.GracefulRoll.DamageThreshold"); } /* ALCHEMY */ - /*public int getCatalysisUnlockLevel() { return config.getInt("Skills.Alchemy.Catalysis.UnlockLevel", 100); }*/ - public int getCatalysisMaxBonusLevel() { return config.getInt("Skills.Alchemy.Catalysis.MaxBonusLevel", 1000); } + public int getCatalysisMaxBonusLevel() { return getIntValue("Skills.Alchemy.Catalysis.MaxBonusLevel"); } - public double getCatalysisMinSpeed() { return config.getDouble("Skills.Alchemy.Catalysis.MinSpeed", 1.0D); } - public double getCatalysisMaxSpeed() { return config.getDouble("Skills.Alchemy.Catalysis.MaxSpeed", 4.0D); } - - //public int getConcoctionsTierLevel(Alchemy.Tier tier) { return config.getInt("Skills.Alchemy.Rank_Levels.Rank_" + rank); } + public double getCatalysisMinSpeed() { return getDoubleValue("Skills.Alchemy.Catalysis.MinSpeed"); } + public double getCatalysisMaxSpeed() { return getDoubleValue("Skills.Alchemy.Catalysis.MaxSpeed"); } /* ARCHERY */ - public double getSkillShotRankDamageMultiplier() { return config.getDouble("Skills.Archery.SkillShot.RankDamageMultiplier", 10.0D); } - public double getSkillShotDamageMax() { return config.getDouble("Skills.Archery.SkillShot.MaxDamage", 9.0D); } + public double getSkillShotRankDamageMultiplier() { return getDoubleValue("Skills.Archery.SkillShot.RankDamageMultiplier"); } + public double getSkillShotDamageMax() { return getDoubleValue("Skills.Archery.SkillShot.MaxDamage"); } - public double getDazeBonusDamage() { return config.getDouble("Skills.Archery.Daze.BonusDamage", 4.0D); } + public double getDazeBonusDamage() { return getDoubleValue("Skills.Archery.Daze.BonusDamage"); } - public double getForceMultiplier() { return config.getDouble("Skills.Archery.ForceMultiplier", 2.0D); } + public double getForceMultiplier() { return getDoubleValue("Skills.Archery.ForceMultiplier"); } /* AXES */ - public double getAxeMasteryRankDamageMultiplier() { return config.getDouble("Skills.Axes.AxeMastery.RankDamageMultiplier", 1.0D); } + public double getAxeMasteryRankDamageMultiplier() { return getDoubleValue("Skills.Axes.AxeMastery.RankDamageMultiplier"); } - public double getCriticalStrikesPVPModifier() { return config.getDouble("Skills.Axes.CriticalStrikes.PVP_Modifier", 1.5D); } - public double getCriticalStrikesPVEModifier() { return config.getDouble("Skills.Axes.CriticalStrikes.PVE_Modifier", 2.0D); } + public double getCriticalStrikesPVPModifier() { return getDoubleValue("Skills.Axes.CriticalStrikes.PVP_Modifier"); } + public double getCriticalStrikesPVEModifier() { return getDoubleValue("Skills.Axes.CriticalStrikes.PVE_Modifier"); } - public double getGreaterImpactChance() { return config.getDouble("Skills.Axes.GreaterImpact.Chance", 25.0D); } - public double getGreaterImpactModifier() { return config.getDouble("Skills.Axes.GreaterImpact.KnockbackModifier", 1.5D); } - public double getGreaterImpactBonusDamage() { return config.getDouble("Skills.Axes.GreaterImpact.BonusDamage", 2.0D); } + public double getGreaterImpactChance() { return getDoubleValue("Skills.Axes.GreaterImpact.Chance"); } + public double getGreaterImpactModifier() { return getDoubleValue("Skills.Axes.GreaterImpact.KnockbackModifier"); } + public double getGreaterImpactBonusDamage() { return getDoubleValue("Skills.Axes.GreaterImpact.BonusDamage"); } public int getArmorImpactIncreaseLevel() { - int increaseLevel = config.getInt("Skills.Axes.ArmorImpact.IncreaseLevel", 5); + int increaseLevel = getIntValue("Skills.Axes.ArmorImpact.IncreaseLevel"); if(mcMMO.isRetroModeEnabled()) return increaseLevel * 10; @@ -872,31 +513,25 @@ public class AdvancedConfig extends ConfigLoaderConfigurable { return increaseLevel; } - public double getImpactChance() { return config.getDouble("Skills.Axes.ArmorImpact.Chance", 25.0D); } - public double getArmorImpactMaxDurabilityDamage() { return config.getDouble("Skills.Axes.ArmorImpact.MaxPercentageDurabilityDamage", 20.0D); } + public double getImpactChance() { return getDoubleValue("Skills.Axes.ArmorImpact.Chance"); } + public double getArmorImpactMaxDurabilityDamage() { return getDoubleValue("Skills.Axes.ArmorImpact.MaxPercentageDurabilityDamage"); } - public double getSkullSplitterModifier() { return config.getDouble("Skills.Axes.SkullSplitter.DamageModifier", 2.0D); } + public double getSkullSplitterModifier() { return getDoubleValue("Skills.Axes.SkullSplitter.DamageModifier"); } /* EXCAVATION */ //Nothing to configure, everything is already configurable in config.yml /* FISHING */ - //public int getFishingTierLevel(int rank) { return config.getInt("Skills.Fishing.Rank_Levels.Rank_" + rank); } - public double getShakeChance(int rank) { return config.getDouble("Skills.Fishing.ShakeChance.Rank_" + rank); } - public int getFishingVanillaXPModifier(int rank) { return config.getInt("Skills.Fishing.VanillaXPMultiplier.Rank_" + rank); } - - public int getFishermanDietRankChange() { return config.getInt("Skills.Fishing.FishermansDiet.RankChange", 200); } - - /*public int getIceFishingUnlockLevel() { return config.getInt("Skills.Fishing.IceFishing.UnlockLevel", 50); } - - public int getMasterAnglerUnlockLevel() {return config.getInt("Skills.Fishing.MasterAngler.UnlockLevel", 125); }*/ - public double getMasterAnglerBoatModifier() {return config.getDouble("Skills.Fishing.MasterAngler.BoatModifier", 2.0); } - public double getMasterAnglerBiomeModifier() {return config.getDouble("Skills.Fishing.MasterAngler.BiomeModifier", 2.0); } + public double getShakeChance(int rank) { return getDoubleValue("Skills.Fishing.ShakeChance.Rank_" + rank); } + public int getFishingVanillaXPModifier(int rank) { return getIntValue("Skills.Fishing.VanillaXPMultiplier.Rank_" + rank); } + public int getFishermanDietRankChange() { return getIntValue("Skills.Fishing.FishermansDiet.RankChange"); } + public double getMasterAnglerBoatModifier() {return getDoubleValue("Skills.Fishing.MasterAngler.BoatModifier"); } + public double getMasterAnglerBiomeModifier() {return getDoubleValue("Skills.Fishing.MasterAngler.BiomeModifier"); } /* HERBALISM */ - public int getFarmerDietRankChange() { return config.getInt("Skills.Herbalism.FarmersDiet.RankChange", 200); } + public int getFarmerDietRankChange() { return getIntValue("Skills.Herbalism.FarmersDiet.RankChange"); } - public int getGreenThumbStageChange() { return config.getInt("Skills.Herbalism.GreenThumb.StageChange", 200); } + public int getGreenThumbStageChange() { return getIntValue("Skills.Herbalism.GreenThumb.StageChange"); } /* MINING */ public boolean getDoubleDropSilkTouchEnabled() { return config.getBoolean("Skills.Mining.DoubleDrops.SilkTouch", true); } @@ -908,98 +543,60 @@ public class AdvancedConfig extends ConfigLoaderConfigurable { public double getBlastRadiusModifier(int rank) { return config.getDouble("Skills.Mining.BlastMining.BlastRadiusModifier.Rank_" + rank); } /* REPAIR */ - public double getRepairMasteryMaxBonus() { return config.getDouble("Skills.Repair.RepairMastery.MaxBonusPercentage", 200.0D); } - public int getRepairMasteryMaxLevel() { return config.getInt("Skills.Repair.RepairMastery.MaxBonusLevel", 100); } + public double getRepairMasteryMaxBonus() { return getDoubleValue("Skills.Repair.RepairMastery.MaxBonusPercentage"); } + public int getRepairMasteryMaxLevel() { return getIntValue("Skills.Repair.RepairMastery.MaxBonusLevel"); } /* Arcane Forging */ - //public int getArcaneForgingRankLevel(int rank) { return config.getInt("Skills.Repair.ArcaneForging.Rank_Levels.Rank_" + rank); } + public boolean getArcaneForgingEnchantLossEnabled() { return getBooleanValue("Skills.Repair.ArcaneForging.May_Lose_Enchants"); } + public double getArcaneForgingKeepEnchantsChance(int rank) { return getDoubleValue("Skills.Repair.ArcaneForging.Keep_Enchants_Chance.Rank_" + rank); } - public boolean getArcaneForgingEnchantLossEnabled() { return config.getBoolean("Skills.Repair.ArcaneForging.May_Lose_Enchants", true); } - public double getArcaneForgingKeepEnchantsChance(int rank) { return config.getDouble("Skills.Repair.ArcaneForging.Keep_Enchants_Chance.Rank_" + rank); } - - public boolean getArcaneForgingDowngradeEnabled() { return config.getBoolean("Skills.Repair.ArcaneForging.Downgrades_Enabled", true); } - public double getArcaneForgingDowngradeChance(int rank) { return config.getDouble("Skills.Repair.ArcaneForging.Downgrades_Chance.Rank_" + rank); } + public boolean getArcaneForgingDowngradeEnabled() { return getBooleanValue("Skills.Repair.ArcaneForging.Downgrades_Enabled"); } + public double getArcaneForgingDowngradeChance(int rank) { return getDoubleValue("Skills.Repair.ArcaneForging.Downgrades_Chance.Rank_" + rank); } /* SALVAGE */ - //public double getSalvageMaxPercentage() { return config.getDouble("Skills.Salvage.MaxPercentage", 100.0D); } - //public int getSalvageMaxPercentageLevel() { return config.getInt("Skills.Salvage.MaxPercentageLevel", 1000); } - public boolean getArcaneSalvageEnchantDowngradeEnabled() { return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantDowngradeEnabled", true); } - public boolean getArcaneSalvageEnchantLossEnabled() { return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantLossEnabled", true); } + public boolean getArcaneSalvageEnchantDowngradeEnabled() { return getBooleanValue("Skills.Salvage.ArcaneSalvage.EnchantDowngradeEnabled"); } + public boolean getArcaneSalvageEnchantLossEnabled() { return getBooleanValue("Skills.Salvage.ArcaneSalvage.EnchantLossEnabled"); } - //public int getArcaneSalvageRankLevel(int rank) { return config.getInt("Skills.Salvage.ArcaneSalvage.Rank_Levels.Rank_" + rank); } - public double getArcaneSalvageExtractFullEnchantsChance(int rank) { return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + rank); } - public double getArcaneSalvageExtractPartialEnchantsChance(int rank) { return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + rank); } + public double getArcaneSalvageExtractFullEnchantsChance(int rank) { return getDoubleValue("Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + rank); } + public double getArcaneSalvageExtractPartialEnchantsChance(int rank) { return getDoubleValue("Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + rank); } /* SMELTING */ - public int getBurnModifierMaxLevel() { - if(mcMMO.isRetroModeEnabled()) - return config.getInt("Skills.Smelting.FuelEfficiency.RetroMode.MaxBonusLevel", 1000); - else - return config.getInt("Skills.Smelting.FuelEfficiency.Standard.MaxBonusLevel", 100); - } + public int getBurnModifierMaxLevel() { return getIntValue("Skills.Smelting.FuelEfficiency.MaxBonusLevel"); } + public double getBurnTimeMultiplier() { return getDoubleValue("Skills.Smelting.FuelEfficiency.Multiplier"); } - /*public int getFluxMiningUnlockLevel() { return config.getInt("Skills.Smelting.FluxMining.UnlockLevel", 250); }*/ - public double getFluxMiningChance() { return config.getDouble("Skills.Smelting.FluxMining.Chance", 33.0D); } + public double getFluxMiningChance() { return getDoubleValue("Skills.Smelting.FluxMining.Chance"); } - public int getSmeltingRankLevel(int rank) { return config.getInt("Skills.Smelting.Rank_Levels.Rank_" + rank); } + public int getSmeltingRankLevel(int rank) { return getIntValue("Skills.Smelting.Rank_Levels.Rank_" + rank); } - public int getSmeltingVanillaXPBoostMultiplier(int rank) { return config.getInt("Skills.Smelting.VanillaXPMultiplier.Rank_" + rank); } + public int getSmeltingVanillaXPBoostMultiplier(int rank) { return getIntValue("Skills.Smelting.VanillaXPMultiplier.Rank_" + rank); } /* SWORDS */ - public double getRuptureDamagePlayer() { return config.getDouble("Skills.Swords.Rupture.DamagePlayer", 1.0); } - public double getRuptureDamageMobs() { return config.getDouble("Skills.Swords.Rupture.DamageMobs", 2.0); } + public double getRuptureDamagePlayer() { return getDoubleValue("Skills.Swords.Rupture.DamagePlayer"); } + public double getRuptureDamageMobs() { return getDoubleValue("Skills.Swords.Rupture.DamageMobs"); } - public int getRuptureMaxTicks() { return config.getInt("Skills.Swords.Rupture.MaxTicks", 8); } - public int getRuptureBaseTicks() { return config.getInt("Skills.Swords.Rupture.BaseTicks", 2); } + public int getRuptureMaxTicks() { return getIntValue("Skills.Swords.Rupture.MaxTicks"); } + public int getRuptureBaseTicks() { return getIntValue("Skills.Swords.Rupture.BaseTicks"); } - public double getCounterModifier() { return config.getDouble("Skills.Swords.CounterAttack.DamageModifier", 2.0D); } + public double getCounterModifier() { return getDoubleValue("Skills.Swords.CounterAttack.DamageModifier"); } - public double getSerratedStrikesModifier() { return config.getDouble("Skills.Swords.SerratedStrikes.DamageModifier", 4.0D); } - public int getSerratedStrikesTicks() { return config.getInt("Skills.Swords.SerratedStrikes.RuptureTicks", 5); } + public double getSerratedStrikesModifier() { return getDoubleValue("Skills.Swords.SerratedStrikes.DamageModifier"); } + public int getSerratedStrikesTicks() { return getIntValue("Skills.Swords.SerratedStrikes.RuptureTicks"); } /* TAMING */ - //public int getGoreRuptureTicks() { return config.getInt("Skills.Taming.Gore.RuptureTicks", 2); } - public double getGoreModifier() { return config.getDouble("Skills.Taming.Gore.Modifier", 2.0D); } + public double getGoreModifier() { return getDoubleValue("Skills.Taming.Gore.Modifier"); } + public double getFastFoodChance() { return getDoubleValue("Skills.Taming.FastFoodService.Chance"); } + public double getPummelChance() { return getDoubleValue("Skills.Taming.Pummel.Chance"); } + public double getThickFurModifier() { return getDoubleValue("Skills.Taming.ThickFur.Modifier"); } + public double getShockProofModifier() { return getDoubleValue("Skills.Taming.ShockProof.Modifier"); } - /*public int getFastFoodUnlock() { return config.getInt("Skills.Taming.FastFood.UnlockLevel", 50); }*/ - public double getFastFoodChance() { return config.getDouble("Skills.Taming.FastFoodService.Chance", 50.0D); } - public double getPummelChance() { return config.getDouble("Skills.Taming.Pummel.Chance", 10.0D); } + public double getSharpenedClawsBonus() { return getDoubleValue("Skills.Taming.SharpenedClaws.Bonus"); } - //public int getEnviromentallyAwareUnlock() { return config.getInt("Skills.Taming.EnvironmentallyAware.UnlockLevel", 100); } - - /*public int getThickFurUnlock() { return config.getInt("Skills.Taming.ThickFur.UnlockLevel", 250); }*/ - public double getThickFurModifier() { return config.getDouble("Skills.Taming.ThickFur.Modifier", 2.0D); } - - /*public int getHolyHoundUnlock() {return config.getInt("Skills.Taming.HolyHound.UnlockLevel", 375); }*/ - - /*public int getShockProofUnlock() { return config.getInt("Skills.Taming.ShockProof.UnlockLevel", 500); }*/ - public double getShockProofModifier() { return config.getDouble("Skills.Taming.ShockProof.Modifier", 6.0D); } - - /*public int getSharpenedClawsUnlock() { return config.getInt("Skills.Taming.SharpenedClaws.UnlockLevel", 750); }*/ - public double getSharpenedClawsBonus() { return config.getDouble("Skills.Taming.SharpenedClaws.Bonus", 2.0D); } - - public double getMinHorseJumpStrength() { return config.getDouble("Skills.Taming.CallOfTheWild.MinHorseJumpStrength", 0.7D); } - public double getMaxHorseJumpStrength() { return config.getDouble("Skills.Taming.CallOfTheWild.MaxHorseJumpStrength", 2.0D); } + public double getMinHorseJumpStrength() { return getDoubleValue("Skills.Taming.CallOfTheWild.MinHorseJumpStrength"); } + public double getMaxHorseJumpStrength() { return getDoubleValue("Skills.Taming.CallOfTheWild.MaxHorseJumpStrength"); } /* UNARMED */ - - public boolean getDisarmProtected() { return config.getBoolean("Skills.Unarmed.Disarm.AntiTheft", false); } + public boolean getDisarmProtected() { return getBooleanValue("Skills.Unarmed.Disarm.AntiTheft"); } /* WOODCUTTING */ - /*public int getLeafBlowUnlockLevel() { return config.getInt("Skills.Woodcutting.LeafBlower.UnlockLevel", 100); }*/ - - /* KRAKEN STUFF */ - public boolean getKrakenEnabled() { return config.getBoolean("Kraken.Enabled", true); } - public int getKrakenTriesBeforeRelease() { return config.getInt("Kraken.Tries_Before_Release", 50); } - public double getKrakenHealth() { return config.getDouble("Kraken.Health", 50.0D); } - public String getKrakenName() { return config.getString("Kraken.Name", "The Kraken"); } - public int getKrakenAttackInterval() { return config.getInt("Kraken.Attack_Interval_Seconds", 1); } - public double getKrakenAttackDamage() { return config.getDouble("Kraken.Attack_Damage", 1.0D); } - public boolean getKrakenGlobalEffectsEnabled() { return config.getBoolean("Kraken.Global_Effects", false); } - public boolean getKrakenEscapeAllowed() { return config.getBoolean("Kraken.Allow_Escaping", false); } - public String getServerUnleashMessage() { return config.getString("Kraken.Unleashed_Message.Server", ""); } - public String getPlayerUnleashMessage() { return config.getString("Kraken.Unleashed_Message.Player", ""); } - public String getPlayerDefeatMessage() { return config.getString("Kraken.Defeated_Message.Killed", ""); } - public String getPlayerEscapeMessage() { return config.getString("Kraken.Defeated_Message.Escape", ""); } } diff --git a/src/main/java/com/gmail/nossr50/config/ConfigLoaderConfigurable.java b/src/main/java/com/gmail/nossr50/config/ConfigLoaderConfigurable.java index 4ec5c8bc6..ea90c44f6 100644 --- a/src/main/java/com/gmail/nossr50/config/ConfigLoaderConfigurable.java +++ b/src/main/java/com/gmail/nossr50/config/ConfigLoaderConfigurable.java @@ -72,7 +72,7 @@ public abstract class ConfigLoaderConfigurable implements DefaultKeys { List validKeyErrors = validateKeys(); // Validate Keys - if(validKeyErrors.size() > 0) + if(validKeyErrors != null && validKeyErrors.size() > 0) { for(String error : validKeyErrors) { @@ -281,4 +281,29 @@ public abstract class ConfigLoaderConfigurable implements DefaultKeys { protected ConfigurationNode getUserRootNode() { return userRootNode; } + + /** + * Attempts to get an int value from the config + * @param path path the node from the root node + * @return int value of the node + */ + int getIntValue(String path) + { + return userRootNode.getNode(path).getInt(); + } + + double getDoubleValue(String path) + { + return userRootNode.getNode(path).getDouble(); + } + + boolean getBooleanValue(String path) + { + return userRootNode.getNode(path).getBoolean(); + } + + String getStringValue(String path) + { + return userRootNode.getNode(path).getString(); + } } diff --git a/src/main/java/com/gmail/nossr50/config/ConfigurableTest.java b/src/main/java/com/gmail/nossr50/config/ConfigurableTest.java index 65c1a1810..7e5033678 100644 --- a/src/main/java/com/gmail/nossr50/config/ConfigurableTest.java +++ b/src/main/java/com/gmail/nossr50/config/ConfigurableTest.java @@ -2,6 +2,8 @@ package com.gmail.nossr50.config; import com.gmail.nossr50.mcMMO; +import java.util.List; + public class ConfigurableTest extends ConfigLoaderConfigurable { public final static String relativePath = "configurabletest.yml"; @@ -21,7 +23,7 @@ public class ConfigurableTest extends ConfigLoaderConfigurable { } @Override - public boolean validateKeys() { - return false; + public List validateKeys() { + return null; } } diff --git a/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java b/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java index 9c40f8aa6..e049aec68 100644 --- a/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java +++ b/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java @@ -56,9 +56,6 @@ public final class MobHealthbarUtils { if (oldName == null) { oldName = ""; } - else if (oldName.equalsIgnoreCase(AdvancedConfig.getInstance().getKrakenName())) { - return; - } boolean oldNameVisible = target.isCustomNameVisible(); String newName = createHealthDisplay(Config.getInstance().getMobHealthbarDefault(), target, damage);