1
0
mirror of https://github.com/mcMMO-Dev/mcMMO.git synced 2026-02-20 02:33:15 +01:00

Refactoring to make my life easier

This commit is contained in:
nossr50
2018-12-29 05:24:55 -08:00
parent 35368db05d
commit 0d260a74c9
126 changed files with 1471 additions and 1408 deletions

View File

@@ -4,15 +4,13 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.skills.SubSkill;
import com.gmail.nossr50.skills.alchemy.Alchemy;
import com.gmail.nossr50.skills.fishing.Fishing;
import com.gmail.nossr50.skills.mining.BlastMining;
import com.gmail.nossr50.skills.repair.ArcaneForging;
import com.gmail.nossr50.skills.salvage.Salvage;
import com.gmail.nossr50.skills.smelting.Smelting;
import com.gmail.nossr50.util.StringUtils;
public class AdvancedConfig extends AutoUpdateConfigLoader {
private static AdvancedConfig instance;
@@ -45,11 +43,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
}
/* ACROBATICS */
if (getMaxChance(SecondaryAbility.DODGE) < 1) {
if (getMaxChance(SubSkill.ACROBATICS_DODGE) < 1) {
reason.add("Skills.Acrobatics.Dodge.ChanceMax should be at least 1!");
}
if (getMaxBonusLevel(SecondaryAbility.DODGE) < 1) {
if (getMaxBonusLevel(SubSkill.ACROBATICS_DODGE) < 1) {
reason.add("Skills.Acrobatics.Dodge.MaxBonusLevel should be at least 1!");
}
@@ -57,11 +55,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
reason.add("Skills.Acrobatics.Dodge.DamageModifier should be greater than 1!");
}
if (getMaxChance(SecondaryAbility.ROLL) < 1) {
if (getMaxChance(SubSkill.ACROBATICS_ROLL) < 1) {
reason.add("Skills.Acrobatics.Roll.ChanceMax should be at least 1!");
}
if (getMaxBonusLevel(SecondaryAbility.ROLL) < 1) {
if (getMaxBonusLevel(SubSkill.ACROBATICS_ROLL) < 1) {
reason.add("Skills.Acrobatics.Roll.MaxBonusLevel should be at least 1!");
}
@@ -69,11 +67,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
reason.add("Skills.Acrobatics.Roll.DamageThreshold should be at least 0!");
}
if (getMaxChance(SecondaryAbility.GRACEFUL_ROLL) < 1) {
if (getMaxChance(SubSkill.ACROBATICS_GRACEFUL_ROLL) < 1) {
reason.add("Skills.Acrobatics.GracefulRoll.ChanceMax should be at least 1!");
}
if (getMaxBonusLevel(SecondaryAbility.GRACEFUL_ROLL) < 1) {
if (getMaxBonusLevel(SubSkill.ACROBATICS_GRACEFUL_ROLL) < 1) {
reason.add("Skills.Acrobatics.GracefulRoll.MaxBonusLevel should be at least 1!");
}
@@ -126,11 +124,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
reason.add("Skills.Archery.SkillShot.MaxBonus should be at least 0!");
}
if (getMaxChance(SecondaryAbility.DAZE) < 1) {
if (getMaxChance(SubSkill.ARCHERY_DAZE) < 1) {
reason.add("Skills.Acrobatics.Daze.ChanceMax should be at least 1!");
}
if (getMaxBonusLevel(SecondaryAbility.DAZE) < 1) {
if (getMaxBonusLevel(SubSkill.ARCHERY_DAZE) < 1) {
reason.add("Skills.Acrobatics.Daze.MaxBonusLevel should be at least 1!");
}
@@ -138,11 +136,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
reason.add("Skills.Acrobatics.Daze.BonusDamage should be at least 0!");
}
if (getMaxChance(SecondaryAbility.RETRIEVE) < 1) {
if (getMaxChance(SubSkill.ARCHERY_RETRIEVE) < 1) {
reason.add("Skills.Acrobatics.Retrieve.ChanceMax should be at least 1!");
}
if (getMaxBonusLevel(SecondaryAbility.RETRIEVE) < 1) {
if (getMaxBonusLevel(SubSkill.ARCHERY_RETRIEVE) < 1) {
reason.add("Skills.Acrobatics.Retrieve.MaxBonusLevel should be at least 1!");
}
@@ -159,11 +157,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
reason.add("Skills.Axes.AxeMastery.MaxBonusLevel should be at least 1!");
}
if (getMaxChance(SecondaryAbility.CRITICAL_HIT) < 1) {
if (getMaxChance(SubSkill.AXES_CRITICAL_HIT) < 1) {
reason.add("Skills.Axes.CriticalHit.ChanceMax should be at least 1!");
}
if (getMaxBonusLevel(SecondaryAbility.CRITICAL_HIT) < 1) {
if (getMaxBonusLevel(SubSkill.AXES_CRITICAL_HIT) < 1) {
reason.add("Skills.Axes.CriticalHit.MaxBonusLevel should be at least 1!");
}
@@ -265,44 +263,44 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
reason.add("Skills.Herbalism.GreenThumb.StageChange should be at least 1!");
}
if (getMaxChance(SecondaryAbility.GREEN_THUMB_PLANT) < 1) {
if (getMaxChance(SubSkill.HERBALISM_GREEN_THUMB) < 1) {
reason.add("Skills.Herbalism.GreenThumb.ChanceMax should be at least 1!");
}
if (getMaxBonusLevel(SecondaryAbility.GREEN_THUMB_PLANT) < 1) {
if (getMaxBonusLevel(SubSkill.HERBALISM_GREEN_THUMB) < 1) {
reason.add("Skills.Herbalism.GreenThumb.MaxBonusLevel should be at least 1!");
}
if (getMaxChance(SecondaryAbility.HERBALISM_DOUBLE_DROPS) < 1) {
if (getMaxChance(SubSkill.HERBALISM_DOUBLE_DROPS) < 1) {
reason.add("Skills.Herbalism.DoubleDrops.ChanceMax should be at least 1!");
}
if (getMaxBonusLevel(SecondaryAbility.HERBALISM_DOUBLE_DROPS) < 1) {
if (getMaxBonusLevel(SubSkill.HERBALISM_DOUBLE_DROPS) < 1) {
reason.add("Skills.Herbalism.DoubleDrops.MaxBonusLevel should be at least 1!");
}
if (getMaxChance(SecondaryAbility.HYLIAN_LUCK) < 1) {
if (getMaxChance(SubSkill.HERBALISM_HYLIAN_LUCK) < 1) {
reason.add("Skills.Herbalism.HylianLuck.ChanceMax should be at least 1!");
}
if (getMaxBonusLevel(SecondaryAbility.HYLIAN_LUCK) < 1) {
if (getMaxBonusLevel(SubSkill.HERBALISM_HYLIAN_LUCK) < 1) {
reason.add("Skills.Herbalism.HylianLuck.MaxBonusLevel should be at least 1!");
}
if (getMaxChance(SecondaryAbility.SHROOM_THUMB) < 1) {
if (getMaxChance(SubSkill.HERBALISM_SHROOM_THUMB) < 1) {
reason.add("Skills.Herbalism.ShroomThumb.ChanceMax should be at least 1!");
}
if (getMaxBonusLevel(SecondaryAbility.SHROOM_THUMB) < 1) {
if (getMaxBonusLevel(SubSkill.HERBALISM_SHROOM_THUMB) < 1) {
reason.add("Skills.Herbalism.ShroomThumb.MaxBonusLevel should be at least 1!");
}
/* MINING */
if (getMaxChance(SecondaryAbility.MINING_DOUBLE_DROPS) < 1) {
if (getMaxChance(SubSkill.MINING_DOUBLE_DROPS) < 1) {
reason.add("Skills.Mining.DoubleDrops.ChanceMax should be at least 1!");
}
if (getMaxBonusLevel(SecondaryAbility.MINING_DOUBLE_DROPS) < 1) {
if (getMaxBonusLevel(SubSkill.MINING_DOUBLE_DROPS) < 1) {
reason.add("Skills.Mining.DoubleDrops.MaxBonusLevel should be at least 1!");
}
@@ -371,11 +369,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
reason.add("Skills.Repair.RepairMastery.MaxBonusLevel should be at least 1!");
}
if (getMaxChance(SecondaryAbility.SUPER_REPAIR) < 1) {
if (getMaxChance(SubSkill.REPAIR_SUPER_REPAIR) < 1) {
reason.add("Skills.Repair.SuperRepair.ChanceMax should be at least 1!");
}
if (getMaxBonusLevel(SecondaryAbility.SUPER_REPAIR) < 1) {
if (getMaxBonusLevel(SubSkill.REPAIR_SUPER_REPAIR) < 1) {
reason.add("Skills.Repair.SuperRepair.MaxBonusLevel should be at least 1!");
}
@@ -465,11 +463,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
reason.add("Skills.Smelting.FuelEfficiency.Multiplier should be at least 1!");
}
if (getMaxBonusLevel(SecondaryAbility.SECOND_SMELT) < 1) {
if (getMaxBonusLevel(SubSkill.SMELTING_SECOND_SMELT) < 1) {
reason.add("Skills.Smelting.SecondSmelt.MaxBonusLevel should be at least 1!");
}
if (getMaxChance(SecondaryAbility.SECOND_SMELT) < 1) {
if (getMaxChance(SubSkill.SMELTING_SECOND_SMELT) < 1) {
reason.add("Skills.Smelting.SecondSmelt.ChanceMax should be at least 1!");
}
@@ -506,11 +504,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
}
/* SWORDS */
if (getMaxChance(SecondaryAbility.BLEED) < 1) {
if (getMaxChance(SubSkill.SWORDS_BLEED) < 1) {
reason.add("Skills.Swords.Bleed.ChanceMax should be at least 1!");
}
if (getMaxBonusLevel(SecondaryAbility.BLEED) < 1) {
if (getMaxBonusLevel(SubSkill.SWORDS_BLEED) < 1) {
reason.add("Skills.Swords.Bleed.MaxBonusLevel should be at least 1!");
}
@@ -526,11 +524,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
reason.add("Skills.Swords.Bleed.BaseTicks should be at least 1!");
}
if (getMaxChance(SecondaryAbility.COUNTER) < 1) {
if (getMaxChance(SubSkill.SWORDS_COUNTER) < 1) {
reason.add("Skills.Swords.Counter.ChanceMax should be at least 1!");
}
if (getMaxBonusLevel(SecondaryAbility.COUNTER) < 1) {
if (getMaxBonusLevel(SubSkill.SWORDS_COUNTER) < 1) {
reason.add("Skills.Swords.Counter.MaxBonusLevel should be at least 1!");
}
@@ -548,11 +546,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
/* TAMING */
if (getMaxChance(SecondaryAbility.GORE) < 1) {
if (getMaxChance(SubSkill.TAMING_GORE) < 1) {
reason.add("Skills.Taming.Gore.ChanceMax should be at least 1!");
}
if (getMaxBonusLevel(SecondaryAbility.GORE) < 1) {
if (getMaxBonusLevel(SubSkill.TAMING_GORE) < 1) {
reason.add("Skills.Taming.Gore.MaxBonusLevel should be at least 1!");
}
@@ -609,27 +607,27 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
}
/* UNARMED */
if (getMaxChance(SecondaryAbility.DISARM) < 1) {
if (getMaxChance(SubSkill.UNARMED_DISARM) < 1) {
reason.add("Skills.Unarmed.Disarm.ChanceMax should be at least 1!");
}
if (getMaxBonusLevel(SecondaryAbility.DISARM) < 1) {
if (getMaxBonusLevel(SubSkill.UNARMED_DISARM) < 1) {
reason.add("Skills.Unarmed.Disarm.MaxBonusLevel should be at least 1!");
}
if (getMaxChance(SecondaryAbility.DEFLECT) < 1) {
if (getMaxChance(SubSkill.UNARMED_DEFLECT) < 1) {
reason.add("Skills.Unarmed.Deflect.ChanceMax should be at least 1!");
}
if (getMaxBonusLevel(SecondaryAbility.DEFLECT) < 1) {
if (getMaxBonusLevel(SubSkill.UNARMED_DEFLECT) < 1) {
reason.add("Skills.Unarmed.Deflect.MaxBonusLevel should be at least 1!");
}
if (getMaxChance(SecondaryAbility.IRON_GRIP) < 1) {
if (getMaxChance(SubSkill.UNARMED_IRON_GRIP) < 1) {
reason.add("Skills.Unarmed.IronGrip.ChanceMax should be at least 1!");
}
if (getMaxBonusLevel(SecondaryAbility.IRON_GRIP) < 1) {
if (getMaxBonusLevel(SubSkill.UNARMED_IRON_GRIP) < 1) {
reason.add("Skills.Unarmed.IronGrip.MaxBonusLevel should be at least 1!");
}
@@ -654,11 +652,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
reason.add("Skills.Woodcutting.LeafBlower.UnlockLevel should be at least 0!");
}
if (getMaxChance(SecondaryAbility.WOODCUTTING_HARVEST) < 1) {
if (getMaxChance(SubSkill.WOODCUTTING_DOUBLE_DROPS) < 1) {
reason.add("Skills.Woodcutting.DoubleDrops.ChanceMax should be at least 1!");
}
if (getMaxBonusLevel(SecondaryAbility.WOODCUTTING_HARVEST) < 1) {
if (getMaxBonusLevel(SubSkill.WOODCUTTING_DOUBLE_DROPS) < 1) {
reason.add("Skills.Woodcutting.DoubleDrops.MaxBonusLevel should be at least 1!");
}
@@ -689,8 +687,8 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
public int getAbilityLength() { return config.getInt("Skills.General.Ability.IncreaseLevel", 50); }
public int getEnchantBuff() { return config.getInt("Skills.General.Ability.EnchantBuff", 5); }
public int getMaxBonusLevel(SecondaryAbility skillAbility) { return config.getInt("Skills." + StringUtils.getCapitalized(SkillType.bySecondaryAbility(skillAbility).toString()) + "." + StringUtils.getPrettySecondaryAbilityString(skillAbility).replace(" ", "") + ".MaxBonusLevel"); }
public double getMaxChance(SecondaryAbility skillAbility) { return config.getDouble("Skills." + StringUtils.getCapitalized(SkillType.bySecondaryAbility(skillAbility).toString()) + "." + StringUtils.getPrettySecondaryAbilityString(skillAbility).replace(" ", "") + ".ChanceMax", 100.0D); }
public int getMaxBonusLevel(SubSkill subSkill) { return config.getInt(subSkill.getAdvConfigAddress() + ".MaxBonusLevel"); }
public double getMaxChance(SubSkill subSkill) { return config.getDouble(subSkill.getAdvConfigAddress() + ".ChanceMax", 100.0D);}
/* ACROBATICS */
public double getDodgeDamageModifier() { return config.getDouble("Skills.Acrobatics.Dodge.DamageModifier", 2.0D); }