From fa33fa3d32d0057fbacd1139f9eb584f12347a43 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 17 Mar 2022 13:49:07 -0700 Subject: [PATCH] Revert 3 commits (work will be continued in branch) Revert "Disabling mcMMO when the config breaks is dumb" This reverts commit 86e7bfbf89f027fec63730fa5a5da1884ed8a098. Revert "Config validation rewrite part 1" This reverts commit 16e90da8fdfe49741074294b9d7cc6438f6d27a2. Revert "Update changelog" This reverts commit 0ccd89fad4897b4a15e36437bed0d2f9b4ef7544. --- Changelog.txt | 2 - .../gmail/nossr50/config/AdvancedConfig.java | 182 +++++++++--------- .../gmail/nossr50/config/BukkitConfig.java | 40 ++-- .../com/gmail/nossr50/config/ChatConfig.java | 5 +- .../gmail/nossr50/config/ConfigLoader.java | 1 + .../nossr50/config/CoreSkillsConfig.java | 6 +- .../gmail/nossr50/config/GeneralConfig.java | 60 +++--- .../nossr50/config/PersistentDataConfig.java | 5 +- .../com/gmail/nossr50/config/SoundConfig.java | 11 +- .../config/experience/ExperienceConfig.java | 61 +++--- .../config/party/ItemWeightConfig.java | 5 - .../config/skills/repair/RepairConfig.java | 13 +- .../config/skills/salvage/SalvageConfig.java | 13 +- .../treasure/FishingTreasureConfig.java | 45 +++-- .../config/treasure/TreasureConfig.java | 98 +++++----- src/main/java/com/gmail/nossr50/mcMMO.java | 7 + .../nossr50/skills/child/ChildConfig.java | 5 - .../nossr50/util/upgrade/UpgradeManager.java | 6 - 18 files changed, 271 insertions(+), 294 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 9221f7f4c..9a33c8ee2 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,7 +1,5 @@ Version 2.1.210 Fixed a memory leak involving mob metadata - mcMMO doesn't disable itself when configs are invalid anymore - mcMMO will fix bad config values when loading (WIP) NOTES: There was a big rewrite in this update relating to how various types of metadata were being tracked/stored/retrieved diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index 50b9a0b1f..84da46281 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -14,6 +14,7 @@ public class AdvancedConfig extends BukkitConfig { public AdvancedConfig(File dataFolder) { super("advanced.yml", dataFolder); + validate(); } @Override @@ -22,125 +23,125 @@ public class AdvancedConfig extends BukkitConfig { } @Override - protected void validateConfigKeys() { - //TODO: Rewrite legacy validation code + protected boolean validateKeys() { + // Validate all the settings! List reason = new ArrayList<>(); /* GENERAL */ if (getAbilityLength() < 1) { - mcMMO.p.getLogger().warning("Skills.General.Ability.Length..IncreaseLevel should be at least 1!"); + reason.add("Skills.General.Ability.Length..IncreaseLevel should be at least 1!"); } if (getEnchantBuff() < 1) { - mcMMO.p.getLogger().warning("Skills.General.Ability.EnchantBuff should be at least 1!"); + reason.add("Skills.General.Ability.EnchantBuff should be at least 1!"); } /* ACROBATICS */ if (getMaximumProbability(SubSkillType.ACROBATICS_DODGE) < 1) { - mcMMO.p.getLogger().warning("Skills.Acrobatics.Dodge.ChanceMax should be at least 1!"); + reason.add("Skills.Acrobatics.Dodge.ChanceMax should be at least 1!"); } if (getMaxBonusLevel(SubSkillType.ACROBATICS_DODGE) < 1) { - mcMMO.p.getLogger().warning("Skills.Acrobatics.Dodge.MaxBonusLevel should be at least 1!"); + reason.add("Skills.Acrobatics.Dodge.MaxBonusLevel should be at least 1!"); } if (getDodgeDamageModifier() <= 1) { - mcMMO.p.getLogger().warning("Skills.Acrobatics.Dodge.DamageModifier should be greater than 1!"); + reason.add("Skills.Acrobatics.Dodge.DamageModifier should be greater than 1!"); } if (getMaximumProbability(SubSkillType.ACROBATICS_ROLL) < 1) { - mcMMO.p.getLogger().warning("Skills.Acrobatics.Roll.ChanceMax should be at least 1!"); + reason.add("Skills.Acrobatics.Roll.ChanceMax should be at least 1!"); } if (getMaxBonusLevel(SubSkillType.ACROBATICS_ROLL) < 1) { - mcMMO.p.getLogger().warning("Skills.Acrobatics.Roll.MaxBonusLevel should be at least 1!"); + reason.add("Skills.Acrobatics.Roll.MaxBonusLevel should be at least 1!"); } if (getRollDamageThreshold() < 0) { - mcMMO.p.getLogger().warning("Skills.Acrobatics.Roll.DamageThreshold should be at least 0!"); + reason.add("Skills.Acrobatics.Roll.DamageThreshold should be at least 0!"); } if (getGracefulRollDamageThreshold() < 0) { - mcMMO.p.getLogger().warning("Skills.Acrobatics.GracefulRoll.DamageThreshold should be at least 0!"); + reason.add("Skills.Acrobatics.GracefulRoll.DamageThreshold should be at least 0!"); } if (getCatalysisMinSpeed() <= 0) { - mcMMO.p.getLogger().warning("Skills.Alchemy.Catalysis.MinSpeed must be greater than 0!"); + reason.add("Skills.Alchemy.Catalysis.MinSpeed must be greater than 0!"); } if (getCatalysisMaxSpeed() < getCatalysisMinSpeed()) { - mcMMO.p.getLogger().warning("Skills.Alchemy.Catalysis.MaxSpeed should be at least Skills.Alchemy.Catalysis.MinSpeed!"); + reason.add("Skills.Alchemy.Catalysis.MaxSpeed should be at least Skills.Alchemy.Catalysis.MinSpeed!"); } /* ARCHERY */ if (getSkillShotRankDamageMultiplier() <= 0) { - mcMMO.p.getLogger().warning("Skills.Archery.SkillShot.RankDamageMultiplier should be greater than 0!"); + reason.add("Skills.Archery.SkillShot.RankDamageMultiplier should be greater than 0!"); } if (getMaximumProbability(SubSkillType.ARCHERY_DAZE) < 1) { - mcMMO.p.getLogger().warning("Skills.Archery.Daze.ChanceMax should be at least 1!"); + reason.add("Skills.Archery.Daze.ChanceMax should be at least 1!"); } if (getMaxBonusLevel(SubSkillType.ARCHERY_DAZE) < 1) { - mcMMO.p.getLogger().warning("Skills.Archery.Daze.MaxBonusLevel should be at least 1!"); + reason.add("Skills.Archery.Daze.MaxBonusLevel should be at least 1!"); } if (getDazeBonusDamage() < 0) { - mcMMO.p.getLogger().warning("Skills.Archery.Daze.BonusDamage should be at least 0!"); + reason.add("Skills.Archery.Daze.BonusDamage should be at least 0!"); } if (getMaximumProbability(SubSkillType.ARCHERY_ARROW_RETRIEVAL) < 1) { - mcMMO.p.getLogger().warning("Skills.Archery.Retrieve.ChanceMax should be at least 1!"); + reason.add("Skills.Archery.Retrieve.ChanceMax should be at least 1!"); } if (getMaxBonusLevel(SubSkillType.ARCHERY_ARROW_RETRIEVAL) < 1) { - mcMMO.p.getLogger().warning("Skills.Archery.Retrieve.MaxBonusLevel should be at least 1!"); + reason.add("Skills.Archery.Retrieve.MaxBonusLevel should be at least 1!"); } if (getForceMultiplier() < 0) { - mcMMO.p.getLogger().warning("Skills.Archery.ForceMultiplier should be at least 0!"); + reason.add("Skills.Archery.ForceMultiplier should be at least 0!"); } /* AXES */ if (getAxeMasteryRankDamageMultiplier() < 0) { - mcMMO.p.getLogger().warning("Skills.Axes.AxeMastery.RankDamageMultiplier should be at least 0!"); + reason.add("Skills.Axes.AxeMastery.RankDamageMultiplier should be at least 0!"); } if (getMaximumProbability(SubSkillType.AXES_CRITICAL_STRIKES) < 1) { - mcMMO.p.getLogger().warning("Skills.Axes.CriticalHit.ChanceMax should be at least 1!"); + reason.add("Skills.Axes.CriticalHit.ChanceMax should be at least 1!"); } if (getMaxBonusLevel(SubSkillType.AXES_CRITICAL_STRIKES) < 1) { - mcMMO.p.getLogger().warning("Skills.Axes.CriticalHit.MaxBonusLevel should be at least 1!"); + reason.add("Skills.Axes.CriticalHit.MaxBonusLevel should be at least 1!"); } if (getCriticalStrikesPVPModifier() < 1) { - mcMMO.p.getLogger().warning("Skills.Axes.CriticalStrikes.PVP_Modifier should be at least 1!"); + reason.add("Skills.Axes.CriticalStrikes.PVP_Modifier should be at least 1!"); } if (getCriticalStrikesPVPModifier() < 1) { - mcMMO.p.getLogger().warning("Skills.Axes.CriticalStrikes.PVE_Modifier should be at least 1!"); + reason.add("Skills.Axes.CriticalStrikes.PVE_Modifier should be at least 1!"); } if (getGreaterImpactChance() < 1) { - mcMMO.p.getLogger().warning("Skills.Axes.GreaterImpact.Chance should be at least 1!"); + reason.add("Skills.Axes.GreaterImpact.Chance should be at least 1!"); } if (getGreaterImpactModifier() < 1) { - mcMMO.p.getLogger().warning("Skills.Axes.GreaterImpact.KnockbackModifier should be at least 1!"); + reason.add("Skills.Axes.GreaterImpact.KnockbackModifier should be at least 1!"); } if (getGreaterImpactBonusDamage() < 1) { - mcMMO.p.getLogger().warning("Skills.Axes.GreaterImpact.BonusDamage should be at least 1!"); + reason.add("Skills.Axes.GreaterImpact.BonusDamage should be at least 1!"); } if (getImpactChance() < 1) { - mcMMO.p.getLogger().warning("Skills.Axes.ArmorImpact.Chance should be at least 1!"); + reason.add("Skills.Axes.ArmorImpact.Chance should be at least 1!"); } if (getSkullSplitterModifier() < 1) { - mcMMO.p.getLogger().warning("Skills.Axes.SkullSplitter.DamageModifier should be at least 1!"); + reason.add("Skills.Axes.SkullSplitter.DamageModifier should be at least 1!"); } /* FISHING */ @@ -148,261 +149,262 @@ public class AdvancedConfig extends BukkitConfig { for (int rank : fishingTierList) { if (getFishingTierLevel(tier) < 0) { - mcMMO.p.getLogger().warning("Skills.Fishing.Rank_Levels.Rank_" + rank + " should be at least 0!"); + reason.add("Skills.Fishing.Rank_Levels.Rank_" + rank + " should be at least 0!"); } if (getShakeChance(tier) < 0) { - mcMMO.p.getLogger().warning("Skills.Fishing.Shake_Chance.Rank_" + rank + " should be at least 0!"); + reason.add("Skills.Fishing.Shake_Chance.Rank_" + rank + " should be at least 0!"); } if (getFishingVanillaXPModifier(tier) < 0) { - mcMMO.p.getLogger().warning("Skills.Fishing.VanillaXPMultiplier.Rank_" + rank + " should be at least 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)) { - mcMMO.p.getLogger().warning("Skills.Fishing.Rank_Levels.Rank_" + rank + " should be less than or equal to Skills.Fishing.Rank_Levels.Rank_" + nextrank + "!"); + 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)) { - mcMMO.p.getLogger().warning("Skills.Fishing.Shake_Chance.Rank_" + rank + " should be less than or equal to Skills.Fishing.Shake_Chance.Rank_" + nextrank + "!"); + 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)) { - mcMMO.p.getLogger().warning("Skills.Fishing.VanillaXPMultiplier.Rank_" + rank + " should be less than or equal to Skills.Fishing.VanillaXPMultiplier.Rank_" + nextrank + "!"); + reason.add("Skills.Fishing.VanillaXPMultiplier.Rank_" + rank + " should be less than or equal to Skills.Fishing.VanillaXPMultiplier.Rank_" + nextrank + "!"); } } }*/ if (getFishermanDietRankChange() < 1) { - mcMMO.p.getLogger().warning("Skills.Fishing.FishermansDiet.RankChange should be at least 1!"); + reason.add("Skills.Fishing.FishermansDiet.RankChange should be at least 1!"); } /*if (getIceFishingUnlockLevel() < 0) { - mcMMO.p.getLogger().warning("Skills.Fishing.IceFishing.UnlockLevel should be at least 0!"); + reason.add("Skills.Fishing.IceFishing.UnlockLevel should be at least 0!"); } if (getMasterAnglerUnlockLevel() < 0) { - mcMMO.p.getLogger().warning("Skills.Fishing.MasterAngler.UnlockLevel should be at least 0!"); + reason.add("Skills.Fishing.MasterAngler.UnlockLevel should be at least 0!"); }*/ if (getMasterAnglerBoatModifier() < 1) { - mcMMO.p.getLogger().warning("Skills.Fishing.MasterAngler.BoatModifier should be at least 1!"); + reason.add("Skills.Fishing.MasterAngler.BoatModifier should be at least 1!"); } if (getMasterAnglerBiomeModifier() < 1) { - mcMMO.p.getLogger().warning("Skills.Fishing.MasterAngler.BiomeModifier should be at least 1!"); + reason.add("Skills.Fishing.MasterAngler.BiomeModifier should be at least 1!"); } /* HERBALISM */ if (getFarmerDietRankChange() < 1) { - mcMMO.p.getLogger().warning("Skills.Herbalism.FarmersDiet.RankChange should be at least 1!"); + reason.add("Skills.Herbalism.FarmersDiet.RankChange should be at least 1!"); } if (getGreenThumbStageChange() < 1) { - mcMMO.p.getLogger().warning("Skills.Herbalism.GreenThumb.StageChange should be at least 1!"); + reason.add("Skills.Herbalism.GreenThumb.StageChange should be at least 1!"); } if (getMaximumProbability(SubSkillType.HERBALISM_GREEN_THUMB) < 1) { - mcMMO.p.getLogger().warning("Skills.Herbalism.GreenThumb.ChanceMax should be at least 1!"); + reason.add("Skills.Herbalism.GreenThumb.ChanceMax should be at least 1!"); } if (getMaxBonusLevel(SubSkillType.HERBALISM_GREEN_THUMB) < 1) { - mcMMO.p.getLogger().warning("Skills.Herbalism.GreenThumb.MaxBonusLevel should be at least 1!"); + reason.add("Skills.Herbalism.GreenThumb.MaxBonusLevel should be at least 1!"); } if (getMaximumProbability(SubSkillType.HERBALISM_DOUBLE_DROPS) < 1) { - mcMMO.p.getLogger().warning("Skills.Herbalism.DoubleDrops.ChanceMax should be at least 1!"); + reason.add("Skills.Herbalism.DoubleDrops.ChanceMax should be at least 1!"); } if (getMaxBonusLevel(SubSkillType.HERBALISM_DOUBLE_DROPS) < 1) { - mcMMO.p.getLogger().warning("Skills.Herbalism.DoubleDrops.MaxBonusLevel should be at least 1!"); + reason.add("Skills.Herbalism.DoubleDrops.MaxBonusLevel should be at least 1!"); } if (getMaximumProbability(SubSkillType.HERBALISM_HYLIAN_LUCK) < 1) { - mcMMO.p.getLogger().warning("Skills.Herbalism.HylianLuck.ChanceMax should be at least 1!"); + reason.add("Skills.Herbalism.HylianLuck.ChanceMax should be at least 1!"); } if (getMaxBonusLevel(SubSkillType.HERBALISM_HYLIAN_LUCK) < 1) { - mcMMO.p.getLogger().warning("Skills.Herbalism.HylianLuck.MaxBonusLevel should be at least 1!"); + reason.add("Skills.Herbalism.HylianLuck.MaxBonusLevel should be at least 1!"); } if (getMaximumProbability(SubSkillType.HERBALISM_SHROOM_THUMB) < 1) { - mcMMO.p.getLogger().warning("Skills.Herbalism.ShroomThumb.ChanceMax should be at least 1!"); + reason.add("Skills.Herbalism.ShroomThumb.ChanceMax should be at least 1!"); } if (getMaxBonusLevel(SubSkillType.HERBALISM_SHROOM_THUMB) < 1) { - mcMMO.p.getLogger().warning("Skills.Herbalism.ShroomThumb.MaxBonusLevel should be at least 1!"); + reason.add("Skills.Herbalism.ShroomThumb.MaxBonusLevel should be at least 1!"); } /* MINING */ if (getMaximumProbability(SubSkillType.MINING_DOUBLE_DROPS) < 1) { - mcMMO.p.getLogger().warning("Skills.Mining.DoubleDrops.ChanceMax should be at least 1!"); + reason.add("Skills.Mining.DoubleDrops.ChanceMax should be at least 1!"); } if (getMaxBonusLevel(SubSkillType.MINING_DOUBLE_DROPS) < 1) { - mcMMO.p.getLogger().warning("Skills.Mining.DoubleDrops.MaxBonusLevel should be at least 1!"); + reason.add("Skills.Mining.DoubleDrops.MaxBonusLevel should be at least 1!"); } /* REPAIR */ if (getRepairMasteryMaxBonus() < 1) { - mcMMO.p.getLogger().warning("Skills.Repair.RepairMastery.MaxBonusPercentage should be at least 1!"); + reason.add("Skills.Repair.RepairMastery.MaxBonusPercentage should be at least 1!"); } if (getRepairMasteryMaxLevel() < 1) { - mcMMO.p.getLogger().warning("Skills.Repair.RepairMastery.MaxBonusLevel should be at least 1!"); + reason.add("Skills.Repair.RepairMastery.MaxBonusLevel should be at least 1!"); } if (getMaximumProbability(SubSkillType.REPAIR_SUPER_REPAIR) < 1) { - mcMMO.p.getLogger().warning("Skills.Repair.SuperRepair.ChanceMax should be at least 1!"); + reason.add("Skills.Repair.SuperRepair.ChanceMax should be at least 1!"); } if (getMaxBonusLevel(SubSkillType.REPAIR_SUPER_REPAIR) < 1) { - mcMMO.p.getLogger().warning("Skills.Repair.SuperRepair.MaxBonusLevel should be at least 1!"); + reason.add("Skills.Repair.SuperRepair.MaxBonusLevel should be at least 1!"); } /* SMELTING */ if (getBurnModifierMaxLevel() < 1) { - mcMMO.p.getLogger().warning("Skills.Smelting.FuelEfficiency.MaxBonusLevel should be at least 1!"); + reason.add("Skills.Smelting.FuelEfficiency.MaxBonusLevel should be at least 1!"); } if (getMaxBonusLevel(SubSkillType.SMELTING_SECOND_SMELT) < 1) { - mcMMO.p.getLogger().warning("Skills.Smelting.SecondSmelt.MaxBonusLevel should be at least 1!"); + reason.add("Skills.Smelting.SecondSmelt.MaxBonusLevel should be at least 1!"); } if (getMaximumProbability(SubSkillType.SMELTING_SECOND_SMELT) < 1) { - mcMMO.p.getLogger().warning("Skills.Smelting.SecondSmelt.ChanceMax should be at least 1!"); + reason.add("Skills.Smelting.SecondSmelt.ChanceMax should be at least 1!"); } if (getFluxMiningChance() < 1) { - mcMMO.p.getLogger().warning("Skills.Smelting.FluxMining.Chance should be at least 1!"); + reason.add("Skills.Smelting.FluxMining.Chance should be at least 1!"); } /* SWORDS */ if (getMaximumProbability(SubSkillType.SWORDS_COUNTER_ATTACK) < 1) { - mcMMO.p.getLogger().warning("Skills.Swords.CounterAttack.ChanceMax should be at least 1!"); + reason.add("Skills.Swords.CounterAttack.ChanceMax should be at least 1!"); } if (getMaxBonusLevel(SubSkillType.SWORDS_COUNTER_ATTACK) < 1) { - mcMMO.p.getLogger().warning("Skills.Swords.CounterAttack.MaxBonusLevel should be at least 1!"); + reason.add("Skills.Swords.CounterAttack.MaxBonusLevel should be at least 1!"); } if (getCounterModifier() < 1) { - mcMMO.p.getLogger().warning("Skills.Swords.CounterAttack.DamageModifier should be at least 1!"); + reason.add("Skills.Swords.CounterAttack.DamageModifier should be at least 1!"); } if (getSerratedStrikesModifier() < 1) { - mcMMO.p.getLogger().warning("Skills.Swords.SerratedStrikes.DamageModifier should be at least 1!"); + reason.add("Skills.Swords.SerratedStrikes.DamageModifier should be at least 1!"); } if (getSerratedStrikesTicks() < 1) { - mcMMO.p.getLogger().warning("Skills.Swords.SerratedStrikes.RuptureTicks should be at least 1!"); + reason.add("Skills.Swords.SerratedStrikes.RuptureTicks should be at least 1!"); } /* TAMING */ if (getMaximumProbability(SubSkillType.TAMING_GORE) < 1) { - mcMMO.p.getLogger().warning("Skills.Taming.Gore.ChanceMax should be at least 1!"); + reason.add("Skills.Taming.Gore.ChanceMax should be at least 1!"); } if (getMaxBonusLevel(SubSkillType.TAMING_GORE) < 1) { - mcMMO.p.getLogger().warning("Skills.Taming.Gore.MaxBonusLevel should be at least 1!"); + reason.add("Skills.Taming.Gore.MaxBonusLevel should be at least 1!"); } /*if (getGoreRuptureTicks() < 1) { - mcMMO.p.getLogger().warning("Skills.Taming.Gore.RuptureTicks should be at least 1!"); + reason.add("Skills.Taming.Gore.RuptureTicks should be at least 1!"); }*/ if (getGoreModifier() < 1) { - mcMMO.p.getLogger().warning("Skills.Taming.Gore.Modifier should be at least 1!"); + reason.add("Skills.Taming.Gore.Modifier should be at least 1!"); } /*if (getFastFoodUnlock() < 0) { - mcMMO.p.getLogger().warning("Skills.Taming.FastFood.UnlockLevel should be at least 0!"); + reason.add("Skills.Taming.FastFood.UnlockLevel should be at least 0!"); }*/ if (getFastFoodChance() < 1) { - mcMMO.p.getLogger().warning("Skills.Taming.FastFood.Chance should be at least 1!"); + reason.add("Skills.Taming.FastFood.Chance should be at least 1!"); } /*if (getEnviromentallyAwareUnlock() < 0) { - mcMMO.p.getLogger().warning("Skills.Taming.EnvironmentallyAware.UnlockLevel should be at least 0!"); + reason.add("Skills.Taming.EnvironmentallyAware.UnlockLevel should be at least 0!"); }*/ /*if (getThickFurUnlock() < 0) { - mcMMO.p.getLogger().warning("Skills.Taming.ThickFur.UnlockLevel should be at least 0!"); + reason.add("Skills.Taming.ThickFur.UnlockLevel should be at least 0!"); }*/ if (getThickFurModifier() < 1) { - mcMMO.p.getLogger().warning("Skills.Taming.ThickFur.Modifier should be at least 1!"); + reason.add("Skills.Taming.ThickFur.Modifier should be at least 1!"); } /*if (getHolyHoundUnlock() < 0) { - mcMMO.p.getLogger().warning("Skills.Taming.HolyHound.UnlockLevel should be at least 0!"); + reason.add("Skills.Taming.HolyHound.UnlockLevel should be at least 0!"); } if (getShockProofUnlock() < 0) { - mcMMO.p.getLogger().warning("Skills.Taming.ShockProof.UnlockLevel should be at least 0!"); + reason.add("Skills.Taming.ShockProof.UnlockLevel should be at least 0!"); }*/ if (getShockProofModifier() < 1) { - mcMMO.p.getLogger().warning("Skills.Taming.ShockProof.Modifier should be at least 1!"); + reason.add("Skills.Taming.ShockProof.Modifier should be at least 1!"); } /*if (getSharpenedClawsUnlock() < 0) { - mcMMO.p.getLogger().warning("Skills.Taming.SharpenedClaws.UnlockLevel should be at least 0!"); + reason.add("Skills.Taming.SharpenedClaws.UnlockLevel should be at least 0!"); }*/ if (getSharpenedClawsBonus() < 1) { - mcMMO.p.getLogger().warning("Skills.Taming.SharpenedClaws.Bonus should be at least 1!"); + reason.add("Skills.Taming.SharpenedClaws.Bonus should be at least 1!"); } if (getMaxHorseJumpStrength() < 0 || getMaxHorseJumpStrength() > 2) { - mcMMO.p.getLogger().warning("Skills.Taming.CallOfTheWild.MaxHorseJumpStrength should be between 0 and 2!"); + reason.add("Skills.Taming.CallOfTheWild.MaxHorseJumpStrength should be between 0 and 2!"); } /* UNARMED */ if (getMaximumProbability(SubSkillType.UNARMED_DISARM) < 1) { - mcMMO.p.getLogger().warning("Skills.Unarmed.Disarm.ChanceMax should be at least 1!"); + reason.add("Skills.Unarmed.Disarm.ChanceMax should be at least 1!"); } if (getMaxBonusLevel(SubSkillType.UNARMED_DISARM) < 1) { - mcMMO.p.getLogger().warning("Skills.Unarmed.Disarm.MaxBonusLevel should be at least 1!"); + reason.add("Skills.Unarmed.Disarm.MaxBonusLevel should be at least 1!"); } if (getMaximumProbability(SubSkillType.UNARMED_ARROW_DEFLECT) < 1) { - mcMMO.p.getLogger().warning("Skills.Unarmed.ArrowDeflect.ChanceMax should be at least 1!"); + reason.add("Skills.Unarmed.ArrowDeflect.ChanceMax should be at least 1!"); } if (getMaxBonusLevel(SubSkillType.UNARMED_ARROW_DEFLECT) < 1) { - mcMMO.p.getLogger().warning("Skills.Unarmed.ArrowDeflect.MaxBonusLevel should be at least 1!"); + reason.add("Skills.Unarmed.ArrowDeflect.MaxBonusLevel should be at least 1!"); } if (getMaximumProbability(SubSkillType.UNARMED_IRON_GRIP) < 1) { - mcMMO.p.getLogger().warning("Skills.Unarmed.IronGrip.ChanceMax should be at least 1!"); + reason.add("Skills.Unarmed.IronGrip.ChanceMax should be at least 1!"); } if (getMaxBonusLevel(SubSkillType.UNARMED_IRON_GRIP) < 1) { - mcMMO.p.getLogger().warning("Skills.Unarmed.IronGrip.MaxBonusLevel should be at least 1!"); + reason.add("Skills.Unarmed.IronGrip.MaxBonusLevel should be at least 1!"); } /* WOODCUTTING */ /*if (getLeafBlowUnlockLevel() < 0) { - mcMMO.p.getLogger().warning("Skills.Woodcutting.LeafBlower.UnlockLevel should be at least 0!"); + reason.add("Skills.Woodcutting.LeafBlower.UnlockLevel should be at least 0!"); }*/ if (getMaximumProbability(SubSkillType.WOODCUTTING_HARVEST_LUMBER) < 1) { - mcMMO.p.getLogger().warning("Skills.Woodcutting.HarvestLumber.ChanceMax should be at least 1!"); + reason.add("Skills.Woodcutting.HarvestLumber.ChanceMax should be at least 1!"); } if (getMaxBonusLevel(SubSkillType.WOODCUTTING_HARVEST_LUMBER) < 1) { - mcMMO.p.getLogger().warning("Skills.Woodcutting.HarvestLumber.MaxBonusLevel should be at least 1!"); + reason.add("Skills.Woodcutting.HarvestLumber.MaxBonusLevel should be at least 1!"); } + return noErrorsInConfig(reason); } @Override diff --git a/src/main/java/com/gmail/nossr50/config/BukkitConfig.java b/src/main/java/com/gmail/nossr50/config/BukkitConfig.java index ccf59b5a9..a22990e00 100644 --- a/src/main/java/com/gmail/nossr50/config/BukkitConfig.java +++ b/src/main/java/com/gmail/nossr50/config/BukkitConfig.java @@ -7,18 +7,18 @@ import org.jetbrains.annotations.NotNull; import java.io.*; import java.util.HashSet; +import java.util.List; import java.util.Set; public abstract class BukkitConfig { - protected static final String CONFIG_PATCH_PREFIX = "ConfigPatchVersion:"; - protected static final String CURRENT_CONFIG_PATCH_VER = "ConfigPatchVersion: 2"; - protected static final char COMMENT_PREFIX = '#'; + public static final String CONFIG_PATCH_PREFIX = "ConfigPatchVersion:"; + public static final String CURRENT_CONFIG_PATCH_VER = "ConfigPatchVersion: 2"; + public static final char COMMENT_PREFIX = '#'; protected final String fileName; protected final File configFile; protected YamlConfiguration config; protected @NotNull final File dataFolder; - protected boolean unmodifiedConfig = true; //Used to mark when we have made a fix that needs an immediate save public BukkitConfig(@NotNull String fileName, @NotNull File dataFolder) { mcMMO.p.getLogger().info("[config] Initializing config: " + fileName); @@ -30,7 +30,6 @@ public abstract class BukkitConfig { initDefaults(); updateFile(); mcMMO.p.getLogger().info("[config] Config initialized: " + fileName); - validate(); } @Deprecated @@ -84,28 +83,25 @@ public abstract class BukkitConfig { protected abstract void loadKeys(); - protected abstract void validateConfigKeys(); - - protected void fixConfigKey(@NotNull String key, @NotNull String value, @NotNull String reason) { - mcMMO.p.getLogger().warning(reason); - config.set(key, value); - this.unmodifiedConfig = false; //flag to save config + protected boolean validateKeys() { + return true; } - private void validate() { - //TODO: Rewrite legacy validation code - validateConfigKeys(); + protected boolean noErrorsInConfig(List issues) { + for (String issue : issues) { + mcMMO.p.getLogger().warning(issue); + } - if (unmodifiedConfig) { + return issues.isEmpty(); + } + + protected void validate() { + if (validateKeys()) { mcMMO.p.debug("No errors found in " + fileName + "!"); } else { - mcMMO.p.getLogger().warning("Errors were found in " + fileName + ", overwriting invalid values with defaults"); - try { - config.save(configFile); - unmodifiedConfig = true; - } catch (IOException e) { - e.printStackTrace(); - } + mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!"); + mcMMO.p.getServer().getPluginManager().disablePlugin(mcMMO.p); + mcMMO.p.noErrorsInConfigFiles = false; } } diff --git a/src/main/java/com/gmail/nossr50/config/ChatConfig.java b/src/main/java/com/gmail/nossr50/config/ChatConfig.java index b01fdb84a..bbda1b69c 100644 --- a/src/main/java/com/gmail/nossr50/config/ChatConfig.java +++ b/src/main/java/com/gmail/nossr50/config/ChatConfig.java @@ -9,6 +9,7 @@ public class ChatConfig extends BukkitConfig { private ChatConfig() { super("chat.yml"); + validate(); } public static ChatConfig getInstance() { @@ -25,8 +26,8 @@ public class ChatConfig extends BukkitConfig { } @Override - protected void validateConfigKeys() { - //TODO: Rewrite legacy validation code + protected boolean validateKeys() { + return true; } public boolean isChatEnabled() { diff --git a/src/main/java/com/gmail/nossr50/config/ConfigLoader.java b/src/main/java/com/gmail/nossr50/config/ConfigLoader.java index 376aa2944..972bd697e 100644 --- a/src/main/java/com/gmail/nossr50/config/ConfigLoader.java +++ b/src/main/java/com/gmail/nossr50/config/ConfigLoader.java @@ -79,6 +79,7 @@ public abstract class ConfigLoader { } else { mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!"); mcMMO.p.getServer().getPluginManager().disablePlugin(mcMMO.p); + mcMMO.p.noErrorsInConfigFiles = false; } } diff --git a/src/main/java/com/gmail/nossr50/config/CoreSkillsConfig.java b/src/main/java/com/gmail/nossr50/config/CoreSkillsConfig.java index 16b763d7c..f92990ad6 100644 --- a/src/main/java/com/gmail/nossr50/config/CoreSkillsConfig.java +++ b/src/main/java/com/gmail/nossr50/config/CoreSkillsConfig.java @@ -9,6 +9,7 @@ public class CoreSkillsConfig extends BukkitConfig { public CoreSkillsConfig() { super("coreskills.yml"); + validate(); } public static CoreSkillsConfig getInstance() { @@ -24,8 +25,9 @@ public class CoreSkillsConfig extends BukkitConfig { } @Override - protected void validateConfigKeys() { - //TODO: Rewrite legacy validation code + protected boolean validateKeys() { + + return true; } /* diff --git a/src/main/java/com/gmail/nossr50/config/GeneralConfig.java b/src/main/java/com/gmail/nossr50/config/GeneralConfig.java index 4749d908d..fb86a42f4 100644 --- a/src/main/java/com/gmail/nossr50/config/GeneralConfig.java +++ b/src/main/java/com/gmail/nossr50/config/GeneralConfig.java @@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.MobHealthbarType; import com.gmail.nossr50.datatypes.party.PartyFeature; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SuperAbilityType; -import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.Material; import org.bukkit.block.data.BlockData; @@ -23,6 +22,7 @@ public class GeneralConfig extends BukkitConfig { public GeneralConfig(@NotNull File dataFolder) { super("config.yml", dataFolder); + validate(); } @Override @@ -31,125 +31,127 @@ public class GeneralConfig extends BukkitConfig { } @Override - protected void validateConfigKeys() { - //TODO: Rewrite legacy validation code + protected boolean validateKeys() { + // Validate all the settings! List reason = new ArrayList<>(); /* General Settings */ if (getSaveInterval() <= 0) { - mcMMO.p.getLogger().info("General.Save_Interval should be greater than 0!"); + reason.add("General.Save_Interval should be greater than 0!"); } /* MySQL Settings */ for (PoolIdentifier identifier : PoolIdentifier.values()) { if (getMySQLMaxConnections(identifier) <= 0) { - mcMMO.p.getLogger().warning("MySQL.Database.MaxConnections." + StringUtils.getCapitalized(identifier.toString()) + " should be greater than 0!"); + reason.add("MySQL.Database.MaxConnections." + StringUtils.getCapitalized(identifier.toString()) + " should be greater than 0!"); } if (getMySQLMaxPoolSize(identifier) <= 0) { - mcMMO.p.getLogger().warning("MySQL.Database.MaxPoolSize." + StringUtils.getCapitalized(identifier.toString()) + " should be greater than 0!"); + reason.add("MySQL.Database.MaxPoolSize." + StringUtils.getCapitalized(identifier.toString()) + " should be greater than 0!"); } } /* Mob Healthbar */ if (getMobHealthbarTime() == 0) { - mcMMO.p.getLogger().warning("Mob_Healthbar.Display_Time cannot be 0! Set to -1 to disable or set a valid value."); + reason.add("Mob_Healthbar.Display_Time cannot be 0! Set to -1 to disable or set a valid value."); } /* Database Purging */ if (getPurgeInterval() < -1) { - mcMMO.p.getLogger().warning("Database_Purging.Purge_Interval should be greater than, or equal to -1!"); + reason.add("Database_Purging.Purge_Interval should be greater than, or equal to -1!"); } if (getOldUsersCutoff() != -1 && getOldUsersCutoff() <= 0) { - mcMMO.p.getLogger().warning("Database_Purging.Old_User_Cutoff should be greater than 0 or -1!"); + reason.add("Database_Purging.Old_User_Cutoff should be greater than 0 or -1!"); } /* Hardcore Mode */ if (getHardcoreDeathStatPenaltyPercentage() < 0.01 || getHardcoreDeathStatPenaltyPercentage() > 100) { - mcMMO.p.getLogger().warning("Hardcore.Death_Stat_Loss.Penalty_Percentage only accepts values from 0.01 to 100!"); + reason.add("Hardcore.Death_Stat_Loss.Penalty_Percentage only accepts values from 0.01 to 100!"); } if (getHardcoreVampirismStatLeechPercentage() < 0.01 || getHardcoreVampirismStatLeechPercentage() > 100) { - mcMMO.p.getLogger().warning("Hardcore.Vampirism.Leech_Percentage only accepts values from 0.01 to 100!"); + reason.add("Hardcore.Vampirism.Leech_Percentage only accepts values from 0.01 to 100!"); } /* Items */ if (getChimaeraUseCost() < 1 || getChimaeraUseCost() > 64) { - mcMMO.p.getLogger().warning("Items.Chimaera_Wing.Use_Cost only accepts values from 1 to 64!"); + reason.add("Items.Chimaera_Wing.Use_Cost only accepts values from 1 to 64!"); } if (getChimaeraRecipeCost() < 1 || getChimaeraRecipeCost() > 9) { - mcMMO.p.getLogger().warning("Items.Chimaera_Wing.Recipe_Cost only accepts values from 1 to 9!"); + reason.add("Items.Chimaera_Wing.Recipe_Cost only accepts values from 1 to 9!"); } if (getChimaeraItem() == null) { - mcMMO.p.getLogger().warning("Items.Chimaera_Wing.Item_Name is invalid!"); + reason.add("Items.Chimaera_Wing.Item_Name is invalid!"); } /* Particles */ if (getLevelUpEffectsTier() < 1) { - mcMMO.p.getLogger().warning("Particles.LevelUp_Tier should be at least 1!"); + reason.add("Particles.LevelUp_Tier should be at least 1!"); } /* PARTY SETTINGS */ if (getAutoPartyKickInterval() < -1) { - mcMMO.p.getLogger().warning("Party.AutoKick_Interval should be at least -1!"); + reason.add("Party.AutoKick_Interval should be at least -1!"); } if (getAutoPartyKickTime() < 0) { - mcMMO.p.getLogger().warning("Party.Old_Party_Member_Cutoff should be at least 0!"); + reason.add("Party.Old_Party_Member_Cutoff should be at least 0!"); } if (getPartyShareBonusBase() <= 0) { - mcMMO.p.getLogger().warning("Party.Sharing.ExpShare_bonus_base should be greater than 0!"); + reason.add("Party.Sharing.ExpShare_bonus_base should be greater than 0!"); } if (getPartyShareBonusIncrease() < 0) { - mcMMO.p.getLogger().warning("Party.Sharing.ExpShare_bonus_increase should be at least 0!"); + reason.add("Party.Sharing.ExpShare_bonus_increase should be at least 0!"); } if (getPartyShareBonusCap() <= 0) { - mcMMO.p.getLogger().warning("Party.Sharing.ExpShare_bonus_cap should be greater than 0!"); + reason.add("Party.Sharing.ExpShare_bonus_cap should be greater than 0!"); } if (getPartyShareRange() <= 0) { - mcMMO.p.getLogger().warning("Party.Sharing.Range should be greater than 0!"); + reason.add("Party.Sharing.Range should be greater than 0!"); } if (getPartyXpCurveMultiplier() < 1) { - mcMMO.p.getLogger().warning("Party.Leveling.Xp_Curve_Modifier should be at least 1!"); + reason.add("Party.Leveling.Xp_Curve_Modifier should be at least 1!"); } for (PartyFeature partyFeature : PartyFeature.values()) { if (getPartyFeatureUnlockLevel(partyFeature) < 0) { - mcMMO.p.getLogger().warning("Party.Leveling." + StringUtils.getPrettyPartyFeatureString(partyFeature).replace(" ", "") + "_UnlockLevel should be at least 0!"); + reason.add("Party.Leveling." + StringUtils.getPrettyPartyFeatureString(partyFeature).replace(" ", "") + "_UnlockLevel should be at least 0!"); } } /* Inspect command distance */ if (getInspectDistance() <= 0) { - mcMMO.p.getLogger().warning("Commands.inspect.Max_Distance should be greater than 0!"); + reason.add("Commands.inspect.Max_Distance should be greater than 0!"); } if (getTreeFellerThreshold() <= 0) { - mcMMO.p.getLogger().warning("Abilities.Limits.Tree_Feller_Threshold should be greater than 0!"); + reason.add("Abilities.Limits.Tree_Feller_Threshold should be greater than 0!"); } if (getFishingLureModifier() < 0) { - mcMMO.p.getLogger().warning("Abilities.Fishing.Lure_Modifier should be at least 0!"); + reason.add("Abilities.Fishing.Lure_Modifier should be at least 0!"); } if (getRepairAnvilMaterial() == null) { - mcMMO.p.getLogger().warning("Skills.Repair.Anvil_Type is invalid!!"); + reason.add("Skills.Repair.Anvil_Type is invalid!!"); } if (getSalvageAnvilMaterial() == null) { - mcMMO.p.getLogger().warning("Skills.Repair.Salvage_Anvil_Type is invalid!"); + reason.add("Skills.Repair.Salvage_Anvil_Type is invalid!"); } if (getRepairAnvilMaterial() == getSalvageAnvilMaterial()) { - mcMMO.p.getLogger().warning("Cannot use the same item for Repair and Salvage anvils!"); + reason.add("Cannot use the same item for Repair and Salvage anvils!"); } + + return noErrorsInConfig(reason); } /* diff --git a/src/main/java/com/gmail/nossr50/config/PersistentDataConfig.java b/src/main/java/com/gmail/nossr50/config/PersistentDataConfig.java index e0fd3d8e9..089db89b8 100644 --- a/src/main/java/com/gmail/nossr50/config/PersistentDataConfig.java +++ b/src/main/java/com/gmail/nossr50/config/PersistentDataConfig.java @@ -7,6 +7,7 @@ public class PersistentDataConfig extends BukkitConfig { private PersistentDataConfig() { super("persistent_data.yml"); + validate(); } public static PersistentDataConfig getInstance() { @@ -23,8 +24,8 @@ public class PersistentDataConfig extends BukkitConfig { } @Override - protected void validateConfigKeys() { - //TODO: Rewrite legacy validation code + protected boolean validateKeys() { + return true; } //Persistent Data Toggles diff --git a/src/main/java/com/gmail/nossr50/config/SoundConfig.java b/src/main/java/com/gmail/nossr50/config/SoundConfig.java index d365ab31b..e19ad7f44 100644 --- a/src/main/java/com/gmail/nossr50/config/SoundConfig.java +++ b/src/main/java/com/gmail/nossr50/config/SoundConfig.java @@ -8,6 +8,7 @@ public class SoundConfig extends BukkitConfig { public SoundConfig() { super("sounds.yml"); + validate(); instance = this; } @@ -24,24 +25,22 @@ public class SoundConfig extends BukkitConfig { } @Override - protected void validateConfigKeys() { - //TODO: Rewrite legacy validation code + protected boolean validateKeys() { for (SoundType soundType : SoundType.values()) { if (config.getDouble("Sounds." + soundType.toString() + ".Volume") < 0) { mcMMO.p.getLogger().info("[mcMMO] Sound volume cannot be below 0 for " + soundType); - //TODO: Rewrite legacy validation code - //return false; + return false; } //Sounds with custom pitching don't use pitch values if (!soundType.usesCustomPitch()) { if (config.getDouble("Sounds." + soundType + ".Pitch") < 0) { mcMMO.p.getLogger().info("[mcMMO] Sound pitch cannot be below 0 for " + soundType); - //TODO: Rewrite legacy validation code - //return false; + return false; } } } + return true; } public float getMasterVolume() { diff --git a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java index 8a51736c8..d10145212 100644 --- a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java +++ b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java @@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.experience.FormulaType; import com.gmail.nossr50.datatypes.skills.MaterialType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage; -import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.Material; import org.bukkit.block.Block; @@ -14,17 +13,16 @@ import org.bukkit.block.data.BlockData; import org.bukkit.boss.BarColor; import org.bukkit.boss.BarStyle; import org.bukkit.entity.EntityType; -import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; -import java.util.function.BiConsumer; public class ExperienceConfig extends BukkitConfig { private static ExperienceConfig instance; private ExperienceConfig() { super("experience.yml"); + validate(); } public static ExperienceConfig getInstance() { @@ -35,18 +33,12 @@ public class ExperienceConfig extends BukkitConfig { return instance; } - @Override - public void initDefaults() { - super.initDefaults(); - } - @Override protected void loadKeys() { } @Override - protected void validateConfigKeys() { - //TODO: Rewrite legacy validation code + protected boolean validateKeys() { List reason = new ArrayList<>(); /* @@ -54,48 +46,41 @@ public class ExperienceConfig extends BukkitConfig { */ /* Curve values */ - final BiConsumer consumer = (String str, Object obj) -> config.set(str, obj); - - if (getMultiplier(FormulaType.LINEAR) <= 0) { - mcMMO.p.getLogger().warning("Experience_Formula.Linear_Values.multiplier should be greater than 0!"); - config.set("Experience_Formula." + StringUtils.getCapitalized(FormulaType.LINEAR.toString()) + "_Values.multiplier", 0.1); + if (getMultiplier(FormulaType.EXPONENTIAL) <= 0) { + reason.add("Experience_Formula.Exponential_Values.multiplier should be greater than 0!"); } - if (getMultiplier(FormulaType.EXPONENTIAL) <= 0) { - mcMMO.p.getLogger().warning("Experience_Formula.Exponential_Values.multiplier should be greater than 0!"); - config.set("Experience_Formula." + StringUtils.getCapitalized(FormulaType.EXPONENTIAL.toString()) + "_Values.multiplier", 0.1); + if (getMultiplier(FormulaType.LINEAR) <= 0) { + reason.add("Experience_Formula.Linear_Values.multiplier should be greater than 0!"); } if (getExponent(FormulaType.EXPONENTIAL) <= 0) { - mcMMO.p.getLogger().warning("Experience_Formula.Exponential_Values.exponent should be greater than 0!"); - config.set("Experience_Formula." + StringUtils.getCapitalized(FormulaType.EXPONENTIAL.toString()) + "_Values.exponent", 1.80); + reason.add("Experience_Formula.Exponential_Values.exponent should be greater than 0!"); } /* Global modifier */ if (getExperienceGainsGlobalMultiplier() <= 0) { - mcMMO.p.getLogger().warning("Experience_Formula.Multiplier.Global should be at least 0!"); - config.set("Experience_Formula.Multiplier.Global", 1.0); - + reason.add("Experience_Formula.Multiplier.Global should be greater than 0!"); } /* PVP modifier */ if (getPlayerVersusPlayerXP() < 0) { - mcMMO.p.getLogger().warning("Experience_Formula.Multiplier.PVP should be at least 0!"); + reason.add("Experience_Formula.Multiplier.PVP should be at least 0!"); } /* Spawned Mob modifier */ if (getSpawnedMobXpMultiplier() < 0) { - mcMMO.p.getLogger().warning("Experience_Formula.Mobspawners.Multiplier should be at least 0!"); + reason.add("Experience_Formula.Mobspawners.Multiplier should be at least 0!"); } /* Bred Mob modifier */ if (getBredMobXpMultiplier() < 0) { - mcMMO.p.getLogger().warning("Experience_Formula.Breeding.Multiplier should be at least 0!"); + reason.add("Experience_Formula.Breeding.Multiplier should be at least 0!"); } /* Conversion */ if (getExpModifier() <= 0) { - mcMMO.p.getLogger().warning("Conversion.Exp_Modifier should be greater than 0!"); + reason.add("Conversion.Exp_Modifier should be greater than 0!"); } /* @@ -105,52 +90,54 @@ public class ExperienceConfig extends BukkitConfig { /* Alchemy */ for (PotionStage potionStage : PotionStage.values()) { if (getPotionXP(potionStage) < 0) { - mcMMO.p.getLogger().warning("Experience_Values.Alchemy.Potion_Stage_" + potionStage.toNumerical() + " should be at least 0!"); + reason.add("Experience_Values.Alchemy.Potion_Stage_" + potionStage.toNumerical() + " should be at least 0!"); } } /* Archery */ if (getArcheryDistanceMultiplier() < 0) { - mcMMO.p.getLogger().warning("Experience_Values.Archery.Distance_Multiplier should be at least 0!"); + reason.add("Experience_Values.Archery.Distance_Multiplier should be at least 0!"); } /* Combat XP Multipliers */ if (getAnimalsXP() < 0) { - mcMMO.p.getLogger().warning("Experience_Values.Combat.Multiplier.Animals should be at least 0!"); + reason.add("Experience_Values.Combat.Multiplier.Animals should be at least 0!"); } if (getDodgeXPModifier() < 0) { - mcMMO.p.getLogger().warning("Skills.Acrobatics.Dodge_XP_Modifier should be at least 0!"); + reason.add("Skills.Acrobatics.Dodge_XP_Modifier should be at least 0!"); } if (getRollXPModifier() < 0) { - mcMMO.p.getLogger().warning("Skills.Acrobatics.Roll_XP_Modifier should be at least 0!"); + reason.add("Skills.Acrobatics.Roll_XP_Modifier should be at least 0!"); } if (getFallXPModifier() < 0) { - mcMMO.p.getLogger().warning("Skills.Acrobatics.Fall_XP_Modifier should be at least 0!"); + reason.add("Skills.Acrobatics.Fall_XP_Modifier should be at least 0!"); } /* Fishing */ // TODO: Add validation for each fish type once enum is available. if (getFishingShakeXP() <= 0) { - mcMMO.p.getLogger().warning("Experience_Values.Fishing.Shake should be greater than 0!"); + reason.add("Experience_Values.Fishing.Shake should be greater than 0!"); } /* Repair */ if (getRepairXPBase() <= 0) { - mcMMO.p.getLogger().warning("Experience_Values.Repair.Base should be greater than 0!"); + reason.add("Experience_Values.Repair.Base should be greater than 0!"); } /* Taming */ if (getTamingXP(EntityType.WOLF) <= 0) { - mcMMO.p.getLogger().warning("Experience_Values.Taming.Animal_Taming.Wolf should be greater than 0!"); + reason.add("Experience_Values.Taming.Animal_Taming.Wolf should be greater than 0!"); } if (getTamingXP(EntityType.OCELOT) <= 0) { - mcMMO.p.getLogger().warning("Experience_Values.Taming.Animal_Taming.Ocelot should be greater than 0!"); + reason.add("Experience_Values.Taming.Animal_Taming.Ocelot should be greater than 0!"); } + + return noErrorsInConfig(reason); } public boolean isEarlyGameBoostEnabled() { diff --git a/src/main/java/com/gmail/nossr50/config/party/ItemWeightConfig.java b/src/main/java/com/gmail/nossr50/config/party/ItemWeightConfig.java index 75620e389..f36a9d24b 100644 --- a/src/main/java/com/gmail/nossr50/config/party/ItemWeightConfig.java +++ b/src/main/java/com/gmail/nossr50/config/party/ItemWeightConfig.java @@ -22,11 +22,6 @@ public class ItemWeightConfig extends BukkitConfig { return instance; } - @Override - protected void validateConfigKeys() { - //TODO: Rewrite legacy validation code - } - public int getItemWeight(Material material) { return config.getInt("Item_Weights." + StringUtils.getPrettyItemString(material).replace(" ", "_"), config.getInt("Item_Weights.Default")); } diff --git a/src/main/java/com/gmail/nossr50/config/skills/repair/RepairConfig.java b/src/main/java/com/gmail/nossr50/config/skills/repair/RepairConfig.java index ed582208f..604a18e9c 100644 --- a/src/main/java/com/gmail/nossr50/config/skills/repair/RepairConfig.java +++ b/src/main/java/com/gmail/nossr50/config/skills/repair/RepairConfig.java @@ -23,11 +23,6 @@ public class RepairConfig extends BukkitConfig { loadKeys(); } - @Override - protected void validateConfigKeys() { - //TODO: Rewrite legacy validation code - } - @Override protected void loadKeys() { repairables = new ArrayList<>(); @@ -86,7 +81,7 @@ public class RepairConfig extends BukkitConfig { try { repairMaterialType = MaterialType.valueOf(repairMaterialTypeString); } catch (IllegalArgumentException ex) { - mcMMO.p.getLogger().warning(key + " has an invalid MaterialType of " + repairMaterialTypeString); + reason.add(key + " has an invalid MaterialType of " + repairMaterialTypeString); } } @@ -107,7 +102,7 @@ public class RepairConfig extends BukkitConfig { } if (maximumDurability <= 0) { - mcMMO.p.getLogger().warning("Maximum durability of " + key + " must be greater than 0!"); + reason.add("Maximum durability of " + key + " must be greater than 0!"); } // Item Type @@ -126,7 +121,7 @@ public class RepairConfig extends BukkitConfig { try { repairItemType = ItemType.valueOf(repairItemTypeString); } catch (IllegalArgumentException ex) { - mcMMO.p.getLogger().warning(key + " has an invalid ItemType of " + repairItemTypeString); + reason.add(key + " has an invalid ItemType of " + repairItemTypeString); } } @@ -134,7 +129,7 @@ public class RepairConfig extends BukkitConfig { double xpMultiplier = config.getDouble("Repairables." + key + ".XpMultiplier", 1); if (minimumLevel < 0) { - mcMMO.p.getLogger().warning(key + " has an invalid MinimumLevel of " + minimumLevel); + reason.add(key + " has an invalid MinimumLevel of " + minimumLevel); } // Minimum Quantity diff --git a/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfig.java b/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfig.java index d47a42d77..c8700274d 100644 --- a/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfig.java +++ b/src/main/java/com/gmail/nossr50/config/skills/salvage/SalvageConfig.java @@ -26,11 +26,6 @@ public class SalvageConfig extends BukkitConfig { loadKeys(); } - @Override - protected void validateConfigKeys() { - //TODO: Rewrite legacy validation code - } - @Override protected void loadKeys() { salvageables = new HashSet<>(); @@ -102,7 +97,7 @@ public class SalvageConfig extends BukkitConfig { try { salvageMaterialType = MaterialType.valueOf(salvageMaterialTypeString.replace(" ", "_").toUpperCase(Locale.ENGLISH)); } catch (IllegalArgumentException ex) { - mcMMO.p.getLogger().warning(key + " has an invalid MaterialType of " + salvageMaterialTypeString); + reason.add(key + " has an invalid MaterialType of " + salvageMaterialTypeString); } } @@ -134,7 +129,7 @@ public class SalvageConfig extends BukkitConfig { try { salvageItemType = ItemType.valueOf(salvageItemTypeString.replace(" ", "_").toUpperCase(Locale.ENGLISH)); } catch (IllegalArgumentException ex) { - mcMMO.p.getLogger().warning(key + " has an invalid ItemType of " + salvageItemTypeString); + reason.add(key + " has an invalid ItemType of " + salvageItemTypeString); } } @@ -142,7 +137,7 @@ public class SalvageConfig extends BukkitConfig { double xpMultiplier = config.getDouble("Salvageables." + key + ".XpMultiplier", 1); if (minimumLevel < 0) { - mcMMO.p.getLogger().warning(key + " has an invalid MinimumLevel of " + minimumLevel); + reason.add(key + " has an invalid MinimumLevel of " + minimumLevel); } // Maximum Quantity @@ -159,7 +154,7 @@ public class SalvageConfig extends BukkitConfig { } if (maximumQuantity <= 0) { - mcMMO.p.getLogger().warning("Maximum quantity of " + key + " must be greater than 0!"); + reason.add("Maximum quantity of " + key + " must be greater than 0!"); } if (noErrorsInSalvageable(reason)) { diff --git a/src/main/java/com/gmail/nossr50/config/treasure/FishingTreasureConfig.java b/src/main/java/com/gmail/nossr50/config/treasure/FishingTreasureConfig.java index 277997ec0..1a9dd41c5 100755 --- a/src/main/java/com/gmail/nossr50/config/treasure/FishingTreasureConfig.java +++ b/src/main/java/com/gmail/nossr50/config/treasure/FishingTreasureConfig.java @@ -30,6 +30,7 @@ public class FishingTreasureConfig extends BukkitConfig { private FishingTreasureConfig() { super(FILENAME); loadKeys(); + validate(); } public static FishingTreasureConfig getInstance() { @@ -41,8 +42,8 @@ public class FishingTreasureConfig extends BukkitConfig { } @Override - protected void validateConfigKeys() { - //TODO: Rewrite legacy validation code + protected boolean validateKeys() { + // Validate all the settings! List reason = new ArrayList<>(); ConfigurationSection enchantment_drop_rates = config.getConfigurationSection("Enchantment_Drop_Rates"); @@ -56,11 +57,11 @@ public class FishingTreasureConfig extends BukkitConfig { double itemDropRate = config.getDouble("Item_Drop_Rates." + tier + "." + rarity); if ((enchantDropRate < 0.0 || enchantDropRate > 100.0)) { - mcMMO.p.getLogger().warning("The enchant drop rate for " + tier + " items that are " + rarity + "should be between 0.0 and 100.0!"); + reason.add("The enchant drop rate for " + tier + " items that are " + rarity + "should be between 0.0 and 100.0!"); } if (itemDropRate < 0.0 || itemDropRate > 100.0) { - mcMMO.p.getLogger().warning("The item drop rate for " + tier + " items that are " + rarity + "should be between 0.0 and 100.0!"); + reason.add("The item drop rate for " + tier + " items that are " + rarity + "should be between 0.0 and 100.0!"); } totalEnchantDropRate += enchantDropRate; @@ -68,16 +69,18 @@ public class FishingTreasureConfig extends BukkitConfig { } if (totalEnchantDropRate < 0 || totalEnchantDropRate > 100.0) { - mcMMO.p.getLogger().warning("The total enchant drop rate for " + tier + " should be between 0.0 and 100.0!"); + reason.add("The total enchant drop rate for " + tier + " should be between 0.0 and 100.0!"); } if (totalItemDropRate < 0 || totalItemDropRate > 100.0) { - mcMMO.p.getLogger().warning("The total item drop rate for " + tier + " should be between 0.0 and 100.0!"); + reason.add("The total item drop rate for " + tier + " should be between 0.0 and 100.0!"); } } } else { mcMMO.p.getLogger().warning("Your fishing treasures config is empty, is this intentional? Delete it to regenerate."); } + + return noErrorsInConfig(reason); } @Override @@ -138,7 +141,7 @@ public class FishingTreasureConfig extends BukkitConfig { short data = (treasureInfo.length == 2) ? Short.parseShort(treasureInfo[1]) : (short) config.getInt(type + "." + treasureName + ".Data"); if (material == null) { - mcMMO.p.getLogger().warning("Cannot find matching item type in this version of MC, skipping - " + materialName); + reason.add("Cannot find matching item type in this version of MC, skipping - " + materialName); continue; } @@ -147,7 +150,7 @@ public class FishingTreasureConfig extends BukkitConfig { } if (material.isBlock() && (data > 127 || data < -128)) { - mcMMO.p.getLogger().warning("Data of " + treasureName + " is invalid! " + data); + reason.add("Data of " + treasureName + " is invalid! " + data); } /* @@ -159,15 +162,15 @@ public class FishingTreasureConfig extends BukkitConfig { int dropLevel = config.getInt(type + "." + treasureName + ".Drop_Level"); if (xp < 0) { - mcMMO.p.getLogger().warning(treasureName + " has an invalid XP value: " + xp); + reason.add(treasureName + " has an invalid XP value: " + xp); } if (dropChance < 0.0D) { - mcMMO.p.getLogger().warning(treasureName + " has an invalid Drop_Chance: " + dropChance); + reason.add(treasureName + " has an invalid Drop_Chance: " + dropChance); } if (dropLevel < 0) { - mcMMO.p.getLogger().warning("Fishing Config: " + treasureName + " has an invalid Drop_Level: " + dropLevel); + reason.add("Fishing Config: " + treasureName + " has an invalid Drop_Level: " + dropLevel); } /* @@ -202,7 +205,7 @@ public class FishingTreasureConfig extends BukkitConfig { if (materialName.contains("POTION")) { Material mat = Material.matchMaterial(materialName); if (mat == null) { - mcMMO.p.getLogger().warning("Potion format for " + FILENAME + " has changed"); + reason.add("Potion format for " + FILENAME + " has changed"); } else { item = new ItemStack(mat, amount, data); PotionMeta itemMeta = (PotionMeta) item.getItemMeta(); @@ -216,7 +219,7 @@ public class FishingTreasureConfig extends BukkitConfig { try { potionType = PotionType.valueOf(config.getString(type + "." + treasureName + ".PotionData.PotionType", "WATER")); } catch (IllegalArgumentException ex) { - mcMMO.p.getLogger().warning("Invalid Potion_Type: " + config.getString(type + "." + treasureName + ".PotionData.PotionType", "WATER")); + reason.add("Invalid Potion_Type: " + config.getString(type + "." + treasureName + ".PotionData.PotionType", "WATER")); } boolean extended = config.getBoolean(type + "." + treasureName + ".PotionData.Extended", false); boolean upgraded = config.getBoolean(type + "." + treasureName + ".PotionData.Upgraded", false); @@ -279,15 +282,15 @@ public class FishingTreasureConfig extends BukkitConfig { } - //TODO: Rewrite legacy validation code - // Look into what needs to change for this - if (isFishing) { - addFishingTreasure(rarity, new FishingTreasure(item, xp)); - } else if (isShake) { - ShakeTreasure shakeTreasure = new ShakeTreasure(item, xp, dropChance, dropLevel); + if (noErrorsInConfig(reason)) { + if (isFishing) { + addFishingTreasure(rarity, new FishingTreasure(item, xp)); + } else if (isShake) { + ShakeTreasure shakeTreasure = new ShakeTreasure(item, xp, dropChance, dropLevel); - EntityType entityType = EntityType.valueOf(type.substring(6)); - addShakeTreasure(shakeTreasure, entityType); + EntityType entityType = EntityType.valueOf(type.substring(6)); + addShakeTreasure(shakeTreasure, entityType); + } } } } diff --git a/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java b/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java index 44bd4121e..1827188dd 100755 --- a/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java +++ b/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java @@ -37,6 +37,7 @@ public class TreasureConfig extends BukkitConfig { private TreasureConfig() { super(FILENAME); loadKeys(); + validate(); } public static TreasureConfig getInstance() { @@ -48,8 +49,11 @@ public class TreasureConfig extends BukkitConfig { } @Override - protected void validateConfigKeys() { - //TODO: Rewrite legacy validation code + protected boolean validateKeys() { + // Validate all the settings! + List reason = new ArrayList<>(); + + return noErrorsInConfig(reason); } @Override @@ -91,7 +95,7 @@ public class TreasureConfig extends BukkitConfig { short data = (treasureInfo.length == 2) ? Short.parseShort(treasureInfo[1]) : (short) config.getInt(type + "." + treasureName + ".Data"); if (material == null) { - mcMMO.p.getLogger().warning("Invalid material: " + materialName); + reason.add("Invalid material: " + materialName); } if (amount <= 0) { @@ -99,7 +103,7 @@ public class TreasureConfig extends BukkitConfig { } if (material != null && material.isBlock() && (data > 127 || data < -128)) { - mcMMO.p.getLogger().warning("Data of " + treasureName + " is invalid! " + data); + reason.add("Data of " + treasureName + " is invalid! " + data); } /* @@ -143,11 +147,11 @@ public class TreasureConfig extends BukkitConfig { } if (xp < 0) { - mcMMO.p.getLogger().warning(treasureName + " has an invalid XP value: " + xp); + reason.add(treasureName + " has an invalid XP value: " + xp); } if (dropChance < 0.0D) { - mcMMO.p.getLogger().warning(treasureName + " has an invalid Drop_Chance: " + dropChance); + reason.add(treasureName + " has an invalid Drop_Chance: " + dropChance); } /* @@ -158,7 +162,7 @@ public class TreasureConfig extends BukkitConfig { if (materialName.contains("POTION")) { Material mat = Material.matchMaterial(materialName); if (mat == null) { - mcMMO.p.getLogger().warning("Potion format for " + FILENAME + " has changed"); + reason.add("Potion format for " + FILENAME + " has changed"); } else { item = new ItemStack(mat, amount, data); PotionMeta itemMeta = (PotionMeta) item.getItemMeta(); @@ -167,7 +171,7 @@ public class TreasureConfig extends BukkitConfig { try { potionType = PotionType.valueOf(config.getString(type + "." + treasureName + ".PotionData.PotionType", "WATER")); } catch (IllegalArgumentException ex) { - mcMMO.p.getLogger().warning("Invalid Potion_Type: " + config.getString(type + "." + treasureName + ".PotionData.PotionType", "WATER")); + reason.add("Invalid Potion_Type: " + config.getString(type + "." + treasureName + ".PotionData.PotionType", "WATER")); } boolean extended = config.getBoolean(type + "." + treasureName + ".PotionData.Extended", false); boolean upgraded = config.getBoolean(type + "." + treasureName + ".PotionData.Upgraded", false); @@ -206,49 +210,49 @@ public class TreasureConfig extends BukkitConfig { } } - //TODO: Rewrite legacy validation code - // Look into what needs to change for this - if (isExcavation) { - ExcavationTreasure excavationTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel); - List dropList = config.getStringList(type + "." + treasureName + ".Drops_From"); + if (noErrorsInConfig(reason)) { + if (isExcavation) { + ExcavationTreasure excavationTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel); + List dropList = config.getStringList(type + "." + treasureName + ".Drops_From"); - for (String blockType : dropList) { - if (!excavationMap.containsKey(blockType)) - excavationMap.put(blockType, new ArrayList<>()); - excavationMap.get(blockType).add(excavationTreasure); - } - } else if (isHylian) { - HylianTreasure hylianTreasure = new HylianTreasure(item, xp, dropChance, dropLevel); - List dropList = config.getStringList(type + "." + treasureName + ".Drops_From"); + for (String blockType : dropList) { + if (!excavationMap.containsKey(blockType)) + excavationMap.put(blockType, new ArrayList<>()); + excavationMap.get(blockType).add(excavationTreasure); + } + } else if (isHylian) { + HylianTreasure hylianTreasure = new HylianTreasure(item, xp, dropChance, dropLevel); + List dropList = config.getStringList(type + "." + treasureName + ".Drops_From"); - for (String dropper : dropList) { - if (dropper.equals("Bushes")) { - AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.FERN), hylianTreasure); - AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.TALL_GRASS), hylianTreasure); - for (Material species : Tag.SAPLINGS.getValues()) - AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(species), hylianTreasure); + for (String dropper : dropList) { + if (dropper.equals("Bushes")) { + AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.FERN), hylianTreasure); + AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.TALL_GRASS), hylianTreasure); + for (Material species : Tag.SAPLINGS.getValues()) + AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(species), hylianTreasure); - AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.DEAD_BUSH), hylianTreasure); - continue; + AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.DEAD_BUSH), hylianTreasure); + continue; + } + if (dropper.equals("Flowers")) { + AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.POPPY), hylianTreasure); + AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.DANDELION), hylianTreasure); + AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.BLUE_ORCHID), hylianTreasure); + AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.ALLIUM), hylianTreasure); + AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.AZURE_BLUET), hylianTreasure); + AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.ORANGE_TULIP), hylianTreasure); + AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.PINK_TULIP), hylianTreasure); + AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.RED_TULIP), hylianTreasure); + AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.WHITE_TULIP), hylianTreasure); + continue; + } + if (dropper.equals("Pots")) { + for (Material species : Tag.FLOWER_POTS.getValues()) + AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(species), hylianTreasure); + continue; + } + AddHylianTreasure(dropper, hylianTreasure); } - if (dropper.equals("Flowers")) { - AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.POPPY), hylianTreasure); - AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.DANDELION), hylianTreasure); - AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.BLUE_ORCHID), hylianTreasure); - AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.ALLIUM), hylianTreasure); - AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.AZURE_BLUET), hylianTreasure); - AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.ORANGE_TULIP), hylianTreasure); - AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.PINK_TULIP), hylianTreasure); - AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.RED_TULIP), hylianTreasure); - AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.WHITE_TULIP), hylianTreasure); - continue; - } - if (dropper.equals("Pots")) { - for (Material species : Tag.FLOWER_POTS.getValues()) - AddHylianTreasure(StringUtils.getFriendlyConfigMaterialString(species), hylianTreasure); - continue; - } - AddHylianTreasure(dropper, hylianTreasure); } } } diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 3d33807b3..8a8d3192b 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -125,6 +125,9 @@ public class mcMMO extends JavaPlugin { // API checks private static boolean serverAPIOutdated = false; + // Config Validation Check + public boolean noErrorsInConfigFiles = true; + // XP Event Check private boolean xpEventEnabled; @@ -196,6 +199,10 @@ public class mcMMO extends JavaPlugin { loadConfigFiles(); + if (!noErrorsInConfigFiles) { + return; + } + if (getServer().getName().equals("Cauldron") || getServer().getName().equals("MCPC+")) { checkModConfigs(); } diff --git a/src/main/java/com/gmail/nossr50/skills/child/ChildConfig.java b/src/main/java/com/gmail/nossr50/skills/child/ChildConfig.java index c3d99ffc4..ae4360de7 100644 --- a/src/main/java/com/gmail/nossr50/skills/child/ChildConfig.java +++ b/src/main/java/com/gmail/nossr50/skills/child/ChildConfig.java @@ -15,11 +15,6 @@ public class ChildConfig extends BukkitConfig { loadKeys(); } - @Override - protected void validateConfigKeys() { - //TODO: Rewrite legacy validation code - } - @Override protected void loadKeys() { config.setDefaults(YamlConfiguration.loadConfiguration(mcMMO.p.getResourceAsReader("child.yml"))); diff --git a/src/main/java/com/gmail/nossr50/util/upgrade/UpgradeManager.java b/src/main/java/com/gmail/nossr50/util/upgrade/UpgradeManager.java index 99e8f0f86..2325b2800 100644 --- a/src/main/java/com/gmail/nossr50/util/upgrade/UpgradeManager.java +++ b/src/main/java/com/gmail/nossr50/util/upgrade/UpgradeManager.java @@ -19,12 +19,6 @@ public class UpgradeManager extends BukkitConfig { loadKeys(); } - @Override - protected void validateConfigKeys() { - //TODO: Rewrite legacy validation code - // Look into what needs to change for this - } - /** * Check if the given {@link UpgradeType} is necessary. *