diff --git a/Changelog.txt b/Changelog.txt index ed17c13ce..16c26de38 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -148,7 +148,7 @@ Version 2.2.0 Update_Check, Prefer_Beta, Ability_Activation_Level_Gate, Max_Tries_At_Same_Location, Prevent_AFK_Leveling, Items_Pickup_Disabled_Full_Inventory Removed the following config settings for being unwanted - Config_Update_Overwrite, Tool_Mods_Enabled, Armor_Mods_Enabled, Block_Mods_Enabled, Entity_Mods_Enabled + Config_Update_Overwrite, Tool_Mods_Enabled, Armor_Mods_Enabled, Block_Mods_Enabled, Entity_Mods_Enabled, API Changes SimpleRepairable/SimpleSalvageable renamed to just Repairable/Salvageable, and their unnecessary interface classes were removed diff --git a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java index ec4f3e24d..a4f8784ec 100644 --- a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java +++ b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java @@ -178,18 +178,6 @@ public class ExperienceConfig extends ConfigValidated { reason.add(EXPERIENCE + "." + COMBAT + "." + MULTIPLIER + "." + ANIMALS + " should be at least 0!"); } - if (getDodgeXPModifier() < 0) { - reason.add("Skills." + ACROBATICS + "." + DODGE + "_XP_" + MODIFIER + " should be at least 0!"); - } - - if (getRollXPModifier() < 0) { - reason.add("Skills." + ACROBATICS + "." + ROLL + "_XP_" + MODIFIER + " should be at least 0!"); - } - - if (getFallXPModifier() < 0) { - reason.add("Skills." + ACROBATICS + "." + FALL + "_XP_" + MODIFIER + " should be at least 0!"); - } - /* Fishing */ // TODO: Add validation for each fish type once enum is available. @@ -315,11 +303,6 @@ public class ExperienceConfig extends ConfigValidated { * XP SETTINGS */ - /* General Settings */ - public boolean getExperienceGainsPlayerVersusPlayerEnabled() { - return getBooleanValue(EXPERIENCE, PVP, REWARDS); - } - /* Combat XP Multipliers */ public double getCombatXP(EntityType entity) { return getDoubleValue(EXPERIENCE, COMBAT, MULTIPLIER, StringUtils.getEntityConfigName(entity)); @@ -404,23 +387,6 @@ public class ExperienceConfig extends ConfigValidated { return BarStyle.SOLID; } - /* Acrobatics */ - public int getDodgeXPModifier() { - return getIntValue(EXPERIENCE, ACROBATICS, DODGE); - } - - public int getRollXPModifier() { - return getIntValue(EXPERIENCE, ACROBATICS, ROLL); - } - - public int getFallXPModifier() { - return getIntValue(EXPERIENCE, ACROBATICS, FALL); - } - - public double getFeatherFallXPModifier() { - return getDoubleValue(EXPERIENCE, ACROBATICS, FEATHER_FALL_MULTIPLIER); - } - /* Alchemy */ public double getPotionXP(PotionStage stage) { return getDoubleValue(EXPERIENCE, ALCHEMY, POTION_STAGE + stage.toNumerical()); diff --git a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperience.java b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperience.java index 047d4bb85..a91260418 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperience.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperience.java @@ -119,4 +119,28 @@ public class ConfigExperience { public int getFallXP() { return experienceAcrobatics.getFallXP(); } + + public int getStageOnePotionXP() { + return experienceAlchemy.getStageOnePotionXP(); + } + + public int getStageTwoPotionXP() { + return experienceAlchemy.getStageTwoPotionXP(); + } + + public int getStageThreePotionXP() { + return experienceAlchemy.getStageThreePotionXP(); + } + + public int getStageFourPotionXP() { + return experienceAlchemy.getStageFourPotionXP(); + } + + public int getStageFivePotionXP() { + return experienceAlchemy.getStageFivePotionXP(); + } + + public boolean isPvpXPEnabled() { + return experienceCombat.isPvpXPEnabled(); + } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceArchery.java b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceArchery.java index 69c0f3171..ee77a6f96 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceArchery.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceArchery.java @@ -5,4 +5,6 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; @ConfigSerializable public class ConfigExperienceArchery { + + } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceCombat.java b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceCombat.java index 5b9123a68..c029e5c57 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceCombat.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceCombat.java @@ -1,8 +1,20 @@ package com.gmail.nossr50.config.hocon.experience; +import ninja.leaping.configurate.objectmapping.Setting; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; @ConfigSerializable public class ConfigExperienceCombat { + private static final boolean PVP_XP_ENABLED_DEFAULT = false; + + @Setting(value = "PVP-XP", comment = "If true, players will gain XP from PVP interactions." + + "\nBe careful turning this on as this can potentially allow for unwanted behaviour from players." + + "\nDefault value: "+PVP_XP_ENABLED_DEFAULT) + private boolean pvpXPEnabled = PVP_XP_ENABLED_DEFAULT; + + public boolean isPvpXPEnabled() { + return pvpXPEnabled; + } + } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/acrobatics/ConfigAcrobatics.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/acrobatics/ConfigAcrobatics.java index 31b76866e..8f69f633f 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/skills/acrobatics/ConfigAcrobatics.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/acrobatics/ConfigAcrobatics.java @@ -1,5 +1,6 @@ package com.gmail.nossr50.config.hocon.skills.acrobatics; +import com.gmail.nossr50.config.hocon.skills.ConfigSubSkillScalingRNG; import com.gmail.nossr50.config.hocon.skills.acrobatics.dodge.ConfigDodge; import com.gmail.nossr50.config.hocon.skills.acrobatics.roll.ConfigRoll; import ninja.leaping.configurate.objectmapping.Setting; @@ -24,4 +25,11 @@ public class ConfigAcrobatics { return dodge; } + public ConfigSubSkillScalingRNG getRNGSettings() { + return dodge.getRNGSettings(); + } + + public double getDamageReductionDivisor() { + return dodge.getDamageReductionDivisor(); + } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java b/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java index bbd081e1f..07f14da8c 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java @@ -301,10 +301,10 @@ public class Roll extends AcrobaticsSubSkill { private float calculateRollXP(Player player, double damage, boolean isRoll) { ItemStack boots = player.getInventory().getBoots(); - float xp = (float) (damage * (isRoll ? ExperienceConfig.getInstance().getRollXPModifier() : ExperienceConfig.getInstance().getFallXPModifier())); + float xp = (float) (damage * (isRoll ? mcMMO.getConfigManager().getConfigExperience().getRollXP() : mcMMO.getConfigManager().getConfigExperience().getFallXP())); if (boots != null && boots.containsEnchantment(Enchantment.PROTECTION_FALL)) { - xp *= ExperienceConfig.getInstance().getFeatherFallXPModifier(); + xp *= mcMMO.getConfigManager().getConfigExperience().getFeatherFallMultiplier(); } return xp; diff --git a/src/main/java/com/gmail/nossr50/skills/acrobatics/Acrobatics.java b/src/main/java/com/gmail/nossr50/skills/acrobatics/Acrobatics.java index abf16af28..22b413e4e 100644 --- a/src/main/java/com/gmail/nossr50/skills/acrobatics/Acrobatics.java +++ b/src/main/java/com/gmail/nossr50/skills/acrobatics/Acrobatics.java @@ -3,13 +3,18 @@ package com.gmail.nossr50.skills.acrobatics; import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.MainConfig; import com.gmail.nossr50.config.experience.ExperienceConfig; +import com.gmail.nossr50.mcMMO; public final class Acrobatics { - public static double dodgeDamageModifier = AdvancedConfig.getInstance().getDodgeDamageModifier(); - public static int dodgeXpModifier = ExperienceConfig.getInstance().getDodgeXPModifier(); - public static boolean dodgeLightningDisabled = MainConfig.getInstance().getDodgeLightningDisabled(); + public static double dodgeDamageModifier; + public static int dodgeXpModifier; +// public static boolean dodgeLightningDisabled; - private Acrobatics() {} + private Acrobatics() { + dodgeDamageModifier = mcMMO.getConfigManager().getConfigAcrobatics().getDamageReductionDivisor(); + dodgeXpModifier = mcMMO.getConfigManager().getExperienceConfig().getDodgeXPModifier(); +// dodgeLightningDisabled = MainConfig.getInstance().getDodgeLightningDisabled(); + } protected static double calculateModifiedDodgeDamage(double damage, double damageModifier) { return Math.max(damage / damageModifier, 1.0); diff --git a/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java b/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java index 02e96e802..d64945c3b 100644 --- a/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java +++ b/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java @@ -52,9 +52,9 @@ public class AcrobaticsManager extends SkillManager { return false; if (Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.ACROBATICS_DODGE)) { - if (damager instanceof LightningStrike && Acrobatics.dodgeLightningDisabled) { + /*if (damager instanceof LightningStrike && Acrobatics.dodgeLightningDisabled) { return false; - } + }*/ return skill.shouldProcess(damager); } diff --git a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java index 0c51925f5..c2e649507 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java @@ -551,7 +551,7 @@ public final class CombatUtils { XPGainReason xpGainReason; if (target instanceof Player) { - if (!ExperienceConfig.getInstance().getExperienceGainsPlayerVersusPlayerEnabled() || PartyManager.inSameParty(mcMMOPlayer.getPlayer(), (Player) target)) { + if (!mcMMO.getConfigManager().getConfigExperience().isPvpXPEnabled() || PartyManager.inSameParty(mcMMOPlayer.getPlayer(), (Player) target)) { return; }