diff --git a/src/main/java/com/gmail/nossr50/commands/skills/AlchemyCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/AlchemyCommand.java index f7b722498..1fdecbb3e 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/AlchemyCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/AlchemyCommand.java @@ -1,12 +1,9 @@ package com.gmail.nossr50.commands.skills; -import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.locale.LocaleLoader; -import com.gmail.nossr50.skills.alchemy.Alchemy.Tier; import com.gmail.nossr50.skills.alchemy.AlchemyManager; -import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.skills.RankUtils; @@ -89,7 +86,7 @@ public class AlchemyCommand extends SkillCommand { } if (canConcoctions) { - messages.add(LocaleLoader.getString("Alchemy.Concoctions.Rank", tier, Tier.values().length)); + messages.add(LocaleLoader.getString("Alchemy.Concoctions.Rank", tier, RankUtils.getHighestRank(SubSkillType.ALCHEMY_CONCOCTIONS))); messages.add(LocaleLoader.getString("Alchemy.Concoctions.Ingredients", ingredientCount, ingredientList)); } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java index 6b1528102..1163d25c4 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java @@ -7,9 +7,7 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.treasure.Rarity; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.skills.fishing.Fishing; -import com.gmail.nossr50.skills.fishing.Fishing.Tier; import com.gmail.nossr50.skills.fishing.FishingManager; -import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.skills.RankUtils; @@ -157,7 +155,7 @@ public class FishingCommand extends SkillCommand { List messages = new ArrayList(); if (canTreasureHunt) { - messages.add(LocaleLoader.getString("Fishing.Ability.Rank", lootTier, Tier.values().length)); + messages.add(LocaleLoader.getString("Fishing.Ability.Rank", lootTier, RankUtils.getHighestRank(SubSkillType.FISHING_TREASURE_HUNTER))); messages.add(LocaleLoader.getString("Fishing.Ability.TH.DropRate", trapTreasure, commonTreasure, uncommonTreasure, rareTreasure, epicTreasure, legendaryTreasure, recordTreasure)); } @@ -166,36 +164,15 @@ public class FishingCommand extends SkillCommand { } if (canIceFish) { - int unlockLevel = AdvancedConfig.getInstance().getIceFishingUnlockLevel(); - - if (skillValue < unlockLevel) { - messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Fishing.Ability.Locked.1", unlockLevel))); - } - else { - messages.add(LocaleLoader.getString("Fishing.Ability.IceFishing")); - } + messages.add(LocaleLoader.getString("Fishing.Ability.IceFishing")); } if (canMasterAngler) { - int unlockLevel = AdvancedConfig.getInstance().getMasterAnglerUnlockLevel(); - - if (skillValue < unlockLevel) { - messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Fishing.Ability.Locked.2", unlockLevel))); - } - else { - messages.add(LocaleLoader.getString("Fishing.Ability.Chance", biteChance)); - } + messages.add(LocaleLoader.getString("Fishing.Ability.Chance", biteChance)); } if (canShake) { - int unlockLevel = AdvancedConfig.getInstance().getFishingTierLevel(Tier.ONE); - - if (skillValue < unlockLevel) { - messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Fishing.Ability.Locked.0", unlockLevel))); - } - else { - messages.add(LocaleLoader.getString("Fishing.Ability.Shake", shakeChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", shakeChanceLucky) : "")); - } + messages.add(LocaleLoader.getString("Fishing.Ability.Shake", shakeChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", shakeChanceLucky) : "")); } if (canFishermansDiet) { diff --git a/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java index a0a55dff9..1bf744e76 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java @@ -1,11 +1,9 @@ package com.gmail.nossr50.commands.skills; -import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.skills.mining.BlastMining; -import com.gmail.nossr50.skills.mining.BlastMining.Tier; import com.gmail.nossr50.skills.mining.MiningManager; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.TextComponentFactory; @@ -118,14 +116,7 @@ public class MiningCommand extends SkillCommand { } if (canBlast) { - int unlockLevel = AdvancedConfig.getInstance().getBlastMiningRankLevel(Tier.ONE); - - if (skillValue < unlockLevel) { - messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Mining.Ability.Locked.0", unlockLevel))); - } - else { - messages.add(LocaleLoader.getString("Mining.Blast.Rank", blastMiningRank, Tier.values().length, LocaleLoader.getString("Mining.Blast.Effect", oreBonus, debrisReduction, bonusTNTDrops))); - } + messages.add(LocaleLoader.getString("Mining.Blast.Rank", blastMiningRank, RankUtils.getHighestRank(SubSkillType.MINING_BLAST_MINING), LocaleLoader.getString("Mining.Blast.Effect", oreBonus, debrisReduction, bonusTNTDrops))); } if (canBiggerBombs) { diff --git a/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java index 3aee1963b..c6799b3ae 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java @@ -6,13 +6,13 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.skills.repair.ArcaneForging; -import com.gmail.nossr50.skills.repair.ArcaneForging.Tier; import com.gmail.nossr50.skills.repair.Repair; import com.gmail.nossr50.skills.repair.RepairManager; import com.gmail.nossr50.skills.repair.repairables.Repairable; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.player.UserManager; +import com.gmail.nossr50.util.skills.RankUtils; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -144,7 +144,7 @@ public class RepairCommand extends SkillCommand { if (canArcaneForge) { RepairManager repairManager = UserManager.getPlayer(player).getRepairManager(); - messages.add(LocaleLoader.getString("Repair.Arcane.Rank", repairManager.getArcaneForgingRank(), Tier.values().length)); + messages.add(LocaleLoader.getString("Repair.Arcane.Rank", repairManager.getArcaneForgingRank(), RankUtils.getHighestRank(SubSkillType.REPAIR_ARCANE_FORGING))); if (ArcaneForging.arcaneForgingEnchantLoss) { messages.add(LocaleLoader.getString("Repair.Arcane.Chance.Success", (arcaneBypass ? 100 : repairManager.getKeepEnchantChance()))); diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SalvageCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SalvageCommand.java index 04a739851..40624d250 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SalvageCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SalvageCommand.java @@ -5,9 +5,9 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.skills.salvage.Salvage; import com.gmail.nossr50.skills.salvage.SalvageManager; -import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.player.UserManager; +import com.gmail.nossr50.util.skills.RankUtils; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.entity.Player; @@ -64,7 +64,7 @@ public class SalvageCommand extends SkillCommand { } if (canArcaneSalvage) { - messages.add(LocaleLoader.getString("Salvage.Arcane.Rank", salvageManager.getArcaneSalvageRank(), Salvage.Tier.values().length)); + messages.add(LocaleLoader.getString("Salvage.Arcane.Rank", salvageManager.getArcaneSalvageRank(), RankUtils.getHighestRank(SubSkillType.SALVAGE_ARCANE_SALVAGE))); if (Salvage.arcaneSalvageEnchantLoss) { messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Salvage.Arcane.ExtractFull"), percent.format(salvageManager.getExtractFullEnchantChance() / 100))); diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java index 20e937752..3f3565597 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java @@ -1,14 +1,13 @@ package com.gmail.nossr50.commands.skills; -import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.skills.smelting.Smelting; -import com.gmail.nossr50.skills.smelting.Smelting.Tier; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.player.UserManager; +import com.gmail.nossr50.util.skills.RankUtils; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.entity.Player; @@ -58,7 +57,7 @@ public class SmeltingCommand extends SkillCommand { canFuelEfficiency = canUseSubskill(player, SubSkillType.SMELTING_FUEL_EFFICIENCY); canSecondSmelt = canUseSubskill(player, SubSkillType.SMELTING_SECOND_SMELT); canFluxMine = canUseSubskill(player, SubSkillType.SMELTING_FLUX_MINING); - canVanillaXPBoost = Permissions.vanillaXpBoost(player, skill); + canVanillaXPBoost = Permissions.vanillaXpBoost(player, skill) && RankUtils.hasUnlockedSubskill(player, SubSkillType.SMELTING_UNDERSTANDING_THE_ART); } @Override @@ -97,23 +96,11 @@ public class SmeltingCommand extends SkillCommand { } if (canVanillaXPBoost) { - int unlockLevel = AdvancedConfig.getInstance().getSmeltingRankLevel(Tier.ONE); - - if (skillValue < unlockLevel) { - messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Smelting.Ability.Locked.0", unlockLevel))); - } - else { - messages.add(LocaleLoader.getString("Smelting.Ability.VanillaXPBoost", UserManager.getPlayer(player).getSmeltingManager().getVanillaXpMultiplier())); - } + messages.add(LocaleLoader.getString("Smelting.Ability.VanillaXPBoost", UserManager.getPlayer(player).getSmeltingManager().getVanillaXpMultiplier())); } if (canFluxMine) { - if (skillValue < Smelting.fluxMiningUnlockLevel) { - messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Smelting.Ability.Locked.1", Smelting.fluxMiningUnlockLevel))); - } - else { - messages.add(LocaleLoader.getString("Smelting.Ability.FluxMining", fluxMiningChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", fluxMiningChanceLucky) : "")); - } + messages.add(LocaleLoader.getString("Smelting.Ability.FluxMining", fluxMiningChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", fluxMiningChanceLucky) : "")); } return messages; diff --git a/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java index f9a841124..575a4ba8a 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java @@ -99,14 +99,7 @@ public class WoodcuttingCommand extends SkillCommand { List messages = new ArrayList(); if (canLeafBlow) { - int leafBlowerUnlockLevel = AdvancedConfig.getInstance().getLeafBlowUnlockLevel(); - - if (skillValue < leafBlowerUnlockLevel) { - messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Woodcutting.Ability.Locked.0", leafBlowerUnlockLevel))); - } - else { - messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Woodcutting.Ability.0"), LocaleLoader.getString("Woodcutting.Ability.1"))); - } + messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Woodcutting.Ability.0"), LocaleLoader.getString("Woodcutting.Ability.1"))); } if (canDoubleDrop) { diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index 344a8d5d7..47ba06f72 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -80,13 +80,13 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { } /* ALCHEMY */ - if (getCatalysisUnlockLevel() < 0) { + /*if (getCatalysisUnlockLevel() < 0) { reason.add("Skills.Alchemy.Catalysis.UnlockLevel should be at least 0!"); } if (getCatalysisMaxBonusLevel() <= getCatalysisUnlockLevel()) { reason.add("Skills.Alchemy.Catalysis.MaxBonusLevel should be greater than Skills.Alchemy.Catalysis.UnlockLevel!"); - } + }*/ if (getCatalysisMinSpeed() <= 0) { reason.add("Skills.Alchemy.Catalysis.MinSpeed must be greater than 0!"); @@ -96,20 +96,20 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { reason.add("Skills.Alchemy.Catalysis.MaxSpeed should be at least Skills.Alchemy.Catalysis.MinSpeed!"); } - List alchemyTierList = Arrays.asList(Alchemy.Tier.values()); + /*List alchemyTierList = Arrays.asList(Alchemy.Tier.values()); for (Alchemy.Tier tier : alchemyTierList) { if (getConcoctionsTierLevel(tier) < 0) { - reason.add("Skills.Alchemy.Rank_Levels.Rank_" + tier.toNumerical() + " should be at least 0!"); + reason.add("Skills.Alchemy.Rank_Levels.Rank_" + rank + " should be at least 0!"); } if (tier != Alchemy.Tier.fromNumerical(Alchemy.Tier.values().length)) { Alchemy.Tier nextTier = alchemyTierList.get(alchemyTierList.indexOf(tier) - 1); if (getConcoctionsTierLevel(tier) > getConcoctionsTierLevel(nextTier)) { - reason.add("Skills.Alchemy.Rank_Levels.Rank_" + tier.toNumerical() + " should be less than or equal to Skills.Alchemy.Rank_Levels.Rank_" + nextTier.toNumerical() + "!"); + reason.add("Skills.Alchemy.Rank_Levels.Rank_" + rank + " should be less than or equal to Skills.Alchemy.Rank_Levels.Rank_" + nextrank + "!"); } } - } + }*/ /* ARCHERY */ @@ -192,49 +192,49 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { } /* FISHING */ - List fishingTierList = Arrays.asList(Fishing.Tier.values()); + /*List fishingTierList = Arrays.asList(Fishing.Tier.values()); - for (Fishing.Tier tier : fishingTierList) { + for (int rank : fishingTierList) { if (getFishingTierLevel(tier) < 0) { - reason.add("Skills.Fishing.Rank_Levels.Rank_" + tier.toNumerical() + " should be at least 0!"); + reason.add("Skills.Fishing.Rank_Levels.Rank_" + rank + " should be at least 0!"); } if (getShakeChance(tier) < 0) { - reason.add("Skills.Fishing.Shake_Chance.Rank_" + tier.toNumerical() + " should be at least 0!"); + reason.add("Skills.Fishing.Shake_Chance.Rank_" + rank + " should be at least 0!"); } if (getFishingVanillaXPModifier(tier) < 0) { - reason.add("Skills.Fishing.VanillaXPMultiplier.Rank_" + tier.toNumerical() + " should be at least 0!"); + reason.add("Skills.Fishing.VanillaXPMultiplier.Rank_" + rank + " should be at least 0!"); } if (tier != Fishing.Tier.EIGHT) { Fishing.Tier nextTier = fishingTierList.get(fishingTierList.indexOf(tier) - 1); if (getFishingTierLevel(tier) > getFishingTierLevel(nextTier)) { - reason.add("Skills.Fishing.Rank_Levels.Rank_" + tier.toNumerical() + " should be less than or equal to Skills.Fishing.Rank_Levels.Rank_" + nextTier.toNumerical() + "!"); + reason.add("Skills.Fishing.Rank_Levels.Rank_" + rank + " should be less than or equal to Skills.Fishing.Rank_Levels.Rank_" + nextrank + "!"); } if (getShakeChance(tier) > getShakeChance(nextTier)) { - reason.add("Skills.Fishing.Shake_Chance.Rank_" + tier.toNumerical() + " should be less than or equal to Skills.Fishing.Shake_Chance.Rank_" + nextTier.toNumerical() + "!"); + reason.add("Skills.Fishing.Shake_Chance.Rank_" + rank + " should be less than or equal to Skills.Fishing.Shake_Chance.Rank_" + nextrank + "!"); } if (getFishingVanillaXPModifier(tier) > getFishingVanillaXPModifier(nextTier)) { - reason.add("Skills.Fishing.VanillaXPMultiplier.Rank_" + tier.toNumerical() + " should be less than or equal to Skills.Fishing.VanillaXPMultiplier.Rank_" + nextTier.toNumerical() + "!"); + reason.add("Skills.Fishing.VanillaXPMultiplier.Rank_" + rank + " should be less than or equal to Skills.Fishing.VanillaXPMultiplier.Rank_" + nextrank + "!"); } } - } + }*/ if (getFishermanDietRankChange() < 1) { reason.add("Skills.Fishing.FishermansDiet.RankChange should be at least 1!"); } - if (getIceFishingUnlockLevel() < 0) { + /*if (getIceFishingUnlockLevel() < 0) { reason.add("Skills.Fishing.IceFishing.UnlockLevel should be at least 0!"); } if (getMasterAnglerUnlockLevel() < 0) { reason.add("Skills.Fishing.MasterAngler.UnlockLevel should be at least 0!"); - } + }*/ if (getMasterAnglerBoatModifier() < 1) { reason.add("Skills.Fishing.MasterAngler.BoatModifier should be at least 1!"); @@ -294,61 +294,61 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { reason.add("Skills.Mining.DoubleDrops.MaxBonusLevel should be at least 1!"); } - List blastMiningTierList = Arrays.asList(BlastMining.Tier.values()); + /*List blastMiningTierList = Arrays.asList(BlastMining.Tier.values()); - for (BlastMining.Tier tier : blastMiningTierList) { + for (int rank : blastMiningTierList) { if (getBlastMiningRankLevel(tier) < 0) { - reason.add("Skills.Mining.BlastMining.Rank_Levels.Rank_" + tier.toNumerical() + " should be at least 0!"); + reason.add("Skills.Mining.BlastMining.Rank_Levels.Rank_" + rank + " should be at least 0!"); } if (getBlastDamageDecrease(tier) < 0) { - reason.add("Skills.Mining.BlastMining.BlastDamageDecrease.Rank_" + tier.toNumerical() + " should be at least 0!"); + reason.add("Skills.Mining.BlastMining.BlastDamageDecrease.Rank_" + rank + " should be at least 0!"); } if (getOreBonus(tier) < 0) { - reason.add("Skills.Mining.BlastMining.OreBonus.Rank_" + tier.toNumerical() + " should be at least 0!"); + reason.add("Skills.Mining.BlastMining.OreBonus.Rank_" + rank + " should be at least 0!"); } if (getDebrisReduction(tier) < 0) { - reason.add("Skills.Mining.BlastMining.DebrisReduction.Rank_" + tier.toNumerical() + " should be at least 0!"); + reason.add("Skills.Mining.BlastMining.DebrisReduction.Rank_" + rank + " should be at least 0!"); } if (getDropMultiplier(tier) < 0) { - reason.add("Skills.Mining.BlastMining.DropMultiplier.Rank_" + tier.toNumerical() + " should be at least 0!"); + reason.add("Skills.Mining.BlastMining.DropMultiplier.Rank_" + rank + " should be at least 0!"); } if (getBlastRadiusModifier(tier) < 0) { - reason.add("Skills.Mining.BlastMining.BlastRadiusModifier.Rank_" + tier.toNumerical() + " should be at least 0!"); + reason.add("Skills.Mining.BlastMining.BlastRadiusModifier.Rank_" + rank + " should be at least 0!"); } if (tier != BlastMining.Tier.EIGHT) { BlastMining.Tier nextTier = blastMiningTierList.get(blastMiningTierList.indexOf(tier) - 1); if (getBlastMiningRankLevel(tier) > getBlastMiningRankLevel(nextTier)) { - reason.add("Skills.Mining.BlastMining.Rank_Levels.Rank_" + tier.toNumerical() + " should be less than or equal to Skills.Mining.BlastMining.Rank_Levels.Rank_" + nextTier.toNumerical() + "!"); + reason.add("Skills.Mining.BlastMining.Rank_Levels.Rank_" + rank + " should be less than or equal to Skills.Mining.BlastMining.Rank_Levels.Rank_" + nextrank + "!"); } if (getBlastDamageDecrease(tier) > getBlastDamageDecrease(nextTier)) { - reason.add("Skills.Mining.BlastMining.BlastDamageDecrease.Rank_" + tier.toNumerical() + " should be less than or equal to Skills.Mining.BlastMining.BlastDamageDecrease.Rank_" + nextTier.toNumerical() + "!"); + reason.add("Skills.Mining.BlastMining.BlastDamageDecrease.Rank_" + rank + " should be less than or equal to Skills.Mining.BlastMining.BlastDamageDecrease.Rank_" + nextrank + "!"); } if (getOreBonus(tier) > getOreBonus(nextTier)) { - reason.add("Skills.Mining.BlastMining.OreBonus.Rank_" + tier.toNumerical() + " should be less than or equal to Skills.Mining.BlastMining.OreBonus.Rank_" + nextTier.toNumerical() + "!"); + reason.add("Skills.Mining.BlastMining.OreBonus.Rank_" + rank + " should be less than or equal to Skills.Mining.BlastMining.OreBonus.Rank_" + nextrank + "!"); } if (getDebrisReduction(tier) > getDebrisReduction(nextTier)) { - reason.add("Skills.Mining.BlastMining.DebrisReduction.Rank_" + tier.toNumerical() + " should be less than or equal to Skills.Mining.BlastMining.DebrisReduction.Rank_" + nextTier.toNumerical() + "!"); + reason.add("Skills.Mining.BlastMining.DebrisReduction.Rank_" + rank + " should be less than or equal to Skills.Mining.BlastMining.DebrisReduction.Rank_" + nextrank + "!"); } if (getDropMultiplier(tier) > getDropMultiplier(nextTier)) { - reason.add("Skills.Mining.BlastMining.DropMultiplier.Rank_" + tier.toNumerical() + " should be less than or equal to Skills.Mining.BlastMining.DropMultiplier.Rank_" + nextTier.toNumerical() + "!"); + reason.add("Skills.Mining.BlastMining.DropMultiplier.Rank_" + rank + " should be less than or equal to Skills.Mining.BlastMining.DropMultiplier.Rank_" + nextrank + "!"); } if (getBlastRadiusModifier(tier) > getBlastRadiusModifier(nextTier)) { - reason.add("Skills.Mining.BlastMining.BlastRadiusModifier.Rank_" + tier.toNumerical() + " should be less than or equal to Skills.Mining.BlastMining.BlastRadiusModifier.Rank_" + nextTier.toNumerical() + "!"); + reason.add("Skills.Mining.BlastMining.BlastRadiusModifier.Rank_" + rank + " should be less than or equal to Skills.Mining.BlastMining.BlastRadiusModifier.Rank_" + nextrank + "!"); } } - } + }*/ /* REPAIR */ if (getRepairMasteryMaxBonus() < 1) { @@ -367,37 +367,37 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { reason.add("Skills.Repair.SuperRepair.MaxBonusLevel should be at least 1!"); } - List arcaneForgingTierList = Arrays.asList(ArcaneForging.Tier.values()); + /*List arcaneForgingTierList = Arrays.asList(ArcaneForging.Tier.values()); for (ArcaneForging.Tier tier : arcaneForgingTierList) { if (getArcaneForgingRankLevel(tier) < 0) { - reason.add("Skills.Repair.ArcaneForging.Rank_Levels.Rank_" + tier.toNumerical() + " should be at least 0!"); + reason.add("Skills.Repair.ArcaneForging.Rank_Levels.Rank_" + rank + " should be at least 0!"); } if (getArcaneForgingDowngradeChance(tier) < 0 || getArcaneForgingDowngradeChance(tier) > 100) { - reason.add("Skills.Repair.ArcaneForging.Downgrades.Chance.Rank_" + tier.toNumerical() + " only accepts values from 0 to 100!"); + reason.add("Skills.Repair.ArcaneForging.Downgrades.Chance.Rank_" + rank + " only accepts values from 0 to 100!"); } if (getArcaneForgingKeepEnchantsChance(tier) < 0 || getArcaneForgingKeepEnchantsChance(tier) > 100) { - reason.add("Skills.Repair.ArcaneForging.Keep_Enchants.Chance.Rank_" + tier.toNumerical() + " only accepts values from 0 to 100!"); + reason.add("Skills.Repair.ArcaneForging.Keep_Enchants.Chance.Rank_" + rank + " only accepts values from 0 to 100!"); } if (tier != ArcaneForging.Tier.EIGHT) { ArcaneForging.Tier nextTier = arcaneForgingTierList.get(arcaneForgingTierList.indexOf(tier) - 1); if (getArcaneForgingRankLevel(tier) > getArcaneForgingRankLevel(nextTier)) { - reason.add("Skills.Repair.ArcaneForging.Rank_Levels.Rank_" + tier.toNumerical() + " should be less than or equal to Skills.Repair.ArcaneForging.Rank_Levels.Rank_" + nextTier.toNumerical() + "!"); + reason.add("Skills.Repair.ArcaneForging.Rank_Levels.Rank_" + rank + " should be less than or equal to Skills.Repair.ArcaneForging.Rank_Levels.Rank_" + nextrank + "!"); } if (getArcaneForgingDowngradeChance(nextTier) > getArcaneForgingDowngradeChance(tier)) { - reason.add("Skills.Repair.ArcaneForging.Downgrades.Chance.Rank_" + nextTier.toNumerical() + " should be less than or equal to Skills.Repair.ArcaneForging.Downgrades.Chance.Rank_" + tier.toNumerical() + "!"); + reason.add("Skills.Repair.ArcaneForging.Downgrades.Chance.Rank_" + nextrank + " should be less than or equal to Skills.Repair.ArcaneForging.Downgrades.Chance.Rank_" + rank + "!"); } if (getArcaneForgingKeepEnchantsChance(tier) > getArcaneForgingKeepEnchantsChance(nextTier)) { - reason.add("Skills.Repair.ArcaneForging.Keep_Enchants.Chance.Rank_" + tier.toNumerical() + " should be less than or equal to Skills.Repair.ArcaneForging.Keep_Enchants.Chance.Rank_" + nextTier.toNumerical() + "!"); + reason.add("Skills.Repair.ArcaneForging.Keep_Enchants.Chance.Rank_" + rank + " should be less than or equal to Skills.Repair.ArcaneForging.Keep_Enchants.Chance.Rank_" + nextrank + "!"); } } - } + }*/ /* SALVAGE */ if (getSalvageMaxPercentage() < 1) { @@ -408,41 +408,41 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { reason.add("Skills.Salvage.MaxPercentageLevel should be at least 1!"); } - if (getAdvancedSalvageUnlockLevel() < 0) { + /*if (getAdvancedSalvageUnlockLevel() < 0) { reason.add("Skills.Salvage.AdvancedSalvage.UnlockLevel should be at least 0!"); - } + }*/ - List salvageTierList = Arrays.asList(Salvage.Tier.values()); + /*List salvageTierList = Arrays.asList(Salvage.Tier.values()); for (Salvage.Tier tier : salvageTierList) { if (getArcaneSalvageRankLevel(tier) < 0) { - reason.add("Skills.Salvage.ArcaneSalvage.Rank_Levels.Rank_" + tier.toNumerical() + " should be at least 0!"); + reason.add("Skills.Salvage.ArcaneSalvage.Rank_Levels.Rank_" + rank + " should be at least 0!"); } if (getArcaneSalvageExtractFullEnchantsChance(tier) < 0 || getArcaneSalvageExtractFullEnchantsChance(tier) > 100) { - reason.add("Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + tier.toNumerical() + " only accepts values from 0 to 100!"); + reason.add("Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + rank + " only accepts values from 0 to 100!"); } if (getArcaneSalvageExtractPartialEnchantsChance(tier) < 0 || getArcaneSalvageExtractPartialEnchantsChance(tier) > 100) { - reason.add("Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + tier.toNumerical() + " only accepts values from 0 to 100!"); + reason.add("Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + rank + " only accepts values from 0 to 100!"); } if (tier != Salvage.Tier.EIGHT) { Salvage.Tier nextTier = salvageTierList.get(salvageTierList.indexOf(tier) - 1); if (getArcaneSalvageRankLevel(tier) > getArcaneSalvageRankLevel(nextTier)) { - reason.add("Skills.Salvage.ArcaneSalvage.Rank_Levels.Rank_" + tier.toNumerical() + " should be less than or equal to Skills.Salvage.ArcaneSalvage.Rank_Levels.Rank_" + nextTier.toNumerical() + "!"); + reason.add("Skills.Salvage.ArcaneSalvage.Rank_Levels.Rank_" + rank + " should be less than or equal to Skills.Salvage.ArcaneSalvage.Rank_Levels.Rank_" + nextrank + "!"); } if (getArcaneSalvageExtractFullEnchantsChance(tier) > getArcaneSalvageExtractFullEnchantsChance(nextTier)) { - reason.add("Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + tier.toNumerical() + " should be less than or equal to Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + nextTier.toNumerical() + "!"); + reason.add("Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + rank + " should be less than or equal to Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + nextrank + "!"); } if (getArcaneSalvageExtractPartialEnchantsChance(tier) > getArcaneSalvageExtractPartialEnchantsChance(nextTier)) { - reason.add("Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + tier.toNumerical() + " should be less than or equal to Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + nextTier.toNumerical() + "!"); + reason.add("Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + rank + " should be less than or equal to Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + nextrank + "!"); } } - } + }*/ /* SMELTING */ if (getBurnModifierMaxLevel() < 1) { @@ -461,37 +461,37 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { reason.add("Skills.Smelting.SecondSmelt.ChanceMax should be at least 1!"); } - if (getFluxMiningUnlockLevel() < 0) { + /*if (getFluxMiningUnlockLevel() < 0) { reason.add("Skills.Smelting.FluxMining.UnlockLevel should be at least 0!"); - } + }*/ if (getFluxMiningChance() < 1) { reason.add("Skills.Smelting.FluxMining.Chance should be at least 1!"); } - List smeltingTierList = Arrays.asList(Smelting.Tier.values()); + /*List smeltingTierList = Arrays.asList(Smelting.Tier.values()); - for (Smelting.Tier tier : smeltingTierList) { + for (int rank : smeltingTierList) { if (getSmeltingRankLevel(tier) < 0) { - reason.add("Skills.Smelting.Rank_Levels.Rank_" + tier.toNumerical() + " should be at least 0!"); + reason.add("Skills.Smelting.Rank_Levels.Rank_" + rank + " should be at least 0!"); } if (getSmeltingVanillaXPBoostMultiplier(tier) < 1) { - reason.add("Skills.Smelting.VanillaXPMultiplier.Rank_" + tier.toNumerical() + " should be at least 1!"); + reason.add("Skills.Smelting.VanillaXPMultiplier.Rank_" + rank + " should be at least 1!"); } if (tier != Smelting.Tier.EIGHT) { Smelting.Tier nextTier = smeltingTierList.get(smeltingTierList.indexOf(tier) - 1); if (getSmeltingRankLevel(tier) > getSmeltingRankLevel(nextTier)) { - reason.add("Skills.Smelting.Rank_Levels.Rank_" + tier.toNumerical() + " should be less than or equal to Skills.Smelting.Rank_Levels.Rank_" + nextTier.toNumerical() + "!"); + reason.add("Skills.Smelting.Rank_Levels.Rank_" + rank + " should be less than or equal to Skills.Smelting.Rank_Levels.Rank_" + nextrank + "!"); } if (getSmeltingVanillaXPBoostMultiplier(tier) > getSmeltingVanillaXPBoostMultiplier(nextTier)) { - reason.add("Skills.Smelting.VanillaXPMultiplier.Rank_" + tier.toNumerical() + " should be less than or equal to Skills.Smelting.VanillaXPMultiplier.Rank_" + nextTier.toNumerical() + "!"); + reason.add("Skills.Smelting.VanillaXPMultiplier.Rank_" + rank + " should be less than or equal to Skills.Smelting.VanillaXPMultiplier.Rank_" + nextrank + "!"); } } - } + }*/ /* SWORDS */ if (getMaxChance(SubSkillType.SWORDS_BLEED) < 1) { @@ -552,41 +552,41 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { reason.add("Skills.Taming.Gore.Modifier should be at least 1!"); } - if (getFastFoodUnlock() < 0) { + /*if (getFastFoodUnlock() < 0) { reason.add("Skills.Taming.FastFood.UnlockLevel should be at least 0!"); - } + }*/ if (getFastFoodChance() < 1) { reason.add("Skills.Taming.FastFood.Chance should be at least 1!"); } - if (getEnviromentallyAwareUnlock() < 0) { + /*if (getEnviromentallyAwareUnlock() < 0) { reason.add("Skills.Taming.EnvironmentallyAware.UnlockLevel should be at least 0!"); - } + }*/ - if (getThickFurUnlock() < 0) { + /*if (getThickFurUnlock() < 0) { reason.add("Skills.Taming.ThickFur.UnlockLevel should be at least 0!"); - } + }*/ if (getThickFurModifier() < 1) { reason.add("Skills.Taming.ThickFur.Modifier should be at least 1!"); } - if (getHolyHoundUnlock() < 0) { + /*if (getHolyHoundUnlock() < 0) { reason.add("Skills.Taming.HolyHound.UnlockLevel should be at least 0!"); } if (getShockProofUnlock() < 0) { reason.add("Skills.Taming.ShockProof.UnlockLevel should be at least 0!"); - } + }*/ if (getShockProofModifier() < 1) { reason.add("Skills.Taming.ShockProof.Modifier should be at least 1!"); } - if (getSharpenedClawsUnlock() < 0) { + /*if (getSharpenedClawsUnlock() < 0) { reason.add("Skills.Taming.SharpenedClaws.UnlockLevel should be at least 0!"); - } + }*/ if (getSharpenedClawsBonus() < 1) { reason.add("Skills.Taming.SharpenedClaws.Bonus should be at least 1!"); @@ -639,9 +639,9 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { /* WOODCUTTING */ - if (getLeafBlowUnlockLevel() < 0) { + /*if (getLeafBlowUnlockLevel() < 0) { reason.add("Skills.Woodcutting.LeafBlower.UnlockLevel should be at least 0!"); - } + }*/ if (getMaxChance(SubSkillType.WOODCUTTING_HARVEST_LUMBER) < 1) { reason.add("Skills.Woodcutting.HarvestLumber.ChanceMax should be at least 1!"); @@ -827,13 +827,13 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { public double getGracefulRollDamageThreshold() { return config.getDouble("Skills.Acrobatics.GracefulRoll.DamageThreshold", 14.0D); } /* ALCHEMY */ - public int getCatalysisUnlockLevel() { return config.getInt("Skills.Alchemy.Catalysis.UnlockLevel", 100); } + /*public int getCatalysisUnlockLevel() { return config.getInt("Skills.Alchemy.Catalysis.UnlockLevel", 100); }*/ public int getCatalysisMaxBonusLevel() { return config.getInt("Skills.Alchemy.Catalysis.MaxBonusLevel", 1000); } public double getCatalysisMinSpeed() { return config.getDouble("Skills.Alchemy.Catalysis.MinSpeed", 1.0D); } public double getCatalysisMaxSpeed() { return config.getDouble("Skills.Alchemy.Catalysis.MaxSpeed", 4.0D); } - public int getConcoctionsTierLevel(Alchemy.Tier tier) { return config.getInt("Skills.Alchemy.Rank_Levels.Rank_" + tier.toNumerical()); } + //public int getConcoctionsTierLevel(Alchemy.Tier tier) { return config.getInt("Skills.Alchemy.Rank_Levels.Rank_" + rank); } /* ARCHERY */ public int getSkillShotIncreaseLevel() { return config.getInt("Skills.Archery.SkillShot.IncreaseLevel", 50); } @@ -864,15 +864,15 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { //Nothing to configure, everything is already configurable in config.yml /* FISHING */ - public int getFishingTierLevel(Fishing.Tier tier) { return config.getInt("Skills.Fishing.Rank_Levels.Rank_" + tier.toNumerical()); } - public double getShakeChance(Fishing.Tier tier) { return config.getDouble("Skills.Fishing.ShakeChance.Rank_" + tier.toNumerical()); } - public int getFishingVanillaXPModifier(Fishing.Tier tier) { return config.getInt("Skills.Fishing.VanillaXPMultiplier.Rank_" + tier.toNumerical()); } + //public int getFishingTierLevel(int rank) { return config.getInt("Skills.Fishing.Rank_Levels.Rank_" + rank); } + public double getShakeChance(int rank) { return config.getDouble("Skills.Fishing.ShakeChance.Rank_" + rank); } + public int getFishingVanillaXPModifier(int rank) { return config.getInt("Skills.Fishing.VanillaXPMultiplier.Rank_" + rank); } public int getFishermanDietRankChange() { return config.getInt("Skills.Fishing.FishermansDiet.RankChange", 200); } - public int getIceFishingUnlockLevel() { return config.getInt("Skills.Fishing.IceFishing.UnlockLevel", 50); } + /*public int getIceFishingUnlockLevel() { return config.getInt("Skills.Fishing.IceFishing.UnlockLevel", 50); } - public int getMasterAnglerUnlockLevel() {return config.getInt("Skills.Fishing.MasterAngler.UnlockLevel", 125); } + public int getMasterAnglerUnlockLevel() {return config.getInt("Skills.Fishing.MasterAngler.UnlockLevel", 125); }*/ public double getMasterAnglerBoatModifier() {return config.getDouble("Skills.Fishing.MasterAngler.BoatModifier", 2.0); } public double getMasterAnglerBiomeModifier() {return config.getDouble("Skills.Fishing.MasterAngler.BiomeModifier", 2.0); } @@ -882,49 +882,49 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { public int getGreenThumbStageChange() { return config.getInt("Skills.Herbalism.GreenThumb.StageChange", 200); } /* MINING */ - public int getBlastMiningRankLevel(BlastMining.Tier tier) { return config.getInt("Skills.Mining.BlastMining.Rank_Levels.Rank_" + tier.toNumerical()); } - public double getBlastDamageDecrease(BlastMining.Tier tier) { return config.getDouble("Skills.Mining.BlastMining.BlastDamageDecrease.Rank_" + tier.toNumerical()); } - public double getOreBonus(BlastMining.Tier tier) { return config.getDouble("Skills.Mining.BlastMining.OreBonus.Rank_" + tier.toNumerical()); } - public double getDebrisReduction(BlastMining.Tier tier) { return config.getDouble("Skills.Mining.BlastMining.DebrisReduction.Rank_" + tier.toNumerical()); } - public int getDropMultiplier(BlastMining.Tier tier) { return config.getInt("Skills.Mining.BlastMining.DropMultiplier.Rank_" + tier.toNumerical()); } - public double getBlastRadiusModifier(BlastMining.Tier tier) { return config.getDouble("Skills.Mining.BlastMining.BlastRadiusModifier.Rank_" + tier.toNumerical()); } + public int getBlastMiningRankLevel(int rank) { return config.getInt("Skills.Mining.BlastMining.Rank_Levels.Rank_" + rank); } + public double getBlastDamageDecrease(int rank) { return config.getDouble("Skills.Mining.BlastMining.BlastDamageDecrease.Rank_" + rank); } + public double getOreBonus(int rank) { return config.getDouble("Skills.Mining.BlastMining.OreBonus.Rank_" + rank); } + public double getDebrisReduction(int rank) { return config.getDouble("Skills.Mining.BlastMining.DebrisReduction.Rank_" + rank); } + public int getDropMultiplier(int rank) { return config.getInt("Skills.Mining.BlastMining.DropMultiplier.Rank_" + rank); } + public double getBlastRadiusModifier(int rank) { return config.getDouble("Skills.Mining.BlastMining.BlastRadiusModifier.Rank_" + rank); } /* REPAIR */ public double getRepairMasteryMaxBonus() { return config.getDouble("Skills.Repair.RepairMastery.MaxBonusPercentage", 200.0D); } public int getRepairMasteryMaxLevel() { return config.getInt("Skills.Repair.RepairMastery.MaxBonusLevel", 1000); } /* Arcane Forging */ - public int getArcaneForgingRankLevel(ArcaneForging.Tier tier) { return config.getInt("Skills.Repair.ArcaneForging.Rank_Levels.Rank_" + tier.toNumerical()); } + public int getArcaneForgingRankLevel(int rank) { return config.getInt("Skills.Repair.ArcaneForging.Rank_Levels.Rank_" + rank); } public boolean getArcaneForgingEnchantLossEnabled() { return config.getBoolean("Skills.Repair.ArcaneForging.May_Lose_Enchants", true); } - public double getArcaneForgingKeepEnchantsChance(ArcaneForging.Tier tier) { return config.getDouble("Skills.Repair.ArcaneForging.Keep_Enchants_Chance.Rank_" + tier.toNumerical()); } + public double getArcaneForgingKeepEnchantsChance(int rank) { return config.getDouble("Skills.Repair.ArcaneForging.Keep_Enchants_Chance.Rank_" + rank); } public boolean getArcaneForgingDowngradeEnabled() { return config.getBoolean("Skills.Repair.ArcaneForging.Downgrades_Enabled", true); } - public double getArcaneForgingDowngradeChance(ArcaneForging.Tier tier) { return config.getDouble("Skills.Repair.ArcaneForging.Downgrades_Chance.Rank_" + tier.toNumerical()); } + public double getArcaneForgingDowngradeChance(int rank) { return config.getDouble("Skills.Repair.ArcaneForging.Downgrades_Chance.Rank_" + rank); } /* SALVAGE */ public double getSalvageMaxPercentage() { return config.getDouble("Skills.Salvage.MaxPercentage", 100.0D); } public int getSalvageMaxPercentageLevel() { return config.getInt("Skills.Salvage.MaxPercentageLevel", 1000); } - public int getAdvancedSalvageUnlockLevel() { return config.getInt("Skills.Salvage.AdvancedSalvage.UnlockLevel", 350); } + /*public int getAdvancedSalvageUnlockLevel() { return config.getInt("Skills.Salvage.AdvancedSalvage.UnlockLevel", 350); }*/ public boolean getArcaneSalvageEnchantDowngradeEnabled() { return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantDowngradeEnabled", true); } public boolean getArcaneSalvageEnchantLossEnabled() { return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantLossEnabled", true); } - public int getArcaneSalvageRankLevel(Salvage.Tier tier) { return config.getInt("Skills.Salvage.ArcaneSalvage.Rank_Levels.Rank_" + tier.toNumerical()); } - public double getArcaneSalvageExtractFullEnchantsChance(Salvage.Tier tier) { return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + tier.toNumerical()); } - public double getArcaneSalvageExtractPartialEnchantsChance(Salvage.Tier tier) { return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + tier.toNumerical()); } + //public int getArcaneSalvageRankLevel(int rank) { return config.getInt("Skills.Salvage.ArcaneSalvage.Rank_Levels.Rank_" + rank); } + public double getArcaneSalvageExtractFullEnchantsChance(int rank) { return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + rank); } + public double getArcaneSalvageExtractPartialEnchantsChance(int rank) { return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + rank); } /* SMELTING */ public int getBurnModifierMaxLevel() { return config.getInt("Skills.Smelting.FuelEfficiency.MaxBonusLevel", 1000); } public double getBurnTimeMultiplier() { return config.getDouble("Skills.Smelting.FuelEfficiency.Multiplier", 3.0D); } - public int getFluxMiningUnlockLevel() { return config.getInt("Skills.Smelting.FluxMining.UnlockLevel", 250); } + /*public int getFluxMiningUnlockLevel() { return config.getInt("Skills.Smelting.FluxMining.UnlockLevel", 250); }*/ public double getFluxMiningChance() { return config.getDouble("Skills.Smelting.FluxMining.Chance", 33.0D); } - public int getSmeltingRankLevel(Smelting.Tier tier) { return config.getInt("Skills.Smelting.Rank_Levels.Rank_" + tier.toNumerical()); } + public int getSmeltingRankLevel(int rank) { return config.getInt("Skills.Smelting.Rank_Levels.Rank_" + rank); } - public int getSmeltingVanillaXPBoostMultiplier(Smelting.Tier tier) { return config.getInt("Skills.Smelting.VanillaXPMultiplier.Rank_" + tier.toNumerical()); } + public int getSmeltingVanillaXPBoostMultiplier(int rank) { return config.getInt("Skills.Smelting.VanillaXPMultiplier.Rank_" + rank); } /* SWORDS */ public double getBleedDamagePlayer() { return config.getDouble("Skills.Swords.Bleed.DamagePlayer", 1.0); } @@ -943,20 +943,20 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { public int getGoreBleedTicks() { return config.getInt("Skills.Taming.Gore.BleedTicks", 2); } public double getGoreModifier() { return config.getDouble("Skills.Taming.Gore.Modifier", 2.0D); } - public int getFastFoodUnlock() { return config.getInt("Skills.Taming.FastFood.UnlockLevel", 50); } + /*public int getFastFoodUnlock() { return config.getInt("Skills.Taming.FastFood.UnlockLevel", 50); }*/ public double getFastFoodChance() { return config.getDouble("Skills.Taming.FastFood.Chance", 50.0D); } public int getEnviromentallyAwareUnlock() { return config.getInt("Skills.Taming.EnvironmentallyAware.UnlockLevel", 100); } - public int getThickFurUnlock() { return config.getInt("Skills.Taming.ThickFur.UnlockLevel", 250); } + /*public int getThickFurUnlock() { return config.getInt("Skills.Taming.ThickFur.UnlockLevel", 250); }*/ public double getThickFurModifier() { return config.getDouble("Skills.Taming.ThickFur.Modifier", 2.0D); } - public int getHolyHoundUnlock() {return config.getInt("Skills.Taming.HolyHound.UnlockLevel", 375); } + /*public int getHolyHoundUnlock() {return config.getInt("Skills.Taming.HolyHound.UnlockLevel", 375); }*/ - public int getShockProofUnlock() { return config.getInt("Skills.Taming.ShockProof.UnlockLevel", 500); } + /*public int getShockProofUnlock() { return config.getInt("Skills.Taming.ShockProof.UnlockLevel", 500); }*/ public double getShockProofModifier() { return config.getDouble("Skills.Taming.ShockProof.Modifier", 6.0D); } - public int getSharpenedClawsUnlock() { return config.getInt("Skills.Taming.SharpenedClaws.UnlockLevel", 750); } + /*public int getSharpenedClawsUnlock() { return config.getInt("Skills.Taming.SharpenedClaws.UnlockLevel", 750); }*/ public double getSharpenedClawsBonus() { return config.getDouble("Skills.Taming.SharpenedClaws.Bonus", 2.0D); } public double getMinHorseJumpStrength() { return config.getDouble("Skills.Taming.CallOfTheWild.MinHorseJumpStrength", 0.7D); } @@ -969,7 +969,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { public boolean getDisarmProtected() { return config.getBoolean("Skills.Unarmed.Disarm.AntiTheft", false); } /* WOODCUTTING */ - public int getLeafBlowUnlockLevel() { return config.getInt("Skills.Woodcutting.LeafBlower.UnlockLevel", 100); } + /*public int getLeafBlowUnlockLevel() { return config.getInt("Skills.Woodcutting.LeafBlower.UnlockLevel", 100); }*/ /* KRAKEN STUFF */ public boolean getKrakenEnabled() { return config.getBoolean("Kraken.Enabled", true); } diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java b/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java index 09b242b97..e29ebc5fc 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java @@ -36,7 +36,7 @@ public enum SubSkillType { FISHING_ICE_FISHING(1), FISHING_MAGIC_HUNTER, FISHING_MASTER_ANGLER(1), - FISHING_SHAKE, + FISHING_SHAKE(1), /* Herbalism */ HERBALISM_FARMERS_DIET(5), @@ -54,7 +54,7 @@ public enum SubSkillType { MINING_DEMOLITIONS_EXPERTISE(1), /* Repair */ - REPAIR_ARCANE_FORGING, + REPAIR_ARCANE_FORGING(8), REPAIR_REPAIR_MASTERY, REPAIR_SUPER_REPAIR, @@ -64,7 +64,7 @@ public enum SubSkillType { SALVAGE_UNDERSTANDING_THE_ART(8), /* Smelting */ - SMELTING_FLUX_MINING, + SMELTING_FLUX_MINING(1), SMELTING_FUEL_EFFICIENCY, SMELTING_SECOND_SMELT, SMELTING_UNDERSTANDING_THE_ART(8), diff --git a/src/main/java/com/gmail/nossr50/skills/alchemy/Alchemy.java b/src/main/java/com/gmail/nossr50/skills/alchemy/Alchemy.java index 34f464e14..478957de6 100644 --- a/src/main/java/com/gmail/nossr50/skills/alchemy/Alchemy.java +++ b/src/main/java/com/gmail/nossr50/skills/alchemy/Alchemy.java @@ -1,8 +1,10 @@ package com.gmail.nossr50.skills.alchemy; import com.gmail.nossr50.config.AdvancedConfig; +import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.runnables.skills.AlchemyBrewTask; +import com.gmail.nossr50.util.skills.RankUtils; import org.bukkit.Location; import java.util.ArrayList; @@ -11,7 +13,7 @@ import java.util.List; import java.util.Map; public final class Alchemy { - public enum Tier { + /*public enum Tier { EIGHT(8), SEVEN(7), SIX(6), @@ -43,11 +45,11 @@ public final class Alchemy { protected int getLevel() { return AdvancedConfig.getInstance().getConcoctionsTierLevel(this); } - } + }*/ public static final int INGREDIENT_SLOT = 3; - public static int catalysisUnlockLevel = AdvancedConfig.getInstance().getCatalysisUnlockLevel(); + public static int catalysisUnlockLevel = RankUtils.getUnlockLevel(SubSkillType.ALCHEMY_CATALYSIS); public static int catalysisMaxBonusLevel = AdvancedConfig.getInstance().getCatalysisMaxBonusLevel(); public static double catalysisMinSpeed = AdvancedConfig.getInstance().getCatalysisMinSpeed(); public static double catalysisMaxSpeed = AdvancedConfig.getInstance().getCatalysisMaxSpeed(); @@ -70,4 +72,4 @@ public final class Alchemy { alchemyBrewTask.finishImmediately(); } } -} +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyManager.java b/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyManager.java index 8cf631c01..49ea47db2 100644 --- a/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyManager.java +++ b/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyManager.java @@ -4,10 +4,12 @@ import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.config.skills.alchemy.PotionConfig; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; +import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.XPGainReason; import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage; import com.gmail.nossr50.skills.SkillManager; import com.gmail.nossr50.util.StringUtils; +import com.gmail.nossr50.util.skills.RankUtils; import org.bukkit.inventory.ItemStack; import java.util.List; @@ -20,13 +22,7 @@ public class AlchemyManager extends SkillManager { } public int getTier() { - for (Alchemy.Tier tier : Alchemy.Tier.values()) { - if (getSkillLevel() >= tier.getLevel()) { - return tier.toNumerical(); - } - } - - return 0; + return RankUtils.getRank(getPlayer(), SubSkillType.ALCHEMY_CONCOCTIONS); } public List getIngredients() { @@ -58,4 +54,4 @@ public class AlchemyManager extends SkillManager { public void handlePotionBrewSuccesses(PotionStage potionStage, int amount) { applyXpGain((float) (ExperienceConfig.getInstance().getPotionXP(potionStage) * amount), XPGainReason.PVE); } -} +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java b/src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java index d257e9e26..8d2c72694 100644 --- a/src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java +++ b/src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java @@ -17,33 +17,6 @@ import java.util.Set; public final class Fishing { - // The order of the values is extremely important, a few methods depend on it to work properly - public enum Tier { - EIGHT(8), SEVEN(7), SIX(6), FIVE(5), FOUR(4), THREE(3), TWO(2), ONE(1); - - int numerical; - - private Tier(int numerical) { - this.numerical = numerical; - } - - public int toNumerical() { - return numerical; - } - - protected int getLevel() { - return AdvancedConfig.getInstance().getFishingTierLevel(this); - } - - protected double getShakeChance() { - return AdvancedConfig.getInstance().getShakeChance(this); - } - - protected int getVanillaXPBoostModifier() { - return AdvancedConfig.getInstance().getFishingVanillaXPModifier(this); - } - } - protected static final HashMap> ENCHANTABLE_CACHE = new HashMap>(); public static int fishermansDietRankLevel1 = AdvancedConfig.getInstance().getFishermanDietRankChange(); diff --git a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java index b850c9404..e6ff94f4f 100644 --- a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java @@ -19,10 +19,10 @@ import com.gmail.nossr50.events.skills.secondaryabilities.SubSkillWeightedActiva import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.runnables.skills.KrakenAttackTask; import com.gmail.nossr50.skills.SkillManager; -import com.gmail.nossr50.skills.fishing.Fishing.Tier; import com.gmail.nossr50.util.*; import com.gmail.nossr50.util.player.NotificationManager; import com.gmail.nossr50.util.skills.CombatUtils; +import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.util.sounds.SoundManager; import com.gmail.nossr50.util.sounds.SoundType; @@ -56,11 +56,11 @@ public class FishingManager extends SkillManager { } public boolean canShake(Entity target) { - return target instanceof LivingEntity && getSkillLevel() >= Tier.ONE.getLevel() && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.FISHING_SHAKE); + return target instanceof LivingEntity && RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.FISHING_SHAKE) && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.FISHING_SHAKE); } public boolean canMasterAngler() { - return getSkillLevel() >= AdvancedConfig.getInstance().getMasterAnglerUnlockLevel() && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.FISHING_MASTER_ANGLER); + return getSkillLevel() >= RankUtils.getUnlockLevel(SubSkillType.FISHING_MASTER_ANGLER) && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.FISHING_MASTER_ANGLER); } public boolean unleashTheKraken() { @@ -173,7 +173,7 @@ public class FishingManager extends SkillManager { } public boolean canIceFish(Block block) { - if (getSkillLevel() < AdvancedConfig.getInstance().getIceFishingUnlockLevel()) { + if (getSkillLevel() < RankUtils.getUnlockLevel(SubSkillType.FISHING_ICE_FISHING)) { return false; } @@ -201,15 +201,15 @@ public class FishingManager extends SkillManager { * @return the loot tier */ public int getLootTier() { - int skillLevel = getSkillLevel(); + return RankUtils.getRank(getPlayer(), SubSkillType.FISHING_TREASURE_HUNTER); + } - for (Tier tier : Tier.values()) { - if (skillLevel >= tier.getLevel()) { - return tier.toNumerical(); - } - } + protected double getShakeChance() { + return AdvancedConfig.getInstance().getShakeChance(getLootTier()); + } - return 0; + protected int getVanillaXPBoostModifier() { + return AdvancedConfig.getInstance().getFishingVanillaXPModifier(getLootTier()); } /** @@ -218,15 +218,7 @@ public class FishingManager extends SkillManager { * @return Shake Mob probability */ public double getShakeProbability() { - int skillLevel = getSkillLevel(); - - for (Tier tier : Tier.values()) { - if (skillLevel >= tier.getLevel()) { - return tier.getShakeChance(); - } - } - - return 0.0; + return getShakeChance(); } /** @@ -428,7 +420,7 @@ public class FishingManager extends SkillManager { } break; default: - break; + break; } McMMOPlayerShakeEvent shakeEvent = new McMMOPlayerShakeEvent(getPlayer(), drop); @@ -459,7 +451,7 @@ public class FishingManager extends SkillManager { } else { // We know something was caught, so if the rod wasn't in the main hand it must be in the offhand - luck = getPlayer().getInventory().getItemInOffHand().getEnchantmentLevel(Enchantment.LUCK); + luck = getPlayer().getInventory().getItemInOffHand().getEnchantmentLevel(Enchantment.LUCK); } // Rather than subtracting luck (and causing a minimum 3% chance for every drop), scale by luck. @@ -634,14 +626,6 @@ public class FishingManager extends SkillManager { * @return the vanilla XP multiplier */ private int getVanillaXpMultiplier() { - int skillLevel = getSkillLevel(); - - for (Tier tier : Tier.values()) { - if (skillLevel >= tier.getLevel()) { - return tier.getVanillaXPBoostModifier(); - } - } - - return 1; + return getVanillaXPBoostModifier(); } -} +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/skills/mining/BlastMining.java b/src/main/java/com/gmail/nossr50/skills/mining/BlastMining.java index a2bb9c983..39e2f65f3 100644 --- a/src/main/java/com/gmail/nossr50/skills/mining/BlastMining.java +++ b/src/main/java/com/gmail/nossr50/skills/mining/BlastMining.java @@ -2,8 +2,10 @@ package com.gmail.nossr50.skills.mining; import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.Config; +import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.player.UserManager; +import com.gmail.nossr50.util.skills.RankUtils; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.entity.TNTPrimed; @@ -15,7 +17,7 @@ import java.util.List; public class BlastMining { // The order of the values is extremely important, a few methods depend on it to work properly - public enum Tier { + /* public enum Tier { EIGHT(8), SEVEN(7), SIX(6), @@ -39,52 +41,58 @@ public class BlastMining { return AdvancedConfig.getInstance().getBlastMiningRankLevel(this); } - protected double getBlastRadiusModifier() { - return AdvancedConfig.getInstance().getBlastRadiusModifier(this); - } - protected double getOreBonus() { - return AdvancedConfig.getInstance().getOreBonus(this); - } - - protected double getDebrisReduction() { - return AdvancedConfig.getInstance().getDebrisReduction(this); - } - - protected double getBlastDamageDecrease() { - return AdvancedConfig.getInstance().getBlastDamageDecrease(this); - } - - protected int getDropMultiplier() { - return AdvancedConfig.getInstance().getDropMultiplier(this); - } - } + }*/ public static Material detonator = Config.getInstance().getDetonatorItem(); public final static int MAXIMUM_REMOTE_DETONATION_DISTANCE = 100; + public static double getBlastRadiusModifier(int rank) { + return AdvancedConfig.getInstance().getBlastRadiusModifier(rank); + } + + + + public static double getBlastDamageDecrease(int rank) { + return AdvancedConfig.getInstance().getBlastDamageDecrease(rank); + } + + + public static int getDemolitionExpertUnlockLevel() { - List tierList = Arrays.asList(Tier.values()); + /*List tierList = Arrays.asList(Tier.values()); for (Tier tier : tierList) { if (tier.getBlastDamageDecrease() > 0) { continue; } return tier == Tier.EIGHT ? tier.getLevel() : tierList.get(tierList.indexOf(tier) - 1).getLevel(); + }*/ + + for(int i = 0; i < SubSkillType.MINING_BLAST_MINING.getNumRanks()-1; i++) + { + if(getBlastDamageDecrease(i+1) > 0) + return RankUtils.getRankUnlockLevel(SubSkillType.MINING_BLAST_MINING, i+1); } return 0; } public static int getBiggerBombsUnlockLevel() { - List tierList = Arrays.asList(Tier.values()); + /*List tierList = Arrays.asList(Tier.values()); for (Tier tier : tierList) { if (tier.getBlastRadiusModifier() > 1.0) { continue; } return tier == Tier.EIGHT ? tier.getLevel() : tierList.get(tierList.indexOf(tier) - 1).getLevel(); + }*/ + + for(int i = 0; i < SubSkillType.MINING_BLAST_MINING.getNumRanks()-1; i++) + { + if(getBlastRadiusModifier(i+1) > 0) + return RankUtils.getRankUnlockLevel(SubSkillType.MINING_BLAST_MINING, i+1); } return 0; diff --git a/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java b/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java index 43f907d9b..981f34d0d 100644 --- a/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java +++ b/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java @@ -1,5 +1,6 @@ package com.gmail.nossr50.skills.mining; +import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.datatypes.player.McMMOPlayer; @@ -10,12 +11,12 @@ import com.gmail.nossr50.datatypes.skills.XPGainReason; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.runnables.skills.AbilityCooldownTask; import com.gmail.nossr50.skills.SkillManager; -import com.gmail.nossr50.skills.mining.BlastMining.Tier; import com.gmail.nossr50.util.BlockUtils; import com.gmail.nossr50.util.EventUtils; import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.player.NotificationManager; +import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.SkillActivationType; import com.gmail.nossr50.util.skills.SkillUtils; import org.bukkit.Material; @@ -45,7 +46,8 @@ public class MiningManager extends SkillManager { } public boolean canUseBlastMining() { - return getSkillLevel() >= BlastMining.Tier.ONE.getLevel(); + //Not checking permissions? + return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.MINING_BLAST_MINING); } public boolean canUseBiggerBombs() { @@ -193,15 +195,7 @@ public class MiningManager extends SkillManager { * @return the Blast Mining tier */ public int getBlastMiningTier() { - int skillLevel = getSkillLevel(); - - for (Tier tier : Tier.values()) { - if (skillLevel >= tier.getLevel()) { - return tier.toNumerical(); - } - } - - return 0; + return RankUtils.getRank(getPlayer(), SubSkillType.MINING_BLAST_MINING); } /** @@ -210,15 +204,15 @@ public class MiningManager extends SkillManager { * @return the Blast Mining tier */ public double getOreBonus() { - int skillLevel = getSkillLevel(); + return getOreBonus(getBlastMiningTier()); + } - for (Tier tier : Tier.values()) { - if (skillLevel >= tier.getLevel()) { - return tier.getOreBonus(); - } - } + public static double getOreBonus(int rank) { + return AdvancedConfig.getInstance().getOreBonus(rank); + } - return 0; + public static double getDebrisReduction(int rank) { + return AdvancedConfig.getInstance().getDebrisReduction(rank); } /** @@ -227,15 +221,11 @@ public class MiningManager extends SkillManager { * @return the Blast Mining tier */ public double getDebrisReduction() { - int skillLevel = getSkillLevel(); + return getDebrisReduction(getBlastMiningTier()); + } - for (Tier tier : Tier.values()) { - if (skillLevel >= tier.getLevel()) { - return tier.getDebrisReduction(); - } - } - - return 0; + public static int getDropMultiplier(int rank) { + return AdvancedConfig.getInstance().getDropMultiplier(rank); } /** @@ -244,15 +234,7 @@ public class MiningManager extends SkillManager { * @return the Blast Mining tier */ public int getDropMultiplier() { - int skillLevel = getSkillLevel(); - - for (Tier tier : Tier.values()) { - if (skillLevel >= tier.getLevel()) { - return tier.getDropMultiplier(); - } - } - - return 0; + return getDropMultiplier(getBlastMiningTier()); } /** @@ -261,15 +243,7 @@ public class MiningManager extends SkillManager { * @return the Blast Mining tier */ public double getBlastRadiusModifier() { - int skillLevel = getSkillLevel(); - - for (Tier tier : Tier.values()) { - if (skillLevel >= tier.getLevel()) { - return tier.getBlastRadiusModifier(); - } - } - - return 0; + return BlastMining.getBlastRadiusModifier(getBlastMiningTier()); } /** @@ -278,15 +252,7 @@ public class MiningManager extends SkillManager { * @return the Blast Mining tier */ public double getBlastDamageModifier() { - int skillLevel = getSkillLevel(); - - for (Tier tier : Tier.values()) { - if (skillLevel >= tier.getLevel()) { - return tier.getBlastDamageDecrease(); - } - } - - return 0; + return BlastMining.getBlastDamageDecrease(getBlastMiningTier()); } private boolean blastMiningCooldownOver() { diff --git a/src/main/java/com/gmail/nossr50/skills/repair/ArcaneForging.java b/src/main/java/com/gmail/nossr50/skills/repair/ArcaneForging.java index 9081241ea..f7ea4fd70 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/ArcaneForging.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/ArcaneForging.java @@ -3,39 +3,6 @@ package com.gmail.nossr50.skills.repair; import com.gmail.nossr50.config.AdvancedConfig; public class ArcaneForging { - // The order of the values is extremely important, a few methods depend on it to work properly - public enum Tier { - EIGHT(8), - SEVEN(7), - SIX(6), - FIVE(5), - FOUR(4), - THREE(3), - TWO(2), - ONE(1); - - int numerical; - - private Tier(int numerical) { - this.numerical = numerical; - } - - public int toNumerical() { - return numerical; - } - - protected int getLevel() { - return AdvancedConfig.getInstance().getArcaneForgingRankLevel(this); - } - - protected double getKeepEnchantChance() { - return AdvancedConfig.getInstance().getArcaneForgingKeepEnchantsChance(this); - } - - protected double getDowngradeEnchantChance() { - return AdvancedConfig.getInstance().getArcaneForgingDowngradeChance(this); - } - } public static boolean arcaneForgingDowngrades = AdvancedConfig.getInstance().getArcaneForgingDowngradeEnabled(); public static boolean arcaneForgingEnchantLoss = AdvancedConfig.getInstance().getArcaneForgingEnchantLossEnabled(); diff --git a/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java b/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java index 9c2765a9e..9103ef7d8 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java @@ -1,5 +1,6 @@ package com.gmail.nossr50.skills.repair; +import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.datatypes.interactions.NotificationType; @@ -10,13 +11,13 @@ import com.gmail.nossr50.datatypes.skills.XPGainReason; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.skills.SkillManager; -import com.gmail.nossr50.skills.repair.ArcaneForging.Tier; import com.gmail.nossr50.skills.repair.repairables.Repairable; import com.gmail.nossr50.util.EventUtils; import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.player.NotificationManager; +import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.SkillActivationType; import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.util.sounds.SoundManager; @@ -67,7 +68,7 @@ public class RepairManager extends SkillManager { NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILURE, "Anvil.Unbreakable"); return; } - + // Permissions checks on material and item types if (!Permissions.repairMaterialType(player, repairable.getRepairMaterialType())) { NotificationManager.sendPlayerInformation(player, NotificationType.NO_PERMISSION, "mcMMO.NoPermission"); @@ -194,15 +195,7 @@ public class RepairManager extends SkillManager { * @return the current Arcane Forging rank */ public int getArcaneForgingRank() { - int skillLevel = getSkillLevel(); - - for (Tier tier : Tier.values()) { - if (skillLevel >= tier.getLevel()) { - return tier.toNumerical(); - } - } - - return 0; + return RankUtils.getRank(getPlayer(), SubSkillType.REPAIR_ARCANE_FORGING); } /** @@ -211,6 +204,24 @@ public class RepairManager extends SkillManager { * @return The chance of keeping the enchantment */ public double getKeepEnchantChance() { + return AdvancedConfig.getInstance().getArcaneForgingKeepEnchantsChance(getArcaneForgingRank()); + } + + /** + * Gets chance of enchantment being downgraded during repair. + * + * @return The chance of the enchantment being downgraded + */ + public double getDowngradeEnchantChance() { + return AdvancedConfig.getInstance().getArcaneForgingDowngradeChance(getArcaneForgingRank()); + } + + /** + * Gets chance of keeping enchantment during repair. + * + * @return The chance of keeping the enchantment + */ + /*public double getKeepEnchantChance() { int skillLevel = getSkillLevel(); for (Tier tier : Tier.values()) { @@ -220,14 +231,14 @@ public class RepairManager extends SkillManager { } return 0; - } + }*/ /** * Gets chance of enchantment being downgraded during repair. * * @return The chance of the enchantment being downgraded */ - public double getDowngradeEnchantChance() { + /*public double getDowngradeEnchantChance() { int skillLevel = getSkillLevel(); for (Tier tier : Tier.values()) { @@ -237,7 +248,7 @@ public class RepairManager extends SkillManager { } return 100; - } + }*/ /** * Computes repair bonuses. @@ -365,4 +376,4 @@ public class RepairManager extends SkillManager { public void actualizeLastAnvilUse() { lastClick = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR); } -} +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/skills/salvage/Salvage.java b/src/main/java/com/gmail/nossr50/skills/salvage/Salvage.java index f770a2d9c..d7b54ac06 100644 --- a/src/main/java/com/gmail/nossr50/skills/salvage/Salvage.java +++ b/src/main/java/com/gmail/nossr50/skills/salvage/Salvage.java @@ -2,49 +2,17 @@ package com.gmail.nossr50.skills.salvage; import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.Config; +import com.gmail.nossr50.datatypes.skills.SubSkillType; +import com.gmail.nossr50.util.skills.RankUtils; import org.bukkit.Material; public class Salvage { - // The order of the values is extremely important, a few methods depend on it to work properly - public enum Tier { - EIGHT(8), - SEVEN(7), - SIX(6), - FIVE(5), - FOUR(4), - THREE(3), - TWO(2), - ONE(1); - - int numerical; - - private Tier(int numerical) { - this.numerical = numerical; - } - - public int toNumerical() { - return numerical; - } - - protected int getLevel() { - return AdvancedConfig.getInstance().getArcaneSalvageRankLevel(this); - } - - protected double getExtractFullEnchantChance() { - return AdvancedConfig.getInstance().getArcaneSalvageExtractFullEnchantsChance(this); - } - - protected double getExtractPartialEnchantChance() { - return AdvancedConfig.getInstance().getArcaneSalvageExtractPartialEnchantsChance(this); - } - } - public static Material anvilMaterial = Config.getInstance().getSalvageAnvilMaterial(); public static int salvageMaxPercentageLevel = AdvancedConfig.getInstance().getSalvageMaxPercentageLevel(); public static double salvageMaxPercentage = AdvancedConfig.getInstance().getSalvageMaxPercentage(); - public static int advancedSalvageUnlockLevel = AdvancedConfig.getInstance().getAdvancedSalvageUnlockLevel(); + public static int advancedSalvageUnlockLevel = RankUtils.getRankUnlockLevel(SubSkillType.SALVAGE_ADVANCED_SALVAGE, 1); public static boolean arcaneSalvageDowngrades = AdvancedConfig.getInstance().getArcaneSalvageEnchantDowngradeEnabled(); public static boolean arcaneSalvageEnchantLoss = AdvancedConfig.getInstance().getArcaneSalvageEnchantLossEnabled(); @@ -54,4 +22,4 @@ public class Salvage { return (int) Math.floor(baseAmount * percentDamaged); } -} +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java b/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java index 0b405ef5a..02978eae6 100644 --- a/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java +++ b/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java @@ -1,19 +1,21 @@ package com.gmail.nossr50.skills.salvage; +import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; +import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.skills.SkillManager; -import com.gmail.nossr50.skills.salvage.Salvage.Tier; import com.gmail.nossr50.skills.salvage.salvageables.Salvageable; import com.gmail.nossr50.util.EventUtils; import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.player.NotificationManager; +import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.util.sounds.SoundManager; import com.gmail.nossr50.util.sounds.SoundType; @@ -65,7 +67,7 @@ public class SalvageManager extends SkillManager { NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILURE, "Anvil.Unbreakable"); return; } - + // Permissions checks on material and item types if (!Permissions.salvageItemType(player, salvageable.getSalvageItemType())) { NotificationManager.sendPlayerInformation(player, NotificationType.NO_PERMISSION, "mcMMO.NoPermission"); @@ -145,18 +147,10 @@ public class SalvageManager extends SkillManager { * @return the current Arcane Salvage rank */ public int getArcaneSalvageRank() { - int skillLevel = getSkillLevel(); - - for (Tier tier : Tier.values()) { - if (skillLevel >= tier.getLevel()) { - return tier.toNumerical(); - } - } - - return 0; + return RankUtils.getRank(getPlayer(), SubSkillType.SALVAGE_ARCANE_SALVAGE); } - public double getExtractFullEnchantChance() { + /*public double getExtractFullEnchantChance() { int skillLevel = getSkillLevel(); for (Tier tier : Tier.values()) { @@ -178,6 +172,14 @@ public class SalvageManager extends SkillManager { } return 0; + }*/ + + public double getExtractFullEnchantChance() { + return AdvancedConfig.getInstance().getArcaneSalvageExtractFullEnchantsChance(getArcaneSalvageRank()); + } + + public double getExtractPartialEnchantChance() { + return AdvancedConfig.getInstance().getArcaneSalvageExtractPartialEnchantsChance(getArcaneSalvageRank()); } private ItemStack arcaneSalvageCheck(Map enchants) { diff --git a/src/main/java/com/gmail/nossr50/skills/smelting/Smelting.java b/src/main/java/com/gmail/nossr50/skills/smelting/Smelting.java index 5df3b92e7..67c8cb5ff 100644 --- a/src/main/java/com/gmail/nossr50/skills/smelting/Smelting.java +++ b/src/main/java/com/gmail/nossr50/skills/smelting/Smelting.java @@ -3,44 +3,23 @@ package com.gmail.nossr50.skills.smelting; import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; +import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.util.skills.RankUtils; +import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; public class Smelting { - // The order of the values is extremely important, a few methods depend on it to work properly - public enum Tier { - EIGHT(8), - SEVEN(7), - SIX(6), - FIVE(5), - FOUR(4), - THREE(3), - TWO(2), - ONE(1); - int numerical; - - Tier(int numerical) { - this.numerical = numerical; - } - - public int toNumerical() { - return numerical; - } - - protected int getLevel() { - return AdvancedConfig.getInstance().getSmeltingRankLevel(this); - } - - protected int getVanillaXPBoostModifier() { - return AdvancedConfig.getInstance().getSmeltingVanillaXPBoostMultiplier(this); - } + public static int getRank(Player player) + { + return RankUtils.getRank(player, SubSkillType.SMELTING_UNDERSTANDING_THE_ART); } public static int burnModifierMaxLevel = AdvancedConfig.getInstance().getBurnModifierMaxLevel(); public static double burnTimeMultiplier = AdvancedConfig.getInstance().getBurnTimeMultiplier(); - public static int fluxMiningUnlockLevel = AdvancedConfig.getInstance().getFluxMiningUnlockLevel(); + public static int fluxMiningUnlockLevel = RankUtils.getUnlockLevel(SubSkillType.SMELTING_FLUX_MINING); public static double fluxMiningChance = AdvancedConfig.getInstance().getFluxMiningChance(); protected static int getResourceXp(ItemStack smelting) { diff --git a/src/main/java/com/gmail/nossr50/skills/smelting/SmeltingManager.java b/src/main/java/com/gmail/nossr50/skills/smelting/SmeltingManager.java index 960937d1e..1e27098a6 100644 --- a/src/main/java/com/gmail/nossr50/skills/smelting/SmeltingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/smelting/SmeltingManager.java @@ -10,12 +10,12 @@ import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.skills.SkillManager; import com.gmail.nossr50.skills.mining.Mining; -import com.gmail.nossr50.skills.smelting.Smelting.Tier; import com.gmail.nossr50.util.BlockUtils; import com.gmail.nossr50.util.EventUtils; import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.skills.ParticleEffectUtils; +import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.SkillActivationType; import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.util.sounds.SoundManager; @@ -75,7 +75,7 @@ public class SmeltingManager extends SkillManager { if (item == null) { return false; } - + if (!EventUtils.simulateBlockBreak(blockState.getBlock(), player, true)) { return false; } @@ -154,14 +154,6 @@ public class SmeltingManager extends SkillManager { * @return the vanilla XP multiplier */ public int getVanillaXpMultiplier() { - int skillLevel = getSkillLevel(); - - for (Tier tier : Tier.values()) { - if (skillLevel >= tier.getLevel()) { - return tier.getVanillaXPBoostModifier(); - } - } - - return 1; + return RankUtils.getRank(getPlayer(), SubSkillType.SMELTING_UNDERSTANDING_THE_ART); } -} +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/skills/taming/Taming.java b/src/main/java/com/gmail/nossr50/skills/taming/Taming.java index 5be513527..6ec4c7b56 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/Taming.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/Taming.java @@ -1,26 +1,28 @@ package com.gmail.nossr50.skills.taming; import com.gmail.nossr50.config.AdvancedConfig; +import com.gmail.nossr50.datatypes.skills.SubSkillType; +import com.gmail.nossr50.util.skills.RankUtils; import org.bukkit.EntityEffect; import org.bukkit.entity.*; public class Taming { public static int environmentallyAwareUnlockLevel = AdvancedConfig.getInstance().getEnviromentallyAwareUnlock(); - public static int holyHoundUnlockLevel = AdvancedConfig.getInstance().getHolyHoundUnlock(); + public static int holyHoundUnlockLevel = RankUtils.getUnlockLevel(SubSkillType.TAMING_HOLY_HOUND); - public static int fastFoodServiceUnlockLevel = AdvancedConfig.getInstance().getFastFoodUnlock(); + public static int fastFoodServiceUnlockLevel = RankUtils.getUnlockLevel(SubSkillType.TAMING_FAST_FOOD_SERVICE); public static double fastFoodServiceActivationChance = AdvancedConfig.getInstance().getFastFoodChance(); public static int goreBleedTicks = AdvancedConfig.getInstance().getGoreBleedTicks(); public static double goreModifier = AdvancedConfig.getInstance().getGoreModifier(); - public static int sharpenedClawsUnlockLevel = AdvancedConfig.getInstance().getSharpenedClawsUnlock(); + public static int sharpenedClawsUnlockLevel = RankUtils.getUnlockLevel(SubSkillType.TAMING_SHARPENED_CLAWS); public static double sharpenedClawsBonusDamage = AdvancedConfig.getInstance().getSharpenedClawsBonus(); - public static int shockProofUnlockLevel = AdvancedConfig.getInstance().getShockProofUnlock(); + public static int shockProofUnlockLevel = RankUtils.getUnlockLevel(SubSkillType.TAMING_SHOCK_PROOF); public static double shockProofModifier = AdvancedConfig.getInstance().getShockProofModifier(); - public static int thickFurUnlockLevel = AdvancedConfig.getInstance().getThickFurUnlock(); + public static int thickFurUnlockLevel = RankUtils.getUnlockLevel(SubSkillType.TAMING_THICK_FUR); public static double thickFurModifier = AdvancedConfig.getInstance().getThickFurModifier(); public static boolean canPreventDamage(Tameable pet, AnimalTamer owner) { @@ -64,4 +66,4 @@ public class Taming { return ""; } } -} +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/util/skills/RankUtils.java b/src/main/java/com/gmail/nossr50/util/skills/RankUtils.java index 35784537a..a142b840d 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/RankUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/RankUtils.java @@ -121,7 +121,7 @@ public class RankUtils { { //Compare against the highest to lowest rank in that order int rank = numRanks-i; - int unlockLevel = getUnlockLevel(subSkillType, rank); + int unlockLevel = getRankUnlockLevel(subSkillType, rank); //If we check all ranks and still cannot unlock the skill, we return rank 0 if(rank == 0) @@ -165,7 +165,7 @@ public class RankUtils { { //Compare against the highest to lowest rank in that order int rank = numRanks-i; - int unlockLevel = getUnlockLevel(abstractSubSkill, rank); + int unlockLevel = getRankUnlockLevel(abstractSubSkill, rank); //If we check all ranks and still cannot unlock the skill, we return rank 0 if(rank == 0) @@ -191,8 +191,8 @@ public class RankUtils { HashMap rankMap = subSkillRanks.get(abstractSubSkill.getConfigKeyName()); //TODO: Remove this debug code - //System.out.println("[DEBUG]: Rank "+rank+" for "+subSkillName.toString()+" requires skill level "+getUnlockLevel(subSkillType, rank)); - rankMap.put(rank, getUnlockLevel(abstractSubSkill, rank)); + //System.out.println("[DEBUG]: Rank "+rank+" for "+subSkillName.toString()+" requires skill level "+getRankUnlockLevel(subSkillType, rank)); + rankMap.put(rank, getRankUnlockLevel(abstractSubSkill, rank)); } @Deprecated @@ -203,8 +203,8 @@ public class RankUtils { HashMap rankMap = subSkillRanks.get(subSkillType.toString()); //TODO: Remove this debug code - //System.out.println("[DEBUG]: Rank "+rank+" for "+subSkillName.toString()+" requires skill level "+getUnlockLevel(subSkillType, rank)); - rankMap.put(rank, getUnlockLevel(subSkillType, rank)); + //System.out.println("[DEBUG]: Rank "+rank+" for "+subSkillName.toString()+" requires skill level "+getRankUnlockLevel(subSkillType, rank)); + rankMap.put(rank, getRankUnlockLevel(subSkillType, rank)); } private static void initMaps(String s) { @@ -239,18 +239,58 @@ public class RankUtils { * @return The level at which this rank unlocks */ @Deprecated - public static int getUnlockLevel(SubSkillType subSkillType, int rank) + public static int getRankUnlockLevel(SubSkillType subSkillType, int rank) { return RankConfig.getInstance().getSubSkillUnlockLevel(subSkillType, rank); } - public static int getUnlockLevel(AbstractSubSkill abstractSubSkill, int rank) + public static int getRankUnlockLevel(AbstractSubSkill abstractSubSkill, int rank) { return RankConfig.getInstance().getSubSkillUnlockLevel(abstractSubSkill, rank); } + /** + * Get the level at which a skill is unlocked for a player (this is the first rank of a skill) + * @param subSkillType target subskill + * @return The unlock requirements for rank 1 in this skill + */ + public static int getUnlockLevel(SubSkillType subSkillType) + { + return RankConfig.getInstance().getSubSkillUnlockLevel(subSkillType, 1); + } + + /** + * Get the level at which a skill is unlocked for a player (this is the first rank of a skill) + * @param abstractSubSkill target subskill + * @return The unlock requirements for rank 1 in this skill + */ + public static int getUnlockLevel(AbstractSubSkill abstractSubSkill) + { + return RankConfig.getInstance().getSubSkillUnlockLevel(abstractSubSkill, 1); + } + + /** + * Get the highest rank of a subskill + * @param subSkillType target subskill + * @return the last rank of a subskill + */ + public static int getHighestRank(SubSkillType subSkillType) + { + return subSkillType.getNumRanks(); + } + + /** + * Get the highest rank of a subskill + * @param abstractSubSkill target subskill + * @return the last rank of a subskill + */ + public static int getHighestRank(AbstractSubSkill abstractSubSkill) + { + return abstractSubSkill.getNumRanks(); + } + public static int getSuperAbilityUnlockRequirement(SuperAbilityType superAbilityType) { - return getUnlockLevel(superAbilityType.getSubSkillTypeDefinition(), 1); + return getRankUnlockLevel(superAbilityType.getSubSkillTypeDefinition(), 1); } -} +} \ No newline at end of file diff --git a/src/main/resources/skillranks.yml b/src/main/resources/skillranks.yml index 98ce9ec9a..adb3ec78e 100644 --- a/src/main/resources/skillranks.yml +++ b/src/main/resources/skillranks.yml @@ -166,6 +166,11 @@ Taming: RetroMode: Rank_1: 750 Smelting: + FluxMining: + Standard: + Rank_1: 25 + Retro: + Rank_1: 250 UnderstandingTheArt: Standard: Rank_1: 10 @@ -273,6 +278,11 @@ Herbalism: Rank_4: 800 Rank_5: 1000 Fishing: + Shake: + Standard: + Rank_1: 50 + RetroMode: + Rank_1: 150 MasterAngler: Standard: Rank_1: 50 @@ -389,6 +399,26 @@ Excavation: RetroMode: Rank_1: 100 TreasureHunter: + Standard: + Rank_1: 10 + Rank_2: 25 + Rank_3: 35 + Rank_4: 50 + Rank_5: 65 + Rank_6: 75 + Rank_7: 85 + Rank_8: 100 + RetroMode: + Rank_1: 100 + Rank_2: 250 + Rank_3: 350 + Rank_4: 500 + Rank_5: 650 + Rank_6: 750 + Rank_7: 850 + Rank_8: 1000 +Repair: + ArcaneForging: Standard: Rank_1: 10 Rank_2: 25