Add per-skill global multiplier default values

This commit is contained in:
nossr50 2019-04-29 22:09:38 -07:00
parent d0259d73c5
commit 6e173c0d4e
3 changed files with 42 additions and 6 deletions

View File

@ -307,12 +307,10 @@ public final class ConfigManager {
customSerializers = TypeSerializers.getDefaultSerializers().newChild(); customSerializers = TypeSerializers.getDefaultSerializers().newChild();
mcMMO.p.getLogger().info("Registering custom type serializers for Configurate..."); mcMMO.p.getLogger().info("Registering custom type serializers for Configurate...");
customSerializers.registerType(new TypeToken<Material>() { customSerializers.registerType(new TypeToken<PrimarySkillType>() {}, new CustomEnumValueSerializer());
}, new CustomEnumValueSerializer()); customSerializers.registerType(new TypeToken<Material>() {}, new CustomEnumValueSerializer());
customSerializers.registerType(new TypeToken<PartyFeature>() { customSerializers.registerType(new TypeToken<PartyFeature>() {}, new CustomEnumValueSerializer());
}, new CustomEnumValueSerializer()); customSerializers.registerType(new TypeToken<FormulaType>() {}, new CustomEnumValueSerializer());
customSerializers.registerType(new TypeToken<FormulaType>() {
}, new CustomEnumValueSerializer());
customSerializers.registerType(TypeToken.of(Repairable.class), new RepairableSerializer()); customSerializers.registerType(TypeToken.of(Repairable.class), new RepairableSerializer());
customSerializers.registerType(TypeToken.of(Salvageable.class), new SalvageableSerializer()); customSerializers.registerType(TypeToken.of(Salvageable.class), new SalvageableSerializer());
customSerializers.registerType(TypeToken.of(MinecraftMaterialWrapper.class), new MinecraftMaterialWrapperSerializer()); customSerializers.registerType(TypeToken.of(MinecraftMaterialWrapper.class), new MinecraftMaterialWrapperSerializer());

View File

@ -15,6 +15,9 @@ public class ConfigExperience {
"\nDefault value: " + GLOBAL_XP_MULT_DEFAULT) "\nDefault value: " + GLOBAL_XP_MULT_DEFAULT)
private double globalXPMultiplier = GLOBAL_XP_MULT_DEFAULT; private double globalXPMultiplier = GLOBAL_XP_MULT_DEFAULT;
@Setting(value = "Global-Skill-XP-Multipliers", comment = "This multiplier is applied at the very end of an XP calculation specific to its corresponding skill, this value is applied before the global multiplier is applied.")
private ConfigExperienceSkillMultiplier configExperienceSkillMultiplier = new ConfigExperienceSkillMultiplier();
@Setting(value = "Skill-XP-Settings", comment = "XP values and multipliers for each skill") @Setting(value = "Skill-XP-Settings", comment = "XP values and multipliers for each skill")
private ConfigExperienceSkills configExperienceSkills = new ConfigExperienceSkills(); private ConfigExperienceSkills configExperienceSkills = new ConfigExperienceSkills();
@ -22,6 +25,10 @@ public class ConfigExperience {
* BOILER PLATE GETTERS * BOILER PLATE GETTERS
*/ */
public ConfigExperienceSkillMultiplier getConfigExperienceSkillMultiplier() {
return configExperienceSkillMultiplier;
}
public ConfigExperienceAcrobatics getExperienceAcrobatics() { public ConfigExperienceAcrobatics getExperienceAcrobatics() {
return getConfigExperienceSkills().getExperienceAcrobatics(); return getConfigExperienceSkills().getExperienceAcrobatics();
} }

View File

@ -0,0 +1,31 @@
package com.gmail.nossr50.config.hocon.experience;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
import java.util.HashMap;
@ConfigSerializable
public class ConfigExperienceSkillMultiplier {
private static final HashMap<PrimarySkillType, Double> SKILL_GLOBAL_MULT_DEFAULT;
static {
SKILL_GLOBAL_MULT_DEFAULT = new HashMap<>();
for(PrimarySkillType primarySkillType : PrimarySkillType.values())
{
if(primarySkillType.isChildSkill())
continue;
SKILL_GLOBAL_MULT_DEFAULT.put(primarySkillType,1.0D);
}
}
@Setting(value = "Skill-XP-Multipliers")
private HashMap<PrimarySkillType, Double> perSkillGlobalMultiplier = SKILL_GLOBAL_MULT_DEFAULT;
public double getSkillGlobalMultiplier(PrimarySkillType primarySkillType) {
return perSkillGlobalMultiplier.get(primarySkillType);
}
}