mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
xp config pt 3 + example fully qualified name map serializer
This commit is contained in:
parent
a2279a58a5
commit
4394ac7049
@ -24,6 +24,7 @@ Version 2.2.0
|
||||
All config nodes will now use Capital letters at the start of each nodes name and after each hyphen (-)
|
||||
All config nodes now include a comment with the default value of the node to use as reference
|
||||
Expanded settings relating to purging users who have not leveled or users who had not logged in for many months
|
||||
Acrobatic's Dodge XP increased from 120 -> 480
|
||||
NOTE: Not every config key that was renamed will be listed here
|
||||
Admins will now be notified if a player trips over-fishing exploit detection 3+ times in a row (Locale: "Fishing.OverFishingDetected")
|
||||
Note: Admins are players who are op or have adminchat permission.
|
||||
|
@ -1,16 +1,14 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.config.hocon.CustomEnumValueSerializer;
|
||||
import com.gmail.nossr50.config.hocon.RepairableSerializer;
|
||||
import com.gmail.nossr50.config.hocon.SalvageableSerializer;
|
||||
import com.gmail.nossr50.config.hocon.SerializedConfigLoader;
|
||||
import com.gmail.nossr50.config.hocon.*;
|
||||
import com.gmail.nossr50.config.hocon.admin.ConfigAdmin;
|
||||
import com.gmail.nossr50.config.hocon.antiexploit.ConfigExploitPrevention;
|
||||
import com.gmail.nossr50.config.hocon.backup.ConfigAutomatedBackups;
|
||||
import com.gmail.nossr50.config.hocon.commands.ConfigCommands;
|
||||
import com.gmail.nossr50.config.hocon.database.ConfigDatabase;
|
||||
import com.gmail.nossr50.config.hocon.donation.ConfigAuthorAdvertisements;
|
||||
import com.gmail.nossr50.config.hocon.experience.ConfigExperience;
|
||||
import com.gmail.nossr50.config.hocon.hardcore.ConfigHardcore;
|
||||
import com.gmail.nossr50.config.hocon.items.ConfigItems;
|
||||
import com.gmail.nossr50.config.hocon.language.ConfigLanguage;
|
||||
@ -27,6 +25,7 @@ import com.gmail.nossr50.config.hocon.skills.acrobatics.ConfigAcrobatics;
|
||||
import com.gmail.nossr50.config.hocon.skills.alchemy.ConfigAlchemy;
|
||||
import com.gmail.nossr50.config.hocon.skills.archery.ConfigArchery;
|
||||
import com.gmail.nossr50.config.hocon.skills.axes.ConfigAxes;
|
||||
import com.gmail.nossr50.config.hocon.skills.exampleconfigs.MinecraftMaterialWrapper;
|
||||
import com.gmail.nossr50.config.hocon.skills.excavation.ConfigExcavation;
|
||||
import com.gmail.nossr50.config.hocon.skills.fishing.ConfigFishing;
|
||||
import com.gmail.nossr50.config.hocon.skills.herbalism.ConfigHerbalism;
|
||||
@ -113,6 +112,7 @@ public final class ConfigManager {
|
||||
private SerializedConfigLoader<ConfigSuperAbilities> configSuperAbilities;
|
||||
private SerializedConfigLoader<ConfigAdmin> configAdmin;
|
||||
private SerializedConfigLoader<ConfigMobs> configMobs;
|
||||
private SerializedConfigLoader<ConfigExperience> configExperience;
|
||||
|
||||
private SerializedConfigLoader<ConfigAcrobatics> configAcrobatics;
|
||||
private SerializedConfigLoader<ConfigAlchemy> configAlchemy;
|
||||
@ -223,6 +223,7 @@ public final class ConfigManager {
|
||||
configSuperAbilities = new SerializedConfigLoader<>(ConfigSuperAbilities.class, "skill_super_abilities.conf", "Super-Abilities", null);
|
||||
configAdmin = new SerializedConfigLoader<>(ConfigAdmin.class, "admin.conf", "Admin", null);
|
||||
configMobs = new SerializedConfigLoader<>(ConfigMobs.class, "creatures.conf", "Creatures", null);
|
||||
configExperience = new SerializedConfigLoader<>(ConfigExperience.class, "experience.conf", "Experience", null);
|
||||
|
||||
initSerializedSkillConfigs();
|
||||
}
|
||||
@ -306,6 +307,7 @@ public final class ConfigManager {
|
||||
TypeSerializers.getDefaultSerializers().registerType(new TypeToken<PartyFeature>() {}, new CustomEnumValueSerializer());
|
||||
TypeSerializers.getDefaultSerializers().registerType(TypeToken.of(Repairable.class), new RepairableSerializer());
|
||||
TypeSerializers.getDefaultSerializers().registerType(TypeToken.of(Salvageable.class), new SalvageableSerializer());
|
||||
TypeSerializers.getDefaultSerializers().registerType(TypeToken.of(MinecraftMaterialWrapper.class), new MinecraftMaterialWrapperSerializer());
|
||||
}
|
||||
|
||||
private void registerSkillConfig(PrimarySkillType primarySkillType, Class clazz)
|
||||
@ -656,4 +658,8 @@ public final class ConfigManager {
|
||||
{
|
||||
return skillPropertiesManager.getMaxChance(subSkillType);
|
||||
}
|
||||
|
||||
public ConfigExperience getConfigExperience() {
|
||||
return configExperience.getConfig();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,26 @@
|
||||
package com.gmail.nossr50.config.hocon;
|
||||
|
||||
import com.gmail.nossr50.config.hocon.skills.exampleconfigs.MinecraftMaterialWrapper;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import ninja.leaping.configurate.ConfigurationNode;
|
||||
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
|
||||
import ninja.leaping.configurate.objectmapping.serialize.TypeSerializer;
|
||||
import org.bukkit.Material;
|
||||
|
||||
public class MinecraftMaterialWrapperSerializer implements TypeSerializer<MinecraftMaterialWrapper> {
|
||||
|
||||
@Override
|
||||
public MinecraftMaterialWrapper deserialize(TypeToken<?> type, ConfigurationNode value) throws ObjectMappingException {
|
||||
Material material = Material.matchMaterial(value.getValue(new TypeToken<String>() {}));
|
||||
|
||||
return new MinecraftMaterialWrapper(material);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(TypeToken<?> type, MinecraftMaterialWrapper obj, ConfigurationNode value) {
|
||||
|
||||
value.setValue(obj.getName()); //Name
|
||||
value.getNode("Fully-Qualified-Name").setValue(obj.getFullyQualifiedName());
|
||||
value.getNode("Bukkit-Material-Name").setValue(obj.getBukkitMaterialName());
|
||||
}
|
||||
}
|
@ -7,40 +7,40 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||
public class ConfigExperience {
|
||||
|
||||
@Setting(value = "Acrobatics", comment = "XP Settings for Acrobatics")
|
||||
ConfigExperienceAcrobatics experienceAcrobatics = new ConfigExperienceAcrobatics();
|
||||
private ConfigExperienceAcrobatics experienceAcrobatics = new ConfigExperienceAcrobatics();
|
||||
|
||||
@Setting(value = "Alchemy", comment = "XP Settings for Alchemy")
|
||||
ConfigExperienceAlchemy experienceAlchemy = new ConfigExperienceAlchemy();
|
||||
private ConfigExperienceAlchemy experienceAlchemy = new ConfigExperienceAlchemy();
|
||||
|
||||
@Setting(value = "Archery", comment = "XP Settings for Archery")
|
||||
ConfigExperienceArchery experienceArchery = new ConfigExperienceArchery();
|
||||
private ConfigExperienceArchery experienceArchery = new ConfigExperienceArchery();
|
||||
|
||||
@Setting(value = "Fishing", comment = "XP Settings for Fishing")
|
||||
ConfigExperienceFishing experienceFishing = new ConfigExperienceFishing();
|
||||
private ConfigExperienceFishing experienceFishing = new ConfigExperienceFishing();
|
||||
|
||||
@Setting(value = "Excavation", comment = "XP Settings for Excavation")
|
||||
ConfigExperienceExcavation experienceExcavation = new ConfigExperienceExcavation();
|
||||
private ConfigExperienceExcavation experienceExcavation = new ConfigExperienceExcavation();
|
||||
|
||||
@Setting(value = "Woodcutting", comment = "XP Settings for Woodcutting")
|
||||
ConfigExperienceWoodcutting experienceWoodcutting = new ConfigExperienceWoodcutting();
|
||||
private ConfigExperienceWoodcutting experienceWoodcutting = new ConfigExperienceWoodcutting();
|
||||
|
||||
@Setting(value = "Herbalism", comment = "XP Settings for Herbalism")
|
||||
ConfigExperienceHerbalism experienceHerbalism = new ConfigExperienceHerbalism();
|
||||
private ConfigExperienceHerbalism experienceHerbalism = new ConfigExperienceHerbalism();
|
||||
|
||||
@Setting(value = "Mining", comment = "XP Settings for Mining")
|
||||
ConfigExperienceMining experienceMining = new ConfigExperienceMining();
|
||||
private ConfigExperienceMining experienceMining = new ConfigExperienceMining();
|
||||
|
||||
@Setting(value = "Repair", comment = "XP Settings for Repair")
|
||||
ConfigExperienceRepair experienceRepair = new ConfigExperienceRepair();
|
||||
private ConfigExperienceRepair experienceRepair = new ConfigExperienceRepair();
|
||||
|
||||
@Setting(value = "Smelting", comment = "XP Settings for Smelting")
|
||||
ConfigExperienceSmelting experienceSmelting = new ConfigExperienceSmelting();
|
||||
private ConfigExperienceSmelting experienceSmelting = new ConfigExperienceSmelting();
|
||||
|
||||
@Setting(value = "Taming", comment = "XP Settings for Taming")
|
||||
ConfigExperienceTaming experienceTaming = new ConfigExperienceTaming();
|
||||
private ConfigExperienceTaming experienceTaming = new ConfigExperienceTaming();
|
||||
|
||||
@Setting(value = "Z-Combat", comment = "XP Settings for Combat")
|
||||
ConfigExperienceCombat experienceCombat = new ConfigExperienceCombat();
|
||||
private ConfigExperienceCombat experienceCombat = new ConfigExperienceCombat();
|
||||
|
||||
public ConfigExperienceAcrobatics getExperienceAcrobatics() {
|
||||
return experienceAcrobatics;
|
||||
|
@ -9,13 +9,24 @@ import java.util.HashMap;
|
||||
public class ConfigExperienceAcrobatics {
|
||||
|
||||
private final static HashMap<String, Integer> ACROBATICS_DEFAULT_XP_MAP;
|
||||
public static final double FEATHER_FALL_MULTIPLIER_DEFAULT = 2.0D;
|
||||
|
||||
static {
|
||||
ACROBATICS_DEFAULT_XP_MAP = new HashMap<>();
|
||||
|
||||
ACROBATICS_DEFAULT_XP_MAP.put("Dodge", 480);
|
||||
ACROBATICS_DEFAULT_XP_MAP.put("Roll", 80);
|
||||
ACROBATICS_DEFAULT_XP_MAP.put("Fall", 120);
|
||||
}
|
||||
|
||||
@Setting(value = "Acrobatics-Experience-Values", comment = "Experience values for Acrobatics.")
|
||||
HashMap<String, Integer> acrobaticsXPMap;
|
||||
HashMap<String, Integer> acrobaticsXPMap = ACROBATICS_DEFAULT_XP_MAP;
|
||||
|
||||
@Setting(value = "Feather-Fall-XP-Multiplier", comment = "Feather Fall grants bonus XP to fall related XP gains." +
|
||||
"\nThis value is multiplied against your XP to give the bonus." +
|
||||
"\nDefault value: "+FEATHER_FALL_MULTIPLIER_DEFAULT)
|
||||
private Double featherFallMultiplier = FEATHER_FALL_MULTIPLIER_DEFAULT;
|
||||
|
||||
public HashMap<String, Integer> getAcrobaticsXPMap() {
|
||||
return acrobaticsXPMap;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.gmail.nossr50.config.hocon.experience;
|
||||
|
||||
import ninja.leaping.configurate.objectmapping.Setting;
|
||||
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@ConfigSerializable
|
||||
public class ConfigExperienceAlchemy {
|
||||
|
||||
private final static HashMap<String, Integer> ALCHEMY_DEFAULT_XP_MAP;
|
||||
|
||||
static {
|
||||
ALCHEMY_DEFAULT_XP_MAP = new HashMap<>();
|
||||
ALCHEMY_DEFAULT_XP_MAP.put("Simple_Potions", 15);
|
||||
ALCHEMY_DEFAULT_XP_MAP.put("Potion_One_Ingredient", 30);
|
||||
ALCHEMY_DEFAULT_XP_MAP.put("Potion_One_Ingredient_One_Amplifier", 60);
|
||||
ALCHEMY_DEFAULT_XP_MAP.put("Potion_One_Ingredient_Two_Amplifier", 120);
|
||||
ALCHEMY_DEFAULT_XP_MAP.put("Potion_One_Ingredient_Swapped_Amplifiers", 240);
|
||||
}
|
||||
|
||||
@Setting(value = "Alchemy-Experience-Values", comment = "Experience values for alchemy.")
|
||||
HashMap<String, Integer>alchemyXPMap = ALCHEMY_DEFAULT_XP_MAP;
|
||||
|
||||
|
||||
public HashMap<String, Integer> getAlchemyXPMap() {
|
||||
return alchemyXPMap;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.gmail.nossr50.config.hocon.skills.exampleconfigs;
|
||||
|
||||
import ninja.leaping.configurate.objectmapping.Setting;
|
||||
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* This class is used to generate a table that can be referenced to compare Bukkit Material names
|
||||
* to full qualified names used in internal registers for Minecraft
|
||||
*/
|
||||
@ConfigSerializable
|
||||
public class ConfigNameRegisterDefaults {
|
||||
|
||||
private static final ArrayList<MinecraftMaterialWrapper> BUKKIT_MATERIAL_NAME_LOOKUP_EXAMPLE;
|
||||
|
||||
static {
|
||||
BUKKIT_MATERIAL_NAME_LOOKUP_EXAMPLE = new ArrayList<>();
|
||||
for(Material m : Material.values())
|
||||
{
|
||||
BUKKIT_MATERIAL_NAME_LOOKUP_EXAMPLE.add(new MinecraftMaterialWrapper((m)));
|
||||
}
|
||||
}
|
||||
|
||||
@Setting(value = "Default-Name-Registers", comment = "These are the names mcMMO will recognize for Items " +
|
||||
"used internally by Minecraft.")
|
||||
private ArrayList<MinecraftMaterialWrapper> defaultMaterialNameRegisters = BUKKIT_MATERIAL_NAME_LOOKUP_EXAMPLE;
|
||||
|
||||
public ArrayList<MinecraftMaterialWrapper> getDefaultMaterialNameRegisters() {
|
||||
return defaultMaterialNameRegisters;
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.gmail.nossr50.config.hocon.skills.exampleconfigs;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
public class MinecraftMaterialWrapper {
|
||||
private String name;
|
||||
private String fullyQualifiedName;
|
||||
private String bukkitMaterialName;
|
||||
|
||||
public MinecraftMaterialWrapper(Material material)
|
||||
{
|
||||
this.name = material.getKey().getKey();
|
||||
this.fullyQualifiedName = material.getKey().toString();
|
||||
this.bukkitMaterialName = material.toString();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getFullyQualifiedName() {
|
||||
return fullyQualifiedName;
|
||||
}
|
||||
|
||||
public String getBukkitMaterialName() {
|
||||
return bukkitMaterialName;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.gmail.nossr50.util.skills;
|
||||
package com.gmail.nossr50.skills.alchemy;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.potion.PotionData;
|
||||
@ -12,7 +12,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class PotionConfigGenerator {
|
||||
public class PotionGenerator {
|
||||
|
||||
public static class Ingredient {
|
||||
|
Loading…
Reference in New Issue
Block a user