From 24b1485555bdf330fc0b60a052c2b5b51cd61811 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Mon, 29 Jul 2013 00:37:13 +0200 Subject: [PATCH] Validate advanced.yml settings --- .../gmail/nossr50/config/AdvancedConfig.java | 776 +++++++++++++++++- .../java/com/gmail/nossr50/config/Config.java | 7 +- 2 files changed, 776 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index 6fcce8c8f..5e852ecfa 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -1,10 +1,16 @@ package com.gmail.nossr50.config; +import java.util.ArrayList; +import java.util.List; + +import com.gmail.nossr50.mcMMO; + public class AdvancedConfig extends AutoUpdateConfigLoader { private static AdvancedConfig instance; private AdvancedConfig() { super("advanced.yml"); + loadKeys(); } public static AdvancedConfig getInstance() { @@ -16,14 +22,766 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { } @Override - protected void loadKeys() {} + protected void loadKeys() { + // Validate all the settings! + List reason = new ArrayList(); + + /* GENERAL */ + if (getAbilityLength() < 1) { + reason.add("Skills.General.Ability_IncreaseLevel should be at least 1!"); + } + + if (getEnchantBuff() < 1) { + reason.add("Skills.General.Ability_EnchantBuff should be at least 1!"); + } + + /* ACROBATICS */ + if (getDodgeChanceMax() < 1) { + reason.add("Skills.Acrobatics.Dodge_ChanceMax should be at least 1!"); + } + + if (getDodgeMaxBonusLevel() < 1) { + reason.add("Skills.Acrobatics.Dodge_MaxBonusLevel should be at least 1!"); + } + + if (getDodgeDamageModifier() <= 1) { + reason.add("Skills.Acrobatics.Dodge_DamageModifer should be greater than 1!"); + } + + if (getRollChanceMax() < 1) { + reason.add("Skills.Acrobatics.Roll_ChanceMax should be at least 1!"); + } + + if (getRollMaxBonusLevel() < 1) { + reason.add("Skills.Acrobatics.Roll_MaxBonusLevel should be at least 1!"); + } + + if (getRollDamageThreshold() < 0) { + reason.add("Skills.Acrobatics.Roll_DamageThreshold should be at least 0!"); + } + + if (getGracefulRollChanceMax() < 1) { + reason.add("Skills.Acrobatics.GracefulRoll_ChanceMax should be at least 1!"); + } + + if (getGracefulRollMaxBonusLevel() < 1) { + reason.add("Skills.Acrobatics.GracefulRoll_MaxBonusLevel should be at least 1!"); + } + + if (getGracefulRollDamageThreshold() < 0) { + reason.add("Skills.Acrobatics.GracefulRoll_DamageThreshold should be at least 0!"); + } + + if (getDodgeXPModifier() < 0) { + reason.add("Skills.Acrobatics.Dodge_XP_Modifier should be at least 0!"); + } + + if (getRollXPModifier() < 0) { + reason.add("Skills.Acrobatics.Roll_XP_Modifier should be at least 0!"); + } + + if (getFallXPModifier() < 0) { + reason.add("Skills.Acrobatics.Fall_XP_Modifier should be at least 0!"); + } + + /* ARCHERY */ + if (getSkillShotIncreaseLevel() < 1) { + reason.add("Skills.Archery.SkillShot_IncreaseLevel should be at least 1!"); + } + + if (getSkillShotIncreasePercentage() <= 0) { + reason.add("Skills.Archery.SkillShot_IncreasePercentage should be greater than 0!"); + } + + if (getSkillShotBonusMax() < 0) { + reason.add("Skills.Archery.SkillShot_MaxBonus should be at least 0!"); + } + + if (getDazeBonusMax() < 1) { + reason.add("Skills.Acrobatics.Daze_MaxChance should be at least 1!"); + } + + if (getDazeMaxBonusLevel() < 1) { + reason.add("Skills.Acrobatics.Daze_MaxBonusLevel should be at least 1!"); + } + + if (getDazeModifier() < 0) { + reason.add("Skills.Acrobatics.Daze_BonusDamage should be at least 0!"); + } + + if (getRetrieveChanceMax() < 1) { + reason.add("Skills.Acrobatics.Retrieve_MaxBonus should be at least 1!"); + } + + if (getRetrieveMaxBonusLevel() < 1) { + reason.add("Skills.Acrobatics.Retrieve_MaxBonusLevel should be at least 1!"); + } + + if (getForceMultiplier() < 0) { + reason.add("Skills.Acrobatics.Force_Multiplier should be at least 0!"); + } + + /* AXES */ + if (getBonusDamageAxesBonusMax() < 1) { + reason.add("Skills.Axes.DamageIncrease_MaxBonus should be at least 1!"); + } + + if (getBonusDamageAxesMaxBonusLevel() < 1) { + reason.add("Skills.Axes.DamageIncrease_MaxBonusLevel should be at least 1!"); + } + + if (getAxesCriticalChance() < 1) { + reason.add("Skills.Axes.AxesCritical_MaxChance should be at least 1!"); + } + + if (getAxesCriticalMaxBonusLevel() < 1) { + reason.add("Skills.Axes.AxesCritical_MaxBonusLevel should be at least 1!"); + } + + if (getAxesCriticalPVPModifier() < 1) { + reason.add("Skills.Axes.AxesCritical_PVP_Modifier should be at least 1!"); + } + + if (getAxesCriticalPVEModifier() < 1) { + reason.add("Skills.Axes.AxesCritical_PVE_Modifier should be at least 1!"); + } + + if (getGreaterImpactChance() < 1) { + reason.add("Skills.Axes.GreaterImpact_Chance should be at least 1!"); + } + + if (getGreaterImpactModifier() < 1) { + reason.add("Skills.Axes.GreaterImpact_KnockbackModifier should be at least 1!"); + } + + if (getGreaterImpactBonusDamage() < 1) { + reason.add("Skills.Axes.GreaterImpact_BonusDamage should be at least 1!"); + } + + if (getArmorImpactIncreaseLevel() < 1) { + reason.add("Skills.Axes.ArmorImpact_IncreaseLevel should be at least 1!"); + } + + if (getImpactChance() < 1) { + reason.add("Skills.Axes.ArmorImpact_Chance should be at least 1!"); + } + + if (getArmorImpactMaxDurabilityDamage() < 1) { + reason.add("Skills.Axes.ArmorImpact_MaxPercentageDurabilityDamage should be at least 1!"); + } + + if (getSkullSplitterModifier() < 1) { + reason.add("Skills.Axes.SkullSplitter_DamagerModifier should be at least 1!"); + } + + /* FISHING */ + if (getFishingTierLevelsTier1() >= getFishingTierLevelsTier2()) { + reason.add("Skills.Fishing.Tier_Levels.Tier1 should be less than Skills.Fishing.Tier_Levels.Tier2!"); + } + + if (getFishingTierLevelsTier2() >= getFishingTierLevelsTier3()) { + reason.add("Skills.Fishing.Tier_Levels.Tier2 should be less than Skills.Fishing.Tier_Levels.Tier3!"); + } + + if (getFishingTierLevelsTier3() >= getFishingTierLevelsTier4()) { + reason.add("Skills.Fishing.Tier_Levels.Tier3 should be less than Skills.Fishing.Tier_Levels.Tier4!"); + } + + if (getFishingTierLevelsTier4() >= getFishingTierLevelsTier5()) { + reason.add("Skills.Fishing.Tier_Levels.Tier4 should be less than Skills.Fishing.Tier_Levels.Tier5!"); + } + + if (getFishingMagicMultiplier() <= 0) { + reason.add("Skills.Fishing.MagicHunter_Multiplier should be greater than 0!"); + } + + if (getFishermanDietRankChange() < 1) { + reason.add("Skills.Fishing.Fisherman_Diet_RankChange should be at least 1!"); + } + + if (getIceFishingUnlockLevel() < 1) { + reason.add("Skills.Fishing.Ice_Fishing_UnlockLevel should be at least 1!"); + } + + if (getShakeUnlockLevel() < 1) { + reason.add("Skills.Fishing.Shake_UnlockLevel should be at least 1!"); + } + + if (getShakeChanceRank1() > getShakeChanceRank2()) { + reason.add("Skills.Fishing.Shake_Chance.Rank_1 should be less or equal to Skills.Fishing.Shake_Chance.Rank_2!"); + } + + if (getShakeChanceRank2() > getShakeChanceRank3()) { + reason.add("Skills.Fishing.Shake_Chance.Rank_2 should be less or equal to Skills.Fishing.Shake_Chance.Rank_3!"); + } + + if (getShakeChanceRank3() > getShakeChanceRank4()) { + reason.add("Skills.Fishing.Shake_Chance.Rank_3 should be less or equal to Skills.Fishing.Shake_Chance.Rank_4!"); + } + + if (getShakeChanceRank4() > getShakeChanceRank5()) { + reason.add("Skills.Fishing.Shake_Chance.Rank_4 should be less or equal to Skills.Fishing.Shake_Chance.Rank_5!"); + } + + if (getFishingVanillaXPModifierRank1() > getFishingVanillaXPModifierRank2()) { + reason.add("Skills.Fishing.VanillaXPBoost.Rank_1 should be less or equal to Skills.Fishing.VanillaXPBoost.Rank_2!"); + } + + if (getFishingVanillaXPModifierRank2() > getFishingVanillaXPModifierRank3()) { + reason.add("Skills.Fishing.VanillaXPBoost.Rank_2 should be less or equal to Skills.Fishing.VanillaXPBoost.Rank_3!"); + } + + if (getFishingVanillaXPModifierRank3() > getFishingVanillaXPModifierRank4()) { + reason.add("Skills.Fishing.VanillaXPBoost.Rank_3 should be less or equal to Skills.Fishing.VanillaXPBoost.Rank_4!"); + } + + if (getFishingVanillaXPModifierRank4() > getFishingVanillaXPModifierRank5()) { + reason.add("Skills.Fishing.VanillaXPBoost.Rank_4 should be less or equal to Skills.Fishing.VanillaXPBoost.Rank_5!"); + } + + if (getFishingVanillaXPModifierRank1() < 0) { + reason.add("Skills.Fishing.VanillaXPBoost.Rank_1 should be at least 0!"); + } + + if (getFishingVanillaXPModifierRank2() < 0) { + reason.add("Skills.Fishing.VanillaXPBoost.Rank_2 should be at least 0!"); + } + + if (getFishingVanillaXPModifierRank3() < 0) { + reason.add("Skills.Fishing.VanillaXPBoost.Rank_3 should be at least 0!"); + } + + if (getFishingVanillaXPModifierRank4() < 0) { + reason.add("Skills.Fishing.VanillaXPBoost.Rank_4 should be at least 0!"); + } + + if (getFishingVanillaXPModifierRank5() < 0) { + reason.add("Skills.Fishing.VanillaXPBoost.Rank_5 should be at least 0!"); + } + + /* HERBALISM */ + if (getFarmerDietRankChange() < 1) { + reason.add("Skills.Herbalism.Farmer_Diet_RankChange should be at least 1!"); + } + + if (getGreenThumbStageChange() < 1) { + reason.add("Skills.Herbalism.GreenThumb_StageChange should be at least 1!"); + } + + if (getGreenThumbChanceMax() < 1) { + reason.add("Skills.Herbalism.GreenThumb_ChanceMax should be at least 1!"); + } + + if (getGreenThumbMaxLevel() < 1) { + reason.add("Skills.Herbalism.GreenThumb_MaxBonusLevel should be at least 1!"); + } + + if (getHerbalismDoubleDropsChanceMax() < 1) { + reason.add("Skills.Herbalism.DoubleDrops_ChanceMax should be at least 1!"); + } + + if (getHerbalismDoubleDropsMaxLevel() < 1) { + reason.add("Skills.Herbalism.DoubleDrops_MaxBonusLevel should be at least 1!"); + } + + if (getHylianLuckChanceMax() < 1) { + reason.add("Skills.Herbalism.HylianLuck_ChanceMax should be at least 1!"); + } + + if (getHylianLuckMaxLevel() < 1) { + reason.add("Skills.Herbalism.HylianLuck_MaxBonusLevel should be at least 1!"); + } + + if (getShroomThumbChanceMax() < 1) { + reason.add("Skills.Herbalism.ShroomThumb_ChanceMax should be at least 1!"); + } + + if (getShroomThumbMaxLevel() < 1) { + reason.add("Skills.Herbalism.ShroomThumb_MaxBonusLevel should be at least 1!"); + } + + /* MINING */ + if (getMiningDoubleDropChance() < 1) { + reason.add("Skills.Mining.DoubleDrops_ChanceMax should be at least 1!"); + } + + if (getMiningDoubleDropMaxLevel() < 1) { + reason.add("Skills.Mining.DoubleDrops_MaxBonusLevel should be at least 1!"); + } + + if (getBlastMiningRank1() > getBlastMiningRank2()) { + reason.add("Skills.Mining.BlastMining_Rank1 should be less or equal to Skills.Mining.BlastMining_Rank2!"); + } + + if (getBlastMiningRank2() > getBlastMiningRank3()) { + reason.add("Skills.Mining.BlastMining_Rank2 should be less or equal to Skills.Mining.BlastMining_Rank3!"); + } + + if (getBlastMiningRank3() > getBlastMiningRank4()) { + reason.add("Skills.Mining.BlastMining_Rank3 should be less or equal to Skills.Mining.BlastMining_Rank4!"); + } + + if (getBlastMiningRank4() > getBlastMiningRank5()) { + reason.add("Skills.Mining.BlastMining_Rank4 should be less or equal to Skills.Mining.BlastMining_Rank5!"); + } + + if (getBlastMiningRank5() > getBlastMiningRank6()) { + reason.add("Skills.Mining.BlastMining_Rank5 should be less or equal to Skills.Mining.BlastMining_Rank6!"); + } + + if (getBlastMiningRank6() > getBlastMiningRank7()) { + reason.add("Skills.Mining.BlastMining_Rank6 should be less or equal to Skills.Mining.BlastMining_Rank7!"); + } + + if (getBlastMiningRank7() > getBlastMiningRank8()) { + reason.add("Skills.Mining.BlastMining_Rank7 should be less or equal to Skills.Mining.BlastMining_Rank8!"); + } + + if (getBlastDamageDecreaseRank1() > getBlastDamageDecreaseRank2()) { + reason.add("Skills.Mining.BlastDamageDecrease_Rank1 should be less or equal to Skills.Mining.BlastDamageDecrease_Rank2!"); + } + + if (getBlastDamageDecreaseRank2() > getBlastDamageDecreaseRank3()) { + reason.add("Skills.Mining.BlastDamageDecrease_Rank2 should be less or equal to Skills.Mining.BlastDamageDecrease_Rank3!"); + } + + if (getBlastDamageDecreaseRank3() > getBlastDamageDecreaseRank4()) { + reason.add("Skills.Mining.BlastDamageDecrease_Rank3 should be less or equal to Skills.Mining.BlastDamageDecrease_Rank4!"); + } + + if (getBlastDamageDecreaseRank4() > getBlastDamageDecreaseRank5()) { + reason.add("Skills.Mining.BlastDamageDecrease_Rank4 should be less or equal to Skills.Mining.BlastDamageDecrease_Rank5!"); + } + + if (getBlastDamageDecreaseRank5() > getBlastDamageDecreaseRank6()) { + reason.add("Skills.Mining.BlastDamageDecrease_Rank5 should be less or equal to Skills.Mining.BlastDamageDecrease_Rank6!"); + } + + if (getBlastDamageDecreaseRank6() > getBlastDamageDecreaseRank7()) { + reason.add("Skills.Mining.BlastDamageDecrease_Rank6 should be less or equal to Skills.Mining.BlastDamageDecrease_Rank7!"); + } + + if (getBlastDamageDecreaseRank7() > getBlastDamageDecreaseRank8()) { + reason.add("Skills.Mining.BlastDamageDecrease_Rank7 should be less or equal to Skills.Mining.BlastDamageDecrease_Rank8!"); + } + + if (getOreBonusRank1() > getOreBonusRank2()) { + reason.add("Skills.Mining.OreBonus_Rank1 should be less or equal to Skills.Mining.OreBonus_Rank2!"); + } + + if (getOreBonusRank2() > getOreBonusRank3()) { + reason.add("Skills.Mining.OreBonus_Rank2 should be less or equal to Skills.Mining.OreBonus_Rank3!"); + } + + if (getOreBonusRank3() > getOreBonusRank4()) { + reason.add("Skills.Mining.OreBonus_Rank3 should be less or equal to Skills.Mining.OreBonus_Rank4!"); + } + + if (getOreBonusRank4() > getOreBonusRank5()) { + reason.add("Skills.Mining.OreBonus_Rank4 should be less or equal to Skills.Mining.OreBonus_Rank5!"); + } + + if (getOreBonusRank5() > getOreBonusRank6()) { + reason.add("Skills.Mining.OreBonus_Rank5 should be less or equal to Skills.Mining.OreBonus_Rank6!"); + } + + if (getOreBonusRank6() > getOreBonusRank7()) { + reason.add("Skills.Mining.OreBonus_Rank6 should be less or equal to Skills.Mining.OreBonus_Rank7!"); + } + + if (getOreBonusRank7() > getOreBonusRank8()) { + reason.add("Skills.Mining.OreBonus_Rank7 should be less or equal to Skills.Mining.OreBonus_Rank8!"); + } + + if (getDebrisReductionRank1() > getDebrisReductionRank2()) { + reason.add("Skills.Mining.DebrisReduction_Rank1 should be less or equal to Skills.Mining.DebrisReduction_Rank2!"); + } + + if (getDebrisReductionRank2() > getDebrisReductionRank3()) { + reason.add("Skills.Mining.DebrisReduction_Rank2 should be less or equal to Skills.Mining.DebrisReduction_Rank3!"); + } + + if (getDebrisReductionRank3() > getDebrisReductionRank4()) { + reason.add("Skills.Mining.DebrisReduction_Rank3 should be less or equal to Skills.Mining.DebrisReduction_Rank4!"); + } + + if (getDebrisReductionRank4() > getDebrisReductionRank5()) { + reason.add("Skills.Mining.DebrisReduction_Rank4 should be less or equal to Skills.Mining.DebrisReduction_Rank5!"); + } + + if (getDebrisReductionRank5() > getDebrisReductionRank6()) { + reason.add("Skills.Mining.DebrisReduction_Rank5 should be less or equal to Skills.Mining.DebrisReduction_Rank6!"); + } + + if (getDebrisReductionRank6() > getDebrisReductionRank7()) { + reason.add("Skills.Mining.DebrisReduction_Rank6 should be less or equal to Skills.Mining.DebrisReduction_Rank7!"); + } + + if (getDebrisReductionRank7() > getDebrisReductionRank8()) { + reason.add("Skills.Mining.DebrisReduction_Rank7 should be less or equal to Skills.Mining.DebrisReduction_Rank8!"); + } + + if (getDropMultiplierRank1() > getDropMultiplierRank2()) { + reason.add("Skills.Mining.DropMultiplier_Rank1 should be less or equal to Skills.Mining.DropMultiplier_Rank2!"); + } + + if (getDropMultiplierRank2() > getDropMultiplierRank3()) { + reason.add("Skills.Mining.DropMultiplier_Rank2 should be less or equal to Skills.Mining.DropMultiplier_Rank3!"); + } + + if (getDropMultiplierRank3() > getDropMultiplierRank4()) { + reason.add("Skills.Mining.DropMultiplier_Rank3 should be less or equal to Skills.Mining.DropMultiplier_Rank4!"); + } + + if (getDropMultiplierRank4() > getDropMultiplierRank5()) { + reason.add("Skills.Mining.DropMultiplier_Rank4 should be less or equal to Skills.Mining.DropMultiplier_Rank5!"); + } + + if (getDropMultiplierRank5() > getDropMultiplierRank6()) { + reason.add("Skills.Mining.DropMultiplier_Rank5 should be less or equal to Skills.Mining.DropMultiplier_Rank6!"); + } + + if (getDropMultiplierRank6() > getDropMultiplierRank7()) { + reason.add("Skills.Mining.DropMultiplier_Rank6 should be less or equal to Skills.Mining.DropMultiplier_Rank7!"); + } + + if (getDropMultiplierRank7() > getDropMultiplierRank8()) { + reason.add("Skills.Mining.DropMultiplier_Rank7 should be less or equal to Skills.Mining.DropMultiplier_Rank8!"); + } + + if (getBlastRadiusModifierRank1() > getBlastRadiusModifierRank2()) { + reason.add("Skills.Mining.BlastRadiusModifier_Rank1 should be less or equal to Skills.Mining.BlastRadiusModifier_Rank2!"); + } + + if (getBlastRadiusModifierRank2() > getBlastRadiusModifierRank3()) { + reason.add("Skills.Mining.BlastRadiusModifier_Rank2 should be less or equal to Skills.Mining.BlastRadiusModifier_Rank3!"); + } + + if (getBlastRadiusModifierRank3() > getBlastRadiusModifierRank4()) { + reason.add("Skills.Mining.BlastRadiusModifier_Rank3 should be less or equal to Skills.Mining.BlastRadiusModifier_Rank4!"); + } + + if (getBlastRadiusModifierRank4() > getBlastRadiusModifierRank5()) { + reason.add("Skills.Mining.BlastRadiusModifier_Rank4 should be less or equal to Skills.Mining.BlastRadiusModifier_Rank5!"); + } + + if (getBlastRadiusModifierRank5() > getBlastRadiusModifierRank6()) { + reason.add("Skills.Mining.BlastRadiusModifier_Rank5 should be less or equal to Skills.Mining.BlastRadiusModifier_Rank6!"); + } + + if (getBlastRadiusModifierRank6() > getBlastRadiusModifierRank7()) { + reason.add("Skills.Mining.BlastRadiusModifier_Rank6 should be less or equal to Skills.Mining.BlastRadiusModifier_Rank7!"); + } + + if (getBlastRadiusModifierRank7() > getBlastRadiusModifierRank8()) { + reason.add("Skills.Mining.BlastRadiusModifier_Rank7 should be less or equal to Skills.Mining.BlastRadiusModifier_Rank8!"); + } + + /* REPAIR */ + if (getRepairMasteryMaxBonus() < 1) { + reason.add("Skills.Repair.RepairMastery_MaxBonusPercentage should be at least 1!"); + } + + if (getRepairMasteryMaxLevel() < 1) { + reason.add("Skills.Repair.RepairMastery_MaxBonusLevel should be at least 1!"); + } + + if (getSuperRepairChanceMax() < 1) { + reason.add("Skills.Repair.SuperRepair_ChanceMax should be at least 1!"); + } + + if (getSuperRepairMaxLevel() < 1) { + reason.add("Skills.Repair.SuperRepair_MaxBonusLevel should be at least 1!"); + } + + if (getSalvageUnlockLevel() < 1) { + reason.add("Skills.Repair.Salvage_UnlockLevel should be at least 1!"); + } + + if (getArcaneForgingDowngradeChanceRank1() < 1 || getArcaneForgingDowngradeChanceRank1() > 100) { + reason.add("Skills.Repair.Arcane_Forging.Downgrades.Chance.Rank_1 only accepts values from 1 to 100!"); + } + + if (getArcaneForgingDowngradeChanceRank2() < 1 || getArcaneForgingDowngradeChanceRank2() > 100) { + reason.add("Skills.Repair.Arcane_Forging.Downgrades.Chance.Rank_2 only accepts values from 1 to 100!"); + } + + if (getArcaneForgingDowngradeChanceRank3() < 1 || getArcaneForgingDowngradeChanceRank3() > 100) { + reason.add("Skills.Repair.Arcane_Forging.Downgrades.Chance.Rank_3 only accepts values from 1 to 100!"); + } + + if (getArcaneForgingDowngradeChanceRank4() < 1 || getArcaneForgingDowngradeChanceRank4() > 100) { + reason.add("Skills.Repair.Arcane_Forging.Downgrades.Chance.Rank_4 only accepts values from 1 to 100!"); + } + + if (getArcaneForgingKeepEnchantsChanceRank1() < 1 || getArcaneForgingKeepEnchantsChanceRank1() > 100) { + reason.add("Skills.Repair.Arcane_Forging.Keep_Enchants.Chance.Rank_1 only accepts values from 1 to 100!"); + } + + if (getArcaneForgingDowngradeChanceRank2() < 1 || getArcaneForgingDowngradeChanceRank2() > 100) { + reason.add("Skills.Repair.Arcane_Forging.Keep_Enchants.Chance.Rank_2 only accepts values from 1 to 100!"); + } + + if (getArcaneForgingDowngradeChanceRank3() < 1 || getArcaneForgingDowngradeChanceRank3() > 100) { + reason.add("Skills.Repair.Arcane_Forging.Keep_Enchants.Chance.Rank_3 only accepts values from 1 to 100!"); + } + + if (getArcaneForgingDowngradeChanceRank4() < 1 || getArcaneForgingDowngradeChanceRank4() > 100) { + reason.add("Skills.Repair.Arcane_Forging.Keep_Enchants.Chance.Rank_4 only accepts values from 1 to 100!"); + } + + if (getArcaneForgingRankLevels1() < 0) { + reason.add("Skills.Repair.Arcane_Forging.Rank_Levels.Rank_1 should be at least 0!"); + } + + if (getArcaneForgingRankLevels2() < 0) { + reason.add("Skills.Repair.Arcane_Forging.Rank_Levels.Rank_2 should be at least 0!"); + } + + if (getArcaneForgingRankLevels3() < 0) { + reason.add("Skills.Repair.Arcane_Forging.Rank_Levels.Rank_3 should be at least 0!"); + } + + if (getArcaneForgingRankLevels4() < 0) { + reason.add("Skills.Repair.Arcane_Forging.Rank_Levels.Rank_4 should be at least 0!"); + } + + /* SMELTING */ + if (getBurnModifierMaxLevel() < 1) { + reason.add("Skills.Smelting.FuelEfficiency_MaxBonusLevel should be at least 1!"); + } + + if (getBurnTimeMultiplier() < 1) { + reason.add("Skills.Smelting.FuelEfficiency_Multiplier should be at least 1!"); + } + + if (getSecondSmeltMaxLevel() < 1) { + reason.add("Skills.Smelting.SecondSmelt_MaxBonusLevel should be at least 1!"); + } + + if (getSecondSmeltMaxChance() < 1) { + reason.add("Skills.Smelting.SecondSmelt_MaxBonusChance should be at least 1!"); + } + + if (getFluxMiningUnlockLevel() < 1) { + reason.add("Skills.Smelting.FluxMining_UnlockLevel should be at least 1!"); + } + + if (getFluxMiningChance() < 1) { + reason.add("Skills.Smelting.FluxMining_Chance should be at least 1!"); + } + + if (getSmeltingVanillaXPBoostRank1Level() > getSmeltingVanillaXPBoostRank2Level()) { + reason.add("Skills.Smelting.VanillaXPBoost_Rank1Level should be less or equal to Skills.Smelting.VanillaXPBoost_Rank2Level!"); + } + + if (getSmeltingVanillaXPBoostRank2Level() > getSmeltingVanillaXPBoostRank3Level()) { + reason.add("Skills.Smelting.VanillaXPBoost_Rank2Level should be less or equal to Skills.Smelting.VanillaXPBoost_Rank3Level!"); + } + + if (getSmeltingVanillaXPBoostRank3Level() > getSmeltingVanillaXPBoostRank4Level()) { + reason.add("Skills.Smelting.VanillaXPBoost_Rank3Level should be less or equal to Skills.Smelting.VanillaXPBoost_Rank4Level!"); + } + + if (getSmeltingVanillaXPBoostRank4Level() > getSmeltingVanillaXPBoostRank5Level()) { + reason.add("Skills.Smelting.VanillaXPBoost_Rank4Level should be less or equal to Skills.Smelting.VanillaXPBoost_Rank5Level!"); + } + + if (getSmeltingVanillaXPBoostRank1Multiplier() < 1) { + reason.add("Skills.Smelting.VanillaXPBoost_Rank1Multiplier should be at least 1!"); + } + + if (getSmeltingVanillaXPBoostRank2Multiplier() < 1) { + reason.add("Skills.Smelting.VanillaXPBoost_Rank2Multiplier should be at least 1!"); + } + + if (getSmeltingVanillaXPBoostRank3Multiplier() < 1) { + reason.add("Skills.Smelting.VanillaXPBoost_Rank3Multiplier should be at least 1!"); + } + + if (getSmeltingVanillaXPBoostRank4Multiplier() < 1) { + reason.add("Skills.Smelting.VanillaXPBoost_Rank4Multiplier should be at least 1!"); + } + + if (getSmeltingVanillaXPBoostRank5Multiplier() < 1) { + reason.add("Skills.Smelting.VanillaXPBoost_Rank5Multiplier should be at least 1!"); + } + + /* SWORDS */ + if (getBleedChanceMax() < 1) { + reason.add("Skills.Swords.Bleed_ChanceMax should be at least 1!"); + } + + if (getBleedMaxBonusLevel() < 1) { + reason.add("Skills.Swords.Bleed_MaxBonusLevel should be at least 1!"); + } + + if (getBleedMaxTicks() < 1) { + reason.add("Skills.Swords.Bleed_MaxTicks should be at least 1!"); + } + + if (getBleedMaxTicks() < getBleedBaseTicks()) { + reason.add("Skills.Swords.Bleed_MaxTicks should be at least Skills.Swords.Bleed_BaseTicks!"); + } + + if (getBleedBaseTicks() < 1) { + reason.add("Skills.Swords.Bleed_BaseTicks should be at least 1!"); + } + + if (getCounterChanceMax() < 1) { + reason.add("Skills.Swords.Counter_ChanceMax should be at least 1!"); + } + + if (getCounterMaxBonusLevel() < 1) { + reason.add("Skills.Swords.Counter_MaxBonusLevel should be at least 1!"); + } + + if (getCounterModifier() < 1) { + reason.add("Skills.Swords.Counter_DamageModifier should be at least 1!"); + } + + if (getSerratedStrikesModifier() < 1) { + reason.add("Skills.Swords.SerratedStrikes_DamageModifier should be at least 1!"); + } + + if (getSerratedStrikesTicks() < 1) { + reason.add("Skills.Swords.SerratedStrikes_BleedTicks should be at least 1!"); + } + + /* TAMING */ + + if (getGoreChanceMax() < 1) { + reason.add("Skills.Taming.Gore_ChanceMax should be at least 1!"); + } + + if (getGoreMaxBonusLevel() < 1) { + reason.add("Skills.Taming.Gore_MaxBonusLevel should be at least 1!"); + } + + if (getGoreBleedTicks() < 1) { + reason.add("Skills.Taming.Gore_BleedTicks should be at least 1!"); + } + + if (getGoreModifier() < 1) { + reason.add("Skills.Taming.Gore_Modifier should be at least 1!"); + } + + if (getFastFoodUnlock() < 1) { + reason.add("Skills.Taming.FastFood_UnlockLevel should be at least 1!"); + } + + if (getFastFoodChance() < 1) { + reason.add("Skills.Taming.FastFood_Chance should be at least 1!"); + } + + if (getEnviromentallyAwareUnlock() < 1) { + reason.add("Skills.Taming.EnvironmentallyAware_UnlockLevel should be at least 1!"); + } + + if (getThickFurUnlock() < 1) { + reason.add("Skills.Taming.ThickFur_UnlockLevel should be at least 1!"); + } + + if (getThickFurModifier() < 1) { + reason.add("Skills.Taming.ThickFur_Modifier should be at least 1!"); + } + + if (getHolyHoundUnlock() < 1) { + reason.add("Skills.Taming.HolyHound_UnlockLevel should be at least 1!"); + } + + if (getShockProofUnlock() < 1) { + reason.add("Skills.Taming.ShockProof_UnlockLevel should be at least 1!"); + } + + if (getShockProofModifier() < 1) { + reason.add("Skills.Taming.ShockProof_Modifier should be at least 1!"); + } + + if (getSharpenedClawsUnlock() < 1) { + reason.add("Skills.Taming.SharpenedClaws_UnlockLevel should be at least 1!"); + } + + if (getSharpenedClawsBonus() < 1) { + reason.add("Skills.Taming.SharpenedClaws_Bonus should be at least 1!"); + } + + + /* UNARMED */ + if (getDisarmChanceMax() < 1) { + reason.add("Skills.Unarmed.Disarm_ChanceMax should be at least 1!"); + } + + if (getDisarmMaxBonusLevel() < 1) { + reason.add("Skills.Unarmed.Disarm_MaxBonusLevel should be at least 1!"); + } + + if (getDeflectChanceMax() < 1) { + reason.add("Skills.Unarmed.Deflect_ChanceMax should be at least 1!"); + } + + if (getDeflectMaxBonusLevel() < 1) { + reason.add("Skills.Unarmed.Deflect_MaxBonusLevel should be at least 1!"); + } + + if (getIronGripChanceMax() < 1) { + reason.add("Skills.Unarmed.IronGrip_ChanceMax should be at least 1!"); + } + + if (getIronGripMaxBonusLevel() < 1) { + reason.add("Skills.Unarmed.IronGrip_MaxBonusLevel should be at least 1!"); + } + + if (getIronArmMaxBonus() < 0) { + reason.add("Skills.Unarmed.IronArm_BonusMax should be at least 0!"); + } + + if (getIronArmIncreaseLevel() < 1) { + reason.add("Skills.Unarmed.IronArm_IncreaseLevel should be at least 1!"); + } + + /* WOODCUTTING */ + if (getLeafBlowUnlockLevel() < 1) { + reason.add("Skills.Woodcutting.LeafBlower_UnlockLevel should be at least 1!"); + } + + if (getWoodcuttingDoubleDropChance() < 1) { + reason.add("Skills.Woodcutting.DoubleDrops_ChanceMax should be at least 1!"); + } + + if (getWoodcuttingDoubleDropMaxLevel() < 1) { + reason.add("Skills.Woodcutting.DoubleDrops_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!"); + } + + // Check if there were any errors + if (noErrorsInConfig(reason)) { + mcMMO.p.debug("No errors found in " + fileName + "!"); + } else { + mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!"); + mcMMO.p.getServer().getPluginManager().disablePlugin(mcMMO.p); + } + } /* GENERAL */ public int getAbilityLength() { return config.getInt("Skills.General.Ability_IncreaseLevel", 50); } - public int getEnchantBuff() { - int buff = config.getInt("Skills.General.Ability_EnchantBuff", 5); - return (buff <= 0) ? 1 : buff; - } + public int getEnchantBuff() { return config.getInt("Skills.General.Ability_EnchantBuff", 5); } /* ACROBATICS */ public double getDodgeChanceMax() { return config.getDouble("Skills.Acrobatics.Dodge_ChanceMax", 20.0D); } @@ -292,4 +1050,12 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { public String getPlayerEscapeMessage() { return config.getString("Kraken.Defeated_Message.Escape", "You have escaped from the kraken!"); } public int getKrakenAttackInterval() { return config.getInt("Kraken.Attack_Interval_Seconds", 1); } public int getKrakenAttackDamage() { return config.getInt("Kraken.Attack_Damage", 1); } + + private boolean noErrorsInConfig(List issues) {//TODO move this to misc + for (String issue : issues) { + plugin.getLogger().warning(issue); + } + + return issues.isEmpty(); + } } diff --git a/src/main/java/com/gmail/nossr50/config/Config.java b/src/main/java/com/gmail/nossr50/config/Config.java index dd856b5f8..09d699c94 100644 --- a/src/main/java/com/gmail/nossr50/config/Config.java +++ b/src/main/java/com/gmail/nossr50/config/Config.java @@ -67,7 +67,7 @@ public class Config extends AutoUpdateConfigLoader { } /* Database Purging */ - if (getPurgeInterval() <= -1) { + if (getPurgeInterval() < -1) { reason.add("Database_Purging.Purge_Interval should be greater than, or equal to -1!"); } @@ -202,7 +202,10 @@ public class Config extends AutoUpdateConfigLoader { // Check if there were any errors if (noErrorsInConfig(reason)) { - mcMMO.p.debug("No errors found in config.yml!"); + mcMMO.p.debug("No errors found in " + fileName + "!"); + } else { + mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!"); + mcMMO.p.getServer().getPluginManager().disablePlugin(mcMMO.p); } }