mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
Init and register skill configs to a map to make traversing the root node for a specific skill given the same structure easier
This commit is contained in:
parent
51291f7c49
commit
42a7673ad7
@ -44,6 +44,7 @@ import com.gmail.nossr50.config.treasure.ExcavationTreasureConfig;
|
||||
import com.gmail.nossr50.config.treasure.FishingTreasureConfig;
|
||||
import com.gmail.nossr50.config.treasure.HerbalismTreasureConfig;
|
||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||
@ -112,6 +113,8 @@ public final class ConfigManager {
|
||||
private SerializedConfigLoader<ConfigAdmin> configAdmin;
|
||||
private SerializedConfigLoader<ConfigMobs> configMobs;
|
||||
|
||||
private HashMap<PrimarySkillType, SerializedConfigLoader> skillConfigLoaders;
|
||||
|
||||
private SerializedConfigLoader<ConfigAcrobatics> configAcrobatics;
|
||||
private SerializedConfigLoader<ConfigAlchemy> configAlchemy;
|
||||
private SerializedConfigLoader<ConfigArchery> configArchery;
|
||||
@ -223,20 +226,20 @@ public final class ConfigManager {
|
||||
configAdmin = new SerializedConfigLoader<>(ConfigAdmin.class, "admin.conf", "Admin", null);
|
||||
configMobs = new SerializedConfigLoader<>(ConfigMobs.class, "creatures.conf", "Creatures", null);
|
||||
|
||||
configAcrobatics = new SerializedConfigLoader<>(ConfigAcrobatics.class, "acrobatics.conf", "Acrobatics", null);
|
||||
configSalvage = new SerializedConfigLoader<>(ConfigSalvage.class, "salvage.conf", "Salvage", null);
|
||||
configArchery = new SerializedConfigLoader<>(ConfigArchery.class, "archery.conf", "Archery", null);
|
||||
configAxes = new SerializedConfigLoader<>(ConfigAxes.class, "axes.conf", "Axes", null);
|
||||
configExcavation = new SerializedConfigLoader<>(ConfigExcavation.class, "excavation.conf", "Excavation", null);
|
||||
configFishing = new SerializedConfigLoader<>(ConfigFishing.class, "fishing.conf", "Fishing", null);
|
||||
configHerbalism = new SerializedConfigLoader<>(ConfigHerbalism.class, "herbalism.conf", "Herbalism", null);
|
||||
configMining = new SerializedConfigLoader<>(ConfigMining.class, "mining.conf", "Mining", null);
|
||||
configRepair = new SerializedConfigLoader<>(ConfigRepair.class, "repair.conf", "Repair", null);
|
||||
configSwords = new SerializedConfigLoader<>(ConfigSwords.class, "swords.conf", "Swords", null);
|
||||
configTaming = new SerializedConfigLoader<>(ConfigTaming.class, "taming.conf", "Taming", null);
|
||||
configUnarmed = new SerializedConfigLoader<>(ConfigUnarmed.class, "unarmed.conf", "Unarmed", null);
|
||||
configWoodcutting = new SerializedConfigLoader<>(ConfigWoodcutting.class, "woodcutting.conf", "Woodcutting", null);
|
||||
configSmelting = new SerializedConfigLoader<>(ConfigSmelting.class, "smelting.conf", "Smelting", null);
|
||||
registerSkillConfig(PrimarySkillType.ACROBATICS, ConfigAcrobatics.class);
|
||||
registerSkillConfig(PrimarySkillType.SALVAGE, ConfigSalvage.class);
|
||||
registerSkillConfig(PrimarySkillType.ARCHERY, ConfigArchery.class);
|
||||
registerSkillConfig(PrimarySkillType.AXES, ConfigAxes.class);
|
||||
registerSkillConfig(PrimarySkillType.EXCAVATION, ConfigExcavation.class);
|
||||
registerSkillConfig(PrimarySkillType.FISHING, ConfigFishing.class);
|
||||
registerSkillConfig(PrimarySkillType.HERBALISM, ConfigHerbalism.class);
|
||||
registerSkillConfig(PrimarySkillType.MINING, ConfigMining.class);
|
||||
registerSkillConfig(PrimarySkillType.REPAIR, ConfigRepair.class);
|
||||
registerSkillConfig(PrimarySkillType.SWORDS, ConfigSwords.class);
|
||||
registerSkillConfig(PrimarySkillType.TAMING, ConfigTaming.class);
|
||||
registerSkillConfig(PrimarySkillType.UNARMED, ConfigUnarmed.class);
|
||||
registerSkillConfig(PrimarySkillType.WOODCUTTING, ConfigWoodcutting.class);
|
||||
registerSkillConfig(PrimarySkillType.SMELTING, ConfigSmelting.class);
|
||||
|
||||
//Serialized Data
|
||||
partyData = new SerializedConfigLoader<>(ConfigPartyData.class, "partydata.conf", "PartyData", null);
|
||||
@ -280,6 +283,11 @@ public final class ConfigManager {
|
||||
initCollectionManagers();
|
||||
}
|
||||
|
||||
private void registerSkillConfig(PrimarySkillType primarySkillType, Class clazz)
|
||||
{
|
||||
skillConfigLoaders.put(primarySkillType, SkillConfigFactory.initSkillConfig(primarySkillType, clazz));
|
||||
}
|
||||
|
||||
/**
|
||||
* Misc managers
|
||||
*/
|
||||
|
@ -0,0 +1,16 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import com.gmail.nossr50.config.hocon.SerializedConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public class SkillConfigFactory {
|
||||
|
||||
protected static SerializedConfigLoader initSkillConfig(PrimarySkillType primarySkillType, Class<?> clazz)
|
||||
{
|
||||
return new SerializedConfigLoader<>(clazz,
|
||||
primarySkillType.toString().toLowerCase() + ".conf",
|
||||
StringUtils.getCapitalized(primarySkillType.toString()),
|
||||
null);
|
||||
}
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package com.gmail.nossr50.config.hocon.skills.repair.repairmastery;
|
||||
|
||||
import com.gmail.nossr50.annotation.SkillProperty;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import ninja.leaping.configurate.objectmapping.Setting;
|
||||
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||
|
||||
|
@ -17,7 +17,7 @@ public class RepairMasteryStandard {
|
||||
"\n a player should have based on how far they are from the max bonus level value, and the other parameters used for the scaling of the sub-skill." +
|
||||
"\n-- NOTE: This setting is only valid for standard level scaling. --" +
|
||||
"\nDefault value: "+MAX_BONUS_LEVEL_DEFAULT)
|
||||
private int maxBonusLevel = MAX_BONUS_LEVEL_DEFAULT;
|
||||
public int maxBonusLevel = MAX_BONUS_LEVEL_DEFAULT;
|
||||
|
||||
@Setting(value = "Max-Bonus-Percentage", comment = "This is the maximum benefit for additional repair amount from this skill when the player reaches \"Max-Bonus-Level\"." +
|
||||
"\nRepair Mastery's bonus to repair is dynamically adjusted based on the players level difference from the \"Max-Bonus-Level\", you can think of it as a curve where reaching \"Max-Bonus-Level\" is the peak." +
|
||||
@ -25,13 +25,5 @@ public class RepairMasteryStandard {
|
||||
"\n and the player was level " + PLAYER_LEVEL_FIFTY_PERCENT_EXAMPLE + " for this skill, that would give the player " + BONUS_PERCENTAGE_EXAMPLE + "% added to the repair amount on the item before other bonuses." +
|
||||
"\n-- NOTE: This setting is only valid for standard level scaling. --" +
|
||||
"\nDefault value: "+MAX_BONUS_PERCENTAGE)
|
||||
private double maxBonusPercentage = MAX_BONUS_PERCENTAGE;
|
||||
|
||||
public int getMaxBonusLevel() {
|
||||
return maxBonusLevel;
|
||||
}
|
||||
|
||||
public double getMaxBonusPercentage() {
|
||||
return maxBonusPercentage;
|
||||
}
|
||||
public double maxBonusPercentage = MAX_BONUS_PERCENTAGE;
|
||||
}
|
Loading…
Reference in New Issue
Block a user