mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Revert 3 commits (work will be continued in branch)
Revert "Disabling mcMMO when the config breaks is dumb" This reverts commit86e7bfbf89
. Revert "Config validation rewrite part 1" This reverts commit16e90da8fd
. Revert "Update changelog" This reverts commit0ccd89fad4
.
This commit is contained in:
parent
8b6a4c1e5b
commit
fa33fa3d32
@ -1,7 +1,5 @@
|
|||||||
Version 2.1.210
|
Version 2.1.210
|
||||||
Fixed a memory leak involving mob metadata
|
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:
|
NOTES:
|
||||||
There was a big rewrite in this update relating to how various types of metadata were being tracked/stored/retrieved
|
There was a big rewrite in this update relating to how various types of metadata were being tracked/stored/retrieved
|
||||||
|
@ -14,6 +14,7 @@ public class AdvancedConfig extends BukkitConfig {
|
|||||||
|
|
||||||
public AdvancedConfig(File dataFolder) {
|
public AdvancedConfig(File dataFolder) {
|
||||||
super("advanced.yml", dataFolder);
|
super("advanced.yml", dataFolder);
|
||||||
|
validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -22,125 +23,125 @@ public class AdvancedConfig extends BukkitConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void validateConfigKeys() {
|
protected boolean validateKeys() {
|
||||||
//TODO: Rewrite legacy validation code
|
// Validate all the settings!
|
||||||
List<String> reason = new ArrayList<>();
|
List<String> reason = new ArrayList<>();
|
||||||
|
|
||||||
/* GENERAL */
|
/* GENERAL */
|
||||||
if (getAbilityLength() < 1) {
|
if (getAbilityLength() < 1) {
|
||||||
mcMMO.p.getLogger().warning("Skills.General.Ability.Length.<mode>.IncreaseLevel should be at least 1!");
|
reason.add("Skills.General.Ability.Length.<mode>.IncreaseLevel should be at least 1!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getEnchantBuff() < 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 */
|
/* ACROBATICS */
|
||||||
if (getMaximumProbability(SubSkillType.ACROBATICS_DODGE) < 1) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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()) {
|
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 */
|
/* ARCHERY */
|
||||||
|
|
||||||
if (getSkillShotRankDamageMultiplier() <= 0) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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 */
|
/* AXES */
|
||||||
if (getAxeMasteryRankDamageMultiplier() < 0) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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 */
|
/* FISHING */
|
||||||
@ -148,261 +149,262 @@ public class AdvancedConfig extends BukkitConfig {
|
|||||||
|
|
||||||
for (int rank : fishingTierList) {
|
for (int rank : fishingTierList) {
|
||||||
if (getFishingTierLevel(tier) < 0) {
|
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) {
|
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) {
|
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) {
|
if (tier != Fishing.Tier.EIGHT) {
|
||||||
Fishing.Tier nextTier = fishingTierList.get(fishingTierList.indexOf(tier) - 1);
|
Fishing.Tier nextTier = fishingTierList.get(fishingTierList.indexOf(tier) - 1);
|
||||||
|
|
||||||
if (getFishingTierLevel(tier) > getFishingTierLevel(nextTier)) {
|
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)) {
|
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)) {
|
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) {
|
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) {
|
/*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) {
|
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) {
|
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) {
|
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 */
|
/* HERBALISM */
|
||||||
if (getFarmerDietRankChange() < 1) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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 */
|
/* MINING */
|
||||||
if (getMaximumProbability(SubSkillType.MINING_DOUBLE_DROPS) < 1) {
|
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) {
|
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 */
|
/* REPAIR */
|
||||||
if (getRepairMasteryMaxBonus() < 1) {
|
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) {
|
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) {
|
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) {
|
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 */
|
/* SMELTING */
|
||||||
if (getBurnModifierMaxLevel() < 1) {
|
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) {
|
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) {
|
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) {
|
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 */
|
/* SWORDS */
|
||||||
|
|
||||||
if (getMaximumProbability(SubSkillType.SWORDS_COUNTER_ATTACK) < 1) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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 */
|
/* TAMING */
|
||||||
|
|
||||||
if (getMaximumProbability(SubSkillType.TAMING_GORE) < 1) {
|
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) {
|
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) {
|
/*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) {
|
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) {
|
/*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) {
|
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) {
|
/*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) {
|
/*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) {
|
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) {
|
/*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) {
|
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) {
|
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) {
|
/*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) {
|
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) {
|
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 */
|
/* UNARMED */
|
||||||
if (getMaximumProbability(SubSkillType.UNARMED_DISARM) < 1) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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 */
|
/* WOODCUTTING */
|
||||||
|
|
||||||
/*if (getLeafBlowUnlockLevel() < 0) {
|
/*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) {
|
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) {
|
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
|
@Override
|
||||||
|
@ -7,18 +7,18 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public abstract class BukkitConfig {
|
public abstract class BukkitConfig {
|
||||||
protected static final String CONFIG_PATCH_PREFIX = "ConfigPatchVersion:";
|
public static final String CONFIG_PATCH_PREFIX = "ConfigPatchVersion:";
|
||||||
protected static final String CURRENT_CONFIG_PATCH_VER = "ConfigPatchVersion: 2";
|
public static final String CURRENT_CONFIG_PATCH_VER = "ConfigPatchVersion: 2";
|
||||||
protected static final char COMMENT_PREFIX = '#';
|
public static final char COMMENT_PREFIX = '#';
|
||||||
protected final String fileName;
|
protected final String fileName;
|
||||||
protected final File configFile;
|
protected final File configFile;
|
||||||
protected YamlConfiguration config;
|
protected YamlConfiguration config;
|
||||||
protected @NotNull
|
protected @NotNull
|
||||||
final File dataFolder;
|
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) {
|
public BukkitConfig(@NotNull String fileName, @NotNull File dataFolder) {
|
||||||
mcMMO.p.getLogger().info("[config] Initializing config: " + fileName);
|
mcMMO.p.getLogger().info("[config] Initializing config: " + fileName);
|
||||||
@ -30,7 +30,6 @@ public abstract class BukkitConfig {
|
|||||||
initDefaults();
|
initDefaults();
|
||||||
updateFile();
|
updateFile();
|
||||||
mcMMO.p.getLogger().info("[config] Config initialized: " + fileName);
|
mcMMO.p.getLogger().info("[config] Config initialized: " + fileName);
|
||||||
validate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -84,28 +83,25 @@ public abstract class BukkitConfig {
|
|||||||
|
|
||||||
protected abstract void loadKeys();
|
protected abstract void loadKeys();
|
||||||
|
|
||||||
protected abstract void validateConfigKeys();
|
protected boolean validateKeys() {
|
||||||
|
return true;
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validate() {
|
protected boolean noErrorsInConfig(List<String> issues) {
|
||||||
//TODO: Rewrite legacy validation code
|
for (String issue : issues) {
|
||||||
validateConfigKeys();
|
mcMMO.p.getLogger().warning(issue);
|
||||||
|
}
|
||||||
|
|
||||||
if (unmodifiedConfig) {
|
return issues.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void validate() {
|
||||||
|
if (validateKeys()) {
|
||||||
mcMMO.p.debug("No errors found in " + fileName + "!");
|
mcMMO.p.debug("No errors found in " + fileName + "!");
|
||||||
} else {
|
} else {
|
||||||
mcMMO.p.getLogger().warning("Errors were found in " + fileName + ", overwriting invalid values with defaults");
|
mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!");
|
||||||
try {
|
mcMMO.p.getServer().getPluginManager().disablePlugin(mcMMO.p);
|
||||||
config.save(configFile);
|
mcMMO.p.noErrorsInConfigFiles = false;
|
||||||
unmodifiedConfig = true;
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ public class ChatConfig extends BukkitConfig {
|
|||||||
|
|
||||||
private ChatConfig() {
|
private ChatConfig() {
|
||||||
super("chat.yml");
|
super("chat.yml");
|
||||||
|
validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ChatConfig getInstance() {
|
public static ChatConfig getInstance() {
|
||||||
@ -25,8 +26,8 @@ public class ChatConfig extends BukkitConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void validateConfigKeys() {
|
protected boolean validateKeys() {
|
||||||
//TODO: Rewrite legacy validation code
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isChatEnabled() {
|
public boolean isChatEnabled() {
|
||||||
|
@ -79,6 +79,7 @@ public abstract class ConfigLoader {
|
|||||||
} else {
|
} else {
|
||||||
mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!");
|
mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!");
|
||||||
mcMMO.p.getServer().getPluginManager().disablePlugin(mcMMO.p);
|
mcMMO.p.getServer().getPluginManager().disablePlugin(mcMMO.p);
|
||||||
|
mcMMO.p.noErrorsInConfigFiles = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ public class CoreSkillsConfig extends BukkitConfig {
|
|||||||
|
|
||||||
public CoreSkillsConfig() {
|
public CoreSkillsConfig() {
|
||||||
super("coreskills.yml");
|
super("coreskills.yml");
|
||||||
|
validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CoreSkillsConfig getInstance() {
|
public static CoreSkillsConfig getInstance() {
|
||||||
@ -24,8 +25,9 @@ public class CoreSkillsConfig extends BukkitConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void validateConfigKeys() {
|
protected boolean validateKeys() {
|
||||||
//TODO: Rewrite legacy validation code
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.MobHealthbarType;
|
|||||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.util.text.StringUtils;
|
import com.gmail.nossr50.util.text.StringUtils;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
@ -23,6 +22,7 @@ public class GeneralConfig extends BukkitConfig {
|
|||||||
|
|
||||||
public GeneralConfig(@NotNull File dataFolder) {
|
public GeneralConfig(@NotNull File dataFolder) {
|
||||||
super("config.yml", dataFolder);
|
super("config.yml", dataFolder);
|
||||||
|
validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -31,125 +31,127 @@ public class GeneralConfig extends BukkitConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void validateConfigKeys() {
|
protected boolean validateKeys() {
|
||||||
//TODO: Rewrite legacy validation code
|
// Validate all the settings!
|
||||||
List<String> reason = new ArrayList<>();
|
List<String> reason = new ArrayList<>();
|
||||||
|
|
||||||
/* General Settings */
|
/* General Settings */
|
||||||
if (getSaveInterval() <= 0) {
|
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 */
|
/* MySQL Settings */
|
||||||
for (PoolIdentifier identifier : PoolIdentifier.values()) {
|
for (PoolIdentifier identifier : PoolIdentifier.values()) {
|
||||||
if (getMySQLMaxConnections(identifier) <= 0) {
|
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) {
|
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 */
|
/* Mob Healthbar */
|
||||||
if (getMobHealthbarTime() == 0) {
|
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 */
|
/* Database Purging */
|
||||||
if (getPurgeInterval() < -1) {
|
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) {
|
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 */
|
/* Hardcore Mode */
|
||||||
if (getHardcoreDeathStatPenaltyPercentage() < 0.01 || getHardcoreDeathStatPenaltyPercentage() > 100) {
|
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) {
|
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 */
|
/* Items */
|
||||||
if (getChimaeraUseCost() < 1 || getChimaeraUseCost() > 64) {
|
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) {
|
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) {
|
if (getChimaeraItem() == null) {
|
||||||
mcMMO.p.getLogger().warning("Items.Chimaera_Wing.Item_Name is invalid!");
|
reason.add("Items.Chimaera_Wing.Item_Name is invalid!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Particles */
|
/* Particles */
|
||||||
if (getLevelUpEffectsTier() < 1) {
|
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 */
|
/* PARTY SETTINGS */
|
||||||
if (getAutoPartyKickInterval() < -1) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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()) {
|
for (PartyFeature partyFeature : PartyFeature.values()) {
|
||||||
if (getPartyFeatureUnlockLevel(partyFeature) < 0) {
|
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 */
|
/* Inspect command distance */
|
||||||
if (getInspectDistance() <= 0) {
|
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) {
|
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) {
|
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) {
|
if (getRepairAnvilMaterial() == null) {
|
||||||
mcMMO.p.getLogger().warning("Skills.Repair.Anvil_Type is invalid!!");
|
reason.add("Skills.Repair.Anvil_Type is invalid!!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getSalvageAnvilMaterial() == null) {
|
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()) {
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -7,6 +7,7 @@ public class PersistentDataConfig extends BukkitConfig {
|
|||||||
|
|
||||||
private PersistentDataConfig() {
|
private PersistentDataConfig() {
|
||||||
super("persistent_data.yml");
|
super("persistent_data.yml");
|
||||||
|
validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PersistentDataConfig getInstance() {
|
public static PersistentDataConfig getInstance() {
|
||||||
@ -23,8 +24,8 @@ public class PersistentDataConfig extends BukkitConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void validateConfigKeys() {
|
protected boolean validateKeys() {
|
||||||
//TODO: Rewrite legacy validation code
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Persistent Data Toggles
|
//Persistent Data Toggles
|
||||||
|
@ -8,6 +8,7 @@ public class SoundConfig extends BukkitConfig {
|
|||||||
|
|
||||||
public SoundConfig() {
|
public SoundConfig() {
|
||||||
super("sounds.yml");
|
super("sounds.yml");
|
||||||
|
validate();
|
||||||
instance = this;
|
instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,24 +25,22 @@ public class SoundConfig extends BukkitConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void validateConfigKeys() {
|
protected boolean validateKeys() {
|
||||||
//TODO: Rewrite legacy validation code
|
|
||||||
for (SoundType soundType : SoundType.values()) {
|
for (SoundType soundType : SoundType.values()) {
|
||||||
if (config.getDouble("Sounds." + soundType.toString() + ".Volume") < 0) {
|
if (config.getDouble("Sounds." + soundType.toString() + ".Volume") < 0) {
|
||||||
mcMMO.p.getLogger().info("[mcMMO] Sound volume cannot be below 0 for " + soundType);
|
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
|
//Sounds with custom pitching don't use pitch values
|
||||||
if (!soundType.usesCustomPitch()) {
|
if (!soundType.usesCustomPitch()) {
|
||||||
if (config.getDouble("Sounds." + soundType + ".Pitch") < 0) {
|
if (config.getDouble("Sounds." + soundType + ".Pitch") < 0) {
|
||||||
mcMMO.p.getLogger().info("[mcMMO] Sound pitch cannot be below 0 for " + soundType);
|
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() {
|
public float getMasterVolume() {
|
||||||
|
@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.experience.FormulaType;
|
|||||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
|
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.util.text.StringUtils;
|
import com.gmail.nossr50.util.text.StringUtils;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -14,17 +13,16 @@ import org.bukkit.block.data.BlockData;
|
|||||||
import org.bukkit.boss.BarColor;
|
import org.bukkit.boss.BarColor;
|
||||||
import org.bukkit.boss.BarStyle;
|
import org.bukkit.boss.BarStyle;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.BiConsumer;
|
|
||||||
|
|
||||||
public class ExperienceConfig extends BukkitConfig {
|
public class ExperienceConfig extends BukkitConfig {
|
||||||
private static ExperienceConfig instance;
|
private static ExperienceConfig instance;
|
||||||
|
|
||||||
private ExperienceConfig() {
|
private ExperienceConfig() {
|
||||||
super("experience.yml");
|
super("experience.yml");
|
||||||
|
validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ExperienceConfig getInstance() {
|
public static ExperienceConfig getInstance() {
|
||||||
@ -35,18 +33,12 @@ public class ExperienceConfig extends BukkitConfig {
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initDefaults() {
|
|
||||||
super.initDefaults();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadKeys() {
|
protected void loadKeys() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void validateConfigKeys() {
|
protected boolean validateKeys() {
|
||||||
//TODO: Rewrite legacy validation code
|
|
||||||
List<String> reason = new ArrayList<>();
|
List<String> reason = new ArrayList<>();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -54,48 +46,41 @@ public class ExperienceConfig extends BukkitConfig {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Curve values */
|
/* Curve values */
|
||||||
final BiConsumer<String, Object> consumer = (String str, Object obj) -> config.set(str, obj);
|
if (getMultiplier(FormulaType.EXPONENTIAL) <= 0) {
|
||||||
|
reason.add("Experience_Formula.Exponential_Values.multiplier should be greater than 0!");
|
||||||
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) {
|
if (getMultiplier(FormulaType.LINEAR) <= 0) {
|
||||||
mcMMO.p.getLogger().warning("Experience_Formula.Exponential_Values.multiplier should be greater than 0!");
|
reason.add("Experience_Formula.Linear_Values.multiplier should be greater than 0!");
|
||||||
config.set("Experience_Formula." + StringUtils.getCapitalized(FormulaType.EXPONENTIAL.toString()) + "_Values.multiplier", 0.1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getExponent(FormulaType.EXPONENTIAL) <= 0) {
|
if (getExponent(FormulaType.EXPONENTIAL) <= 0) {
|
||||||
mcMMO.p.getLogger().warning("Experience_Formula.Exponential_Values.exponent should be greater than 0!");
|
reason.add("Experience_Formula.Exponential_Values.exponent should be greater than 0!");
|
||||||
config.set("Experience_Formula." + StringUtils.getCapitalized(FormulaType.EXPONENTIAL.toString()) + "_Values.exponent", 1.80);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Global modifier */
|
/* Global modifier */
|
||||||
if (getExperienceGainsGlobalMultiplier() <= 0) {
|
if (getExperienceGainsGlobalMultiplier() <= 0) {
|
||||||
mcMMO.p.getLogger().warning("Experience_Formula.Multiplier.Global should be at least 0!");
|
reason.add("Experience_Formula.Multiplier.Global should be greater than 0!");
|
||||||
config.set("Experience_Formula.Multiplier.Global", 1.0);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PVP modifier */
|
/* PVP modifier */
|
||||||
if (getPlayerVersusPlayerXP() < 0) {
|
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 */
|
/* Spawned Mob modifier */
|
||||||
if (getSpawnedMobXpMultiplier() < 0) {
|
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 */
|
/* Bred Mob modifier */
|
||||||
if (getBredMobXpMultiplier() < 0) {
|
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 */
|
/* Conversion */
|
||||||
if (getExpModifier() <= 0) {
|
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 */
|
/* Alchemy */
|
||||||
for (PotionStage potionStage : PotionStage.values()) {
|
for (PotionStage potionStage : PotionStage.values()) {
|
||||||
if (getPotionXP(potionStage) < 0) {
|
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 */
|
/* Archery */
|
||||||
if (getArcheryDistanceMultiplier() < 0) {
|
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 */
|
/* Combat XP Multipliers */
|
||||||
if (getAnimalsXP() < 0) {
|
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) {
|
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) {
|
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) {
|
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 */
|
/* Fishing */
|
||||||
// TODO: Add validation for each fish type once enum is available.
|
// TODO: Add validation for each fish type once enum is available.
|
||||||
|
|
||||||
if (getFishingShakeXP() <= 0) {
|
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 */
|
/* Repair */
|
||||||
if (getRepairXPBase() <= 0) {
|
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 */
|
/* Taming */
|
||||||
if (getTamingXP(EntityType.WOLF) <= 0) {
|
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) {
|
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() {
|
public boolean isEarlyGameBoostEnabled() {
|
||||||
|
@ -22,11 +22,6 @@ public class ItemWeightConfig extends BukkitConfig {
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void validateConfigKeys() {
|
|
||||||
//TODO: Rewrite legacy validation code
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getItemWeight(Material material) {
|
public int getItemWeight(Material material) {
|
||||||
return config.getInt("Item_Weights." + StringUtils.getPrettyItemString(material).replace(" ", "_"), config.getInt("Item_Weights.Default"));
|
return config.getInt("Item_Weights." + StringUtils.getPrettyItemString(material).replace(" ", "_"), config.getInt("Item_Weights.Default"));
|
||||||
}
|
}
|
||||||
|
@ -23,11 +23,6 @@ public class RepairConfig extends BukkitConfig {
|
|||||||
loadKeys();
|
loadKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void validateConfigKeys() {
|
|
||||||
//TODO: Rewrite legacy validation code
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadKeys() {
|
protected void loadKeys() {
|
||||||
repairables = new ArrayList<>();
|
repairables = new ArrayList<>();
|
||||||
@ -86,7 +81,7 @@ public class RepairConfig extends BukkitConfig {
|
|||||||
try {
|
try {
|
||||||
repairMaterialType = MaterialType.valueOf(repairMaterialTypeString);
|
repairMaterialType = MaterialType.valueOf(repairMaterialTypeString);
|
||||||
} catch (IllegalArgumentException ex) {
|
} 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) {
|
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
|
// Item Type
|
||||||
@ -126,7 +121,7 @@ public class RepairConfig extends BukkitConfig {
|
|||||||
try {
|
try {
|
||||||
repairItemType = ItemType.valueOf(repairItemTypeString);
|
repairItemType = ItemType.valueOf(repairItemTypeString);
|
||||||
} catch (IllegalArgumentException ex) {
|
} 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);
|
double xpMultiplier = config.getDouble("Repairables." + key + ".XpMultiplier", 1);
|
||||||
|
|
||||||
if (minimumLevel < 0) {
|
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
|
// Minimum Quantity
|
||||||
|
@ -26,11 +26,6 @@ public class SalvageConfig extends BukkitConfig {
|
|||||||
loadKeys();
|
loadKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void validateConfigKeys() {
|
|
||||||
//TODO: Rewrite legacy validation code
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadKeys() {
|
protected void loadKeys() {
|
||||||
salvageables = new HashSet<>();
|
salvageables = new HashSet<>();
|
||||||
@ -102,7 +97,7 @@ public class SalvageConfig extends BukkitConfig {
|
|||||||
try {
|
try {
|
||||||
salvageMaterialType = MaterialType.valueOf(salvageMaterialTypeString.replace(" ", "_").toUpperCase(Locale.ENGLISH));
|
salvageMaterialType = MaterialType.valueOf(salvageMaterialTypeString.replace(" ", "_").toUpperCase(Locale.ENGLISH));
|
||||||
} catch (IllegalArgumentException ex) {
|
} 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 {
|
try {
|
||||||
salvageItemType = ItemType.valueOf(salvageItemTypeString.replace(" ", "_").toUpperCase(Locale.ENGLISH));
|
salvageItemType = ItemType.valueOf(salvageItemTypeString.replace(" ", "_").toUpperCase(Locale.ENGLISH));
|
||||||
} catch (IllegalArgumentException ex) {
|
} 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);
|
double xpMultiplier = config.getDouble("Salvageables." + key + ".XpMultiplier", 1);
|
||||||
|
|
||||||
if (minimumLevel < 0) {
|
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
|
// Maximum Quantity
|
||||||
@ -159,7 +154,7 @@ public class SalvageConfig extends BukkitConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (maximumQuantity <= 0) {
|
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)) {
|
if (noErrorsInSalvageable(reason)) {
|
||||||
|
@ -30,6 +30,7 @@ public class FishingTreasureConfig extends BukkitConfig {
|
|||||||
private FishingTreasureConfig() {
|
private FishingTreasureConfig() {
|
||||||
super(FILENAME);
|
super(FILENAME);
|
||||||
loadKeys();
|
loadKeys();
|
||||||
|
validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FishingTreasureConfig getInstance() {
|
public static FishingTreasureConfig getInstance() {
|
||||||
@ -41,8 +42,8 @@ public class FishingTreasureConfig extends BukkitConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void validateConfigKeys() {
|
protected boolean validateKeys() {
|
||||||
//TODO: Rewrite legacy validation code
|
// Validate all the settings!
|
||||||
List<String> reason = new ArrayList<>();
|
List<String> reason = new ArrayList<>();
|
||||||
ConfigurationSection enchantment_drop_rates = config.getConfigurationSection("Enchantment_Drop_Rates");
|
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);
|
double itemDropRate = config.getDouble("Item_Drop_Rates." + tier + "." + rarity);
|
||||||
|
|
||||||
if ((enchantDropRate < 0.0 || enchantDropRate > 100.0)) {
|
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) {
|
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;
|
totalEnchantDropRate += enchantDropRate;
|
||||||
@ -68,16 +69,18 @@ public class FishingTreasureConfig extends BukkitConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (totalEnchantDropRate < 0 || totalEnchantDropRate > 100.0) {
|
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) {
|
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 {
|
} else {
|
||||||
mcMMO.p.getLogger().warning("Your fishing treasures config is empty, is this intentional? Delete it to regenerate.");
|
mcMMO.p.getLogger().warning("Your fishing treasures config is empty, is this intentional? Delete it to regenerate.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return noErrorsInConfig(reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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");
|
short data = (treasureInfo.length == 2) ? Short.parseShort(treasureInfo[1]) : (short) config.getInt(type + "." + treasureName + ".Data");
|
||||||
|
|
||||||
if (material == null) {
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +150,7 @@ public class FishingTreasureConfig extends BukkitConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (material.isBlock() && (data > 127 || data < -128)) {
|
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");
|
int dropLevel = config.getInt(type + "." + treasureName + ".Drop_Level");
|
||||||
|
|
||||||
if (xp < 0) {
|
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) {
|
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) {
|
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")) {
|
if (materialName.contains("POTION")) {
|
||||||
Material mat = Material.matchMaterial(materialName);
|
Material mat = Material.matchMaterial(materialName);
|
||||||
if (mat == null) {
|
if (mat == null) {
|
||||||
mcMMO.p.getLogger().warning("Potion format for " + FILENAME + " has changed");
|
reason.add("Potion format for " + FILENAME + " has changed");
|
||||||
} else {
|
} else {
|
||||||
item = new ItemStack(mat, amount, data);
|
item = new ItemStack(mat, amount, data);
|
||||||
PotionMeta itemMeta = (PotionMeta) item.getItemMeta();
|
PotionMeta itemMeta = (PotionMeta) item.getItemMeta();
|
||||||
@ -216,7 +219,7 @@ public class FishingTreasureConfig extends BukkitConfig {
|
|||||||
try {
|
try {
|
||||||
potionType = PotionType.valueOf(config.getString(type + "." + treasureName + ".PotionData.PotionType", "WATER"));
|
potionType = PotionType.valueOf(config.getString(type + "." + treasureName + ".PotionData.PotionType", "WATER"));
|
||||||
} catch (IllegalArgumentException ex) {
|
} 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 extended = config.getBoolean(type + "." + treasureName + ".PotionData.Extended", false);
|
||||||
boolean upgraded = config.getBoolean(type + "." + treasureName + ".PotionData.Upgraded", false);
|
boolean upgraded = config.getBoolean(type + "." + treasureName + ".PotionData.Upgraded", false);
|
||||||
@ -279,8 +282,7 @@ public class FishingTreasureConfig extends BukkitConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//TODO: Rewrite legacy validation code
|
if (noErrorsInConfig(reason)) {
|
||||||
// Look into what needs to change for this
|
|
||||||
if (isFishing) {
|
if (isFishing) {
|
||||||
addFishingTreasure(rarity, new FishingTreasure(item, xp));
|
addFishingTreasure(rarity, new FishingTreasure(item, xp));
|
||||||
} else if (isShake) {
|
} else if (isShake) {
|
||||||
@ -291,6 +293,7 @@ public class FishingTreasureConfig extends BukkitConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void addShakeTreasure(@NotNull ShakeTreasure shakeTreasure, @NotNull EntityType entityType) {
|
private void addShakeTreasure(@NotNull ShakeTreasure shakeTreasure, @NotNull EntityType entityType) {
|
||||||
if (!shakeMap.containsKey(entityType))
|
if (!shakeMap.containsKey(entityType))
|
||||||
|
@ -37,6 +37,7 @@ public class TreasureConfig extends BukkitConfig {
|
|||||||
private TreasureConfig() {
|
private TreasureConfig() {
|
||||||
super(FILENAME);
|
super(FILENAME);
|
||||||
loadKeys();
|
loadKeys();
|
||||||
|
validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TreasureConfig getInstance() {
|
public static TreasureConfig getInstance() {
|
||||||
@ -48,8 +49,11 @@ public class TreasureConfig extends BukkitConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void validateConfigKeys() {
|
protected boolean validateKeys() {
|
||||||
//TODO: Rewrite legacy validation code
|
// Validate all the settings!
|
||||||
|
List<String> reason = new ArrayList<>();
|
||||||
|
|
||||||
|
return noErrorsInConfig(reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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");
|
short data = (treasureInfo.length == 2) ? Short.parseShort(treasureInfo[1]) : (short) config.getInt(type + "." + treasureName + ".Data");
|
||||||
|
|
||||||
if (material == null) {
|
if (material == null) {
|
||||||
mcMMO.p.getLogger().warning("Invalid material: " + materialName);
|
reason.add("Invalid material: " + materialName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (amount <= 0) {
|
if (amount <= 0) {
|
||||||
@ -99,7 +103,7 @@ public class TreasureConfig extends BukkitConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (material != null && material.isBlock() && (data > 127 || data < -128)) {
|
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) {
|
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) {
|
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")) {
|
if (materialName.contains("POTION")) {
|
||||||
Material mat = Material.matchMaterial(materialName);
|
Material mat = Material.matchMaterial(materialName);
|
||||||
if (mat == null) {
|
if (mat == null) {
|
||||||
mcMMO.p.getLogger().warning("Potion format for " + FILENAME + " has changed");
|
reason.add("Potion format for " + FILENAME + " has changed");
|
||||||
} else {
|
} else {
|
||||||
item = new ItemStack(mat, amount, data);
|
item = new ItemStack(mat, amount, data);
|
||||||
PotionMeta itemMeta = (PotionMeta) item.getItemMeta();
|
PotionMeta itemMeta = (PotionMeta) item.getItemMeta();
|
||||||
@ -167,7 +171,7 @@ public class TreasureConfig extends BukkitConfig {
|
|||||||
try {
|
try {
|
||||||
potionType = PotionType.valueOf(config.getString(type + "." + treasureName + ".PotionData.PotionType", "WATER"));
|
potionType = PotionType.valueOf(config.getString(type + "." + treasureName + ".PotionData.PotionType", "WATER"));
|
||||||
} catch (IllegalArgumentException ex) {
|
} 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 extended = config.getBoolean(type + "." + treasureName + ".PotionData.Extended", false);
|
||||||
boolean upgraded = config.getBoolean(type + "." + treasureName + ".PotionData.Upgraded", false);
|
boolean upgraded = config.getBoolean(type + "." + treasureName + ".PotionData.Upgraded", false);
|
||||||
@ -206,8 +210,7 @@ public class TreasureConfig extends BukkitConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Rewrite legacy validation code
|
if (noErrorsInConfig(reason)) {
|
||||||
// Look into what needs to change for this
|
|
||||||
if (isExcavation) {
|
if (isExcavation) {
|
||||||
ExcavationTreasure excavationTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel);
|
ExcavationTreasure excavationTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel);
|
||||||
List<String> dropList = config.getStringList(type + "." + treasureName + ".Drops_From");
|
List<String> dropList = config.getStringList(type + "." + treasureName + ".Drops_From");
|
||||||
@ -252,6 +255,7 @@ public class TreasureConfig extends BukkitConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Apply our fix
|
//Apply our fix
|
||||||
if (shouldWeUpdateFile) {
|
if (shouldWeUpdateFile) {
|
||||||
|
@ -125,6 +125,9 @@ public class mcMMO extends JavaPlugin {
|
|||||||
// API checks
|
// API checks
|
||||||
private static boolean serverAPIOutdated = false;
|
private static boolean serverAPIOutdated = false;
|
||||||
|
|
||||||
|
// Config Validation Check
|
||||||
|
public boolean noErrorsInConfigFiles = true;
|
||||||
|
|
||||||
// XP Event Check
|
// XP Event Check
|
||||||
private boolean xpEventEnabled;
|
private boolean xpEventEnabled;
|
||||||
|
|
||||||
@ -196,6 +199,10 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
loadConfigFiles();
|
loadConfigFiles();
|
||||||
|
|
||||||
|
if (!noErrorsInConfigFiles) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (getServer().getName().equals("Cauldron") || getServer().getName().equals("MCPC+")) {
|
if (getServer().getName().equals("Cauldron") || getServer().getName().equals("MCPC+")) {
|
||||||
checkModConfigs();
|
checkModConfigs();
|
||||||
}
|
}
|
||||||
|
@ -15,11 +15,6 @@ public class ChildConfig extends BukkitConfig {
|
|||||||
loadKeys();
|
loadKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void validateConfigKeys() {
|
|
||||||
//TODO: Rewrite legacy validation code
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadKeys() {
|
protected void loadKeys() {
|
||||||
config.setDefaults(YamlConfiguration.loadConfiguration(mcMMO.p.getResourceAsReader("child.yml")));
|
config.setDefaults(YamlConfiguration.loadConfiguration(mcMMO.p.getResourceAsReader("child.yml")));
|
||||||
|
@ -19,12 +19,6 @@ public class UpgradeManager extends BukkitConfig {
|
|||||||
loadKeys();
|
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.
|
* Check if the given {@link UpgradeType} is necessary.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user