Setup combat XP map - Use float in more places

This commit is contained in:
nossr50 2019-05-12 03:46:23 -07:00
parent 1c6b0363ce
commit 3123f69aec
8 changed files with 164 additions and 114 deletions

View File

@ -142,7 +142,6 @@ public final class ConfigManager {
//YAML CONFIGS //YAML CONFIGS
private MainConfig mainConfig; private MainConfig mainConfig;
private FishingTreasureConfig fishingTreasureConfig; private FishingTreasureConfig fishingTreasureConfig;
private ExcavationTreasureConfig excavationTreasureConfig; private ExcavationTreasureConfig excavationTreasureConfig;
@ -332,6 +331,7 @@ public final class ConfigManager {
//Set the global XP val //Set the global XP val
experienceMapManager.setGlobalXpMult(getConfigExperience().getGlobalXPMultiplier()); experienceMapManager.setGlobalXpMult(getConfigExperience().getGlobalXPMultiplier());
experienceMapManager.buildBlockXPMaps(); //Block XP value maps experienceMapManager.buildBlockXPMaps(); //Block XP value maps
experienceMapManager.fillCombatXPMultiplierMap(getConfigExperience().getCombatExperienceMap());
// potionManager = new PotionManager(); // potionManager = new PotionManager();
} }

View File

@ -10,12 +10,12 @@ import java.util.HashMap;
@ConfigSerializable @ConfigSerializable
public class ConfigExperience { public class ConfigExperience {
private static final double GLOBAL_XP_MULT_DEFAULT = 1.0D; private static final float GLOBAL_XP_MULT_DEFAULT = 1.0F;
@Setting(value = "Global-XP-Multiplier", comment = "This multiplier is applied at the very end of every XP gain, you can use it as a shortcut to increase or decrease xp gains across the entire plugin" + @Setting(value = "Global-XP-Multiplier", comment = "This multiplier is applied at the very end of every XP gain, you can use it as a shortcut to increase or decrease xp gains across the entire plugin" +
"\nThis value is temporarily overridden by xprate events." + "\nThis value is temporarily overridden by xprate events." +
"\nDefault value: " + GLOBAL_XP_MULT_DEFAULT) "\nDefault value: " + GLOBAL_XP_MULT_DEFAULT)
private double globalXPMultiplier = GLOBAL_XP_MULT_DEFAULT; private float 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.") @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(); private ConfigExperienceSkillMultiplier configExperienceSkillMultiplier = new ConfigExperienceSkillMultiplier();
@ -102,11 +102,11 @@ public class ConfigExperience {
return getConfigExperienceSkills().getSmeltingExperienceMap(); return getConfigExperienceSkills().getSmeltingExperienceMap();
} }
public HashMap<String, Double> getItemMaterialXPMultiplier() { public HashMap<String, Float> getItemMaterialXPMultiplier() {
return getConfigExperienceSkills().getItemMaterialXPMultiplier(); return getConfigExperienceSkills().getItemMaterialXPMultiplier();
} }
public double getRepairXPBase() { public Float getRepairXPBase() {
return getConfigExperienceSkills().getRepairXPBase(); return getConfigExperienceSkills().getRepairXPBase();
} }
@ -114,7 +114,7 @@ public class ConfigExperience {
return getConfigExperienceSkills().getAcrobaticsXPMap(); return getConfigExperienceSkills().getAcrobaticsXPMap();
} }
public Double getFeatherFallMultiplier() { public Float getFeatherFallMultiplier() {
return getConfigExperienceSkills().getFeatherFallMultiplier(); return getConfigExperienceSkills().getFeatherFallMultiplier();
} }
@ -158,11 +158,15 @@ public class ConfigExperience {
return getConfigExperienceSkills().isPvpXPEnabled(); return getConfigExperienceSkills().isPvpXPEnabled();
} }
public HashMap<String, Double> getCombatExperienceMap() { public HashMap<String, Float> getCombatExperienceMap() {
return getConfigExperienceSkills().getCombatExperienceMap(); return getConfigExperienceSkills().getCombatExperienceMap();
} }
public double getDistanceMultiplier() { public HashMap<String, Float> getSpecialCombatExperienceMap() {
return configExperienceSkills.getSpecialCombatExperienceMap();
}
public Float getDistanceMultiplier() {
return getConfigExperienceSkills().getDistanceMultiplier(); return getConfigExperienceSkills().getDistanceMultiplier();
} }
@ -186,19 +190,19 @@ public class ConfigExperience {
return getConfigExperienceSkills().getShakeXP(); return getConfigExperienceSkills().getShakeXP();
} }
public double getSpawnedMobXPMult() { public Float getSpawnedMobXPMult() {
return getConfigExperienceSkills().getSpawnedMobXPMult(); return getConfigExperienceSkills().getSpawnedMobXPMult();
} }
public double getPlayerBredMobsXPMult() { public Float getPlayerBredMobsXPMult() {
return getExperienceCombat().getPlayerBredMobsXPMult(); return getExperienceCombat().getPlayerBredMobsXPMult();
} }
public double getPVPXPMult() { public Float getPVPXPMult() {
return getConfigExperienceSkills().getPVPXPMult(); return getConfigExperienceSkills().getPVPXPMult();
} }
public double getAnimalsXPMult() { public Float getAnimalsXPMult() {
return getConfigExperienceSkills().getAnimalsXPMult(); return getConfigExperienceSkills().getAnimalsXPMult();
} }
@ -206,7 +210,7 @@ public class ConfigExperience {
return configExperienceSkills; return configExperienceSkills;
} }
public double getGlobalXPMultiplier() { public Float getGlobalXPMultiplier() {
return globalXPMultiplier; return globalXPMultiplier;
} }
} }

View File

@ -9,7 +9,7 @@ import java.util.HashMap;
public class ConfigExperienceAcrobatics { public class ConfigExperienceAcrobatics {
private final static HashMap<String, Integer> ACROBATICS_DEFAULT_XP_MAP; private final static HashMap<String, Integer> ACROBATICS_DEFAULT_XP_MAP;
private static final double FEATHER_FALL_MULTIPLIER_DEFAULT = 2.0D; private static final float FEATHER_FALL_MULTIPLIER_DEFAULT = 2.0F;
static { static {
ACROBATICS_DEFAULT_XP_MAP = new HashMap<>(); ACROBATICS_DEFAULT_XP_MAP = new HashMap<>();
@ -24,13 +24,13 @@ public class ConfigExperienceAcrobatics {
@Setting(value = "Feather-Fall-XP-Multiplier", comment = "Feather Fall grants bonus XP to fall related XP gains." + @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." + "\nThis value is multiplied against your XP to give the bonus." +
"\nDefault value: " + FEATHER_FALL_MULTIPLIER_DEFAULT) "\nDefault value: " + FEATHER_FALL_MULTIPLIER_DEFAULT)
private Double featherFallMultiplier = FEATHER_FALL_MULTIPLIER_DEFAULT; private Float featherFallMultiplier = FEATHER_FALL_MULTIPLIER_DEFAULT;
public HashMap<String, Integer> getAcrobaticsXPMap() { public HashMap<String, Integer> getAcrobaticsXPMap() {
return acrobaticsXPMap; return acrobaticsXPMap;
} }
public Double getFeatherFallMultiplier() { public Float getFeatherFallMultiplier() {
return featherFallMultiplier; return featherFallMultiplier;
} }

View File

@ -6,7 +6,7 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable @ConfigSerializable
public class ConfigExperienceArchery { public class ConfigExperienceArchery {
public static final double DISTANCE_MULTIPLIER_DEFAULT = 0.025D; public static final float DISTANCE_MULTIPLIER_DEFAULT = 0.025F;
@Setting(value = "Distance-Multiplier", comment = "The distance multiplier is multiplied against the distance an " + @Setting(value = "Distance-Multiplier", comment = "The distance multiplier is multiplied against the distance an " +
"arrow travels before hitting its target to determine final XP values awarded." + "arrow travels before hitting its target to determine final XP values awarded." +
@ -14,9 +14,9 @@ public class ConfigExperienceArchery {
"\nDistance is in blocks traveled." + "\nDistance is in blocks traveled." +
"\nThis value is added on to normal XP gains from damage for Archery." + "\nThis value is added on to normal XP gains from damage for Archery." +
"\nDefault value: " + DISTANCE_MULTIPLIER_DEFAULT) "\nDefault value: " + DISTANCE_MULTIPLIER_DEFAULT)
private double distanceMultiplier = DISTANCE_MULTIPLIER_DEFAULT; private float distanceMultiplier = DISTANCE_MULTIPLIER_DEFAULT;
public double getDistanceMultiplier() { public float getDistanceMultiplier() {
return distanceMultiplier; return distanceMultiplier;
} }
} }

View File

@ -8,84 +8,84 @@ import java.util.HashMap;
@ConfigSerializable @ConfigSerializable
public class ConfigExperienceCombat { public class ConfigExperienceCombat {
private static final HashMap<String, Double> COMBAT_EXPERIENCE_DEFAULT; private static final HashMap<String, Float> COMBAT_EXPERIENCE_DEFAULT;
private static final HashMap<String, Double> SPECIAL_COMBAT_EXPERIENCE_DEFAULT; private static final HashMap<String, Float> SPECIAL_COMBAT_EXPERIENCE_DEFAULT;
private static final boolean PVP_XP_ENABLED_DEFAULT = false; private static final boolean PVP_XP_ENABLED_DEFAULT = false;
static { static {
COMBAT_EXPERIENCE_DEFAULT = new HashMap<>(); COMBAT_EXPERIENCE_DEFAULT = new HashMap<>();
COMBAT_EXPERIENCE_DEFAULT.put("creeper", 4.0D); COMBAT_EXPERIENCE_DEFAULT.put("creeper", 4.0F);
COMBAT_EXPERIENCE_DEFAULT.put("cat", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("cat", 1.0F);
COMBAT_EXPERIENCE_DEFAULT.put("fox", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("fox", 1.0F);
COMBAT_EXPERIENCE_DEFAULT.put("panda", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("panda", 1.0F);
COMBAT_EXPERIENCE_DEFAULT.put("pillager", 2.0D); COMBAT_EXPERIENCE_DEFAULT.put("pillager", 2.0F);
COMBAT_EXPERIENCE_DEFAULT.put("ravager", 4.0D); COMBAT_EXPERIENCE_DEFAULT.put("ravager", 4.0F);
COMBAT_EXPERIENCE_DEFAULT.put("trader_llama", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("trader_llama", 1.0F);
COMBAT_EXPERIENCE_DEFAULT.put("skeleton", 3.0D); COMBAT_EXPERIENCE_DEFAULT.put("skeleton", 3.0F);
COMBAT_EXPERIENCE_DEFAULT.put("spider", 2.0D); COMBAT_EXPERIENCE_DEFAULT.put("spider", 2.0F);
COMBAT_EXPERIENCE_DEFAULT.put("giant", 4.0D); COMBAT_EXPERIENCE_DEFAULT.put("giant", 4.0F);
COMBAT_EXPERIENCE_DEFAULT.put("zombie", 2.0D); COMBAT_EXPERIENCE_DEFAULT.put("zombie", 2.0F);
COMBAT_EXPERIENCE_DEFAULT.put("slime", 2.0D); COMBAT_EXPERIENCE_DEFAULT.put("slime", 2.0F);
COMBAT_EXPERIENCE_DEFAULT.put("ghast", 3.0D); COMBAT_EXPERIENCE_DEFAULT.put("ghast", 3.0F);
COMBAT_EXPERIENCE_DEFAULT.put("pig_zombie", 3.0D); COMBAT_EXPERIENCE_DEFAULT.put("pig_zombie", 3.0F);
COMBAT_EXPERIENCE_DEFAULT.put("enderman", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("enderman", 1.0F);
COMBAT_EXPERIENCE_DEFAULT.put("cave_spider", 3.0D); COMBAT_EXPERIENCE_DEFAULT.put("cave_spider", 3.0F);
COMBAT_EXPERIENCE_DEFAULT.put("silverfish", 3.0D); COMBAT_EXPERIENCE_DEFAULT.put("silverfish", 3.0F);
COMBAT_EXPERIENCE_DEFAULT.put("blaze", 3.0D); COMBAT_EXPERIENCE_DEFAULT.put("blaze", 3.0F);
COMBAT_EXPERIENCE_DEFAULT.put("magma_cube", 2.0D); COMBAT_EXPERIENCE_DEFAULT.put("magma_cube", 2.0F);
COMBAT_EXPERIENCE_DEFAULT.put("ender_dragon", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("ender_dragon", 1.0F);
COMBAT_EXPERIENCE_DEFAULT.put("wither", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("wither", 1.0F);
COMBAT_EXPERIENCE_DEFAULT.put("witch", 0.1D); COMBAT_EXPERIENCE_DEFAULT.put("witch", 0.1F);
COMBAT_EXPERIENCE_DEFAULT.put("iron_golem", 2.0D); COMBAT_EXPERIENCE_DEFAULT.put("iron_golem", 2.0F);
COMBAT_EXPERIENCE_DEFAULT.put("wither_skeleton", 4.0D); COMBAT_EXPERIENCE_DEFAULT.put("wither_skeleton", 4.0F);
COMBAT_EXPERIENCE_DEFAULT.put("endermite", 2.0D); COMBAT_EXPERIENCE_DEFAULT.put("endermite", 2.0F);
COMBAT_EXPERIENCE_DEFAULT.put("guardian", 3.0D); COMBAT_EXPERIENCE_DEFAULT.put("guardian", 3.0F);
COMBAT_EXPERIENCE_DEFAULT.put("elder_guardian", 4.0D); COMBAT_EXPERIENCE_DEFAULT.put("elder_guardian", 4.0F);
COMBAT_EXPERIENCE_DEFAULT.put("shulker", 2.0D); COMBAT_EXPERIENCE_DEFAULT.put("shulker", 2.0F);
COMBAT_EXPERIENCE_DEFAULT.put("donkey", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("donkey", 1.0F);
COMBAT_EXPERIENCE_DEFAULT.put("mule", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("mule", 1.0F);
COMBAT_EXPERIENCE_DEFAULT.put("horse", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("horse", 1.0F);
COMBAT_EXPERIENCE_DEFAULT.put("zombie_villager", 2.0D); COMBAT_EXPERIENCE_DEFAULT.put("zombie_villager", 2.0F);
COMBAT_EXPERIENCE_DEFAULT.put("skeleton_horse", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("skeleton_horse", 1.0F);
COMBAT_EXPERIENCE_DEFAULT.put("zombie_horse", 1.2D); COMBAT_EXPERIENCE_DEFAULT.put("zombie_horse", 1.2F);
COMBAT_EXPERIENCE_DEFAULT.put("husk", 3.0D); COMBAT_EXPERIENCE_DEFAULT.put("husk", 3.0F);
COMBAT_EXPERIENCE_DEFAULT.put("evoker", 3.0D); COMBAT_EXPERIENCE_DEFAULT.put("evoker", 3.0F);
COMBAT_EXPERIENCE_DEFAULT.put("polar_bear", 2.0D); COMBAT_EXPERIENCE_DEFAULT.put("polar_bear", 2.0F);
COMBAT_EXPERIENCE_DEFAULT.put("llama", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("llama", 1.0F);
COMBAT_EXPERIENCE_DEFAULT.put("vindicator", 3.0D); COMBAT_EXPERIENCE_DEFAULT.put("vindicator", 3.0F);
COMBAT_EXPERIENCE_DEFAULT.put("stray", 2.0D); COMBAT_EXPERIENCE_DEFAULT.put("stray", 2.0F);
COMBAT_EXPERIENCE_DEFAULT.put("rabbit", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("rabbit", 1.0F);
COMBAT_EXPERIENCE_DEFAULT.put("chicken", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("chicken", 1.0F);
COMBAT_EXPERIENCE_DEFAULT.put("bat", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("bat", 1.0F);
COMBAT_EXPERIENCE_DEFAULT.put("mushroom_cow", 1.2D); COMBAT_EXPERIENCE_DEFAULT.put("mushroom_cow", 1.2F);
COMBAT_EXPERIENCE_DEFAULT.put("cow", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("cow", 1.0F);
COMBAT_EXPERIENCE_DEFAULT.put("turtle", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("turtle", 1.0F);
COMBAT_EXPERIENCE_DEFAULT.put("sheep", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("sheep", 1.0F);
COMBAT_EXPERIENCE_DEFAULT.put("pig", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("pig", 1.0F);
COMBAT_EXPERIENCE_DEFAULT.put("squid", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("squid", 1.0F);
COMBAT_EXPERIENCE_DEFAULT.put("ocelot", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("ocelot", 1.0F);
COMBAT_EXPERIENCE_DEFAULT.put("villager", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("villager", 1.0F);
COMBAT_EXPERIENCE_DEFAULT.put("snowman", 0.0D); COMBAT_EXPERIENCE_DEFAULT.put("snowman", 0.0F);
COMBAT_EXPERIENCE_DEFAULT.put("parrot", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("parrot", 1.0F);
COMBAT_EXPERIENCE_DEFAULT.put("illusioner", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("illusioner", 1.0F);
COMBAT_EXPERIENCE_DEFAULT.put("drowned", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("drowned", 1.0F);
COMBAT_EXPERIENCE_DEFAULT.put("dolphin", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("dolphin", 1.0F);
COMBAT_EXPERIENCE_DEFAULT.put("phantom", 4.0D); COMBAT_EXPERIENCE_DEFAULT.put("phantom", 4.0F);
//SPECIAL //SPECIAL
SPECIAL_COMBAT_EXPERIENCE_DEFAULT = new HashMap<>(); SPECIAL_COMBAT_EXPERIENCE_DEFAULT = new HashMap<>();
SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put("animals", 1.0D); //TODO: this seems like a dumb config option SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put("animals", 1.0F); //TODO: this seems like a dumb config option
SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put("spawned", 0.0D); SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put("spawned", 0.0F);
SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put("pvp", 1.0D); SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put("pvp", 1.0F);
SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put("player-bred-mobs", 1.0D); SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put("player-bred-mobs", 1.0F);
} }
@Setting(value = "Combat-XP-Multipliers") @Setting(value = "Combat-XP-Multipliers")
private HashMap<String, Double> combatExperienceMap = COMBAT_EXPERIENCE_DEFAULT; private HashMap<String, Float> combatExperienceMap = COMBAT_EXPERIENCE_DEFAULT;
@Setting(value = "Special-Combat-XP-Multipliers") @Setting(value = "Special-Combat-XP-Multipliers")
private HashMap<String, Double> specialCombatExperienceMap = SPECIAL_COMBAT_EXPERIENCE_DEFAULT; private HashMap<String, Float> specialCombatExperienceMap = SPECIAL_COMBAT_EXPERIENCE_DEFAULT;
@Setting(value = "PVP-XP", comment = "If true, players will gain XP from PVP interactions." + @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." + "\nBe careful turning this on as this can potentially allow for unwanted behaviour from players." +
@ -96,23 +96,27 @@ public class ConfigExperienceCombat {
return pvpXPEnabled; return pvpXPEnabled;
} }
public HashMap<String, Double> getCombatExperienceMap() { public HashMap<String, Float> getCombatExperienceMap() {
return combatExperienceMap; return combatExperienceMap;
} }
public double getSpawnedMobXPMult() { public float getSpawnedMobXPMult() {
return specialCombatExperienceMap.get("mobspawners"); return specialCombatExperienceMap.get("mobspawners");
} }
public double getPVPXPMult() { public float getPVPXPMult() {
return specialCombatExperienceMap.get("pvp"); return specialCombatExperienceMap.get("pvp");
} }
public double getAnimalsXPMult() { public float getAnimalsXPMult() {
return specialCombatExperienceMap.get("animals"); return specialCombatExperienceMap.get("animals");
} }
public double getPlayerBredMobsXPMult() { public float getPlayerBredMobsXPMult() {
return specialCombatExperienceMap.get("player-bred-mobs"); return specialCombatExperienceMap.get("player-bred-mobs");
} }
public HashMap<String, Float> getSpecialCombatExperienceMap() {
return specialCombatExperienceMap;
}
} }

View File

@ -9,26 +9,26 @@ import java.util.HashMap;
@ConfigSerializable @ConfigSerializable
public class ConfigExperienceRepair { public class ConfigExperienceRepair {
private static final double REPAIR_XP_BASE_DEFAULT = 1000.0D; private static final float REPAIR_XP_BASE_DEFAULT = 1000.0F;
private static final HashMap<String, Double> ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT; private static final HashMap<String, Float> ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT;
static { static {
ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT = new HashMap<>(); ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT = new HashMap<>();
ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.WOOD.toString(), 0.6D); ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.WOOD.toString(), 0.6F);
ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.STONE.toString(), 1.3D); ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.STONE.toString(), 1.3F);
ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.IRON.toString(), 2.5D); ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.IRON.toString(), 2.5F);
ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.GOLD.toString(), 0.3D); ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.GOLD.toString(), 0.3F);
ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.DIAMOND.toString(), 5.0D); ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.DIAMOND.toString(), 5.0F);
ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.LEATHER.toString(), 1.6D); ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.LEATHER.toString(), 1.6F);
ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.STRING.toString(), 1.8D); ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.STRING.toString(), 1.8F);
ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.OTHER.toString(), 1.5D); ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT.put(ItemMaterialCategory.OTHER.toString(), 1.5F);
} }
@Setting(value = "Item-Material-Category-XP-Multiplier", comment = "The material of your item is determined by mcMMO and used to influence XP, " + @Setting(value = "Item-Material-Category-XP-Multiplier", comment = "The material of your item is determined by mcMMO and used to influence XP, " +
"if your Item doesn't fit into a known category it will use OTHER." + "if your Item doesn't fit into a known category it will use OTHER." +
"\nFor the most part, items belong to categories of materials that they are made out of.") "\nFor the most part, items belong to categories of materials that they are made out of.")
private HashMap<String, Double> itemMaterialXPMultiplier = ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT; private HashMap<String, Float> itemMaterialXPMultiplier = ITEM_MATERIAL_XP_MULTIPLIER_DEFAULT;
@Setting(value = "Repair-XP-Base", comment = "The base amount of XP for repairing an item." + @Setting(value = "Repair-XP-Base", comment = "The base amount of XP for repairing an item." +
"\nThe repair XP formula is a simple multiplication of these 4 values in this order" + "\nThe repair XP formula is a simple multiplication of these 4 values in this order" +
@ -37,13 +37,13 @@ public class ConfigExperienceRepair {
"\nThe Base Repair XP defined here (default 1000.0)" + "\nThe Base Repair XP defined here (default 1000.0)" +
"\nAnd finally, the XP multiplier of the item material category defined in this config." + "\nAnd finally, the XP multiplier of the item material category defined in this config." +
"\nDefault value: " + REPAIR_XP_BASE_DEFAULT) "\nDefault value: " + REPAIR_XP_BASE_DEFAULT)
private double repairXPBase = REPAIR_XP_BASE_DEFAULT; private Float repairXPBase = REPAIR_XP_BASE_DEFAULT;
public HashMap<String, Double> getItemMaterialXPMultiplier() { public HashMap<String, Float> getItemMaterialXPMultiplier() {
return itemMaterialXPMultiplier; return itemMaterialXPMultiplier;
} }
public double getRepairXPBase() { public Float getRepairXPBase() {
return repairXPBase; return repairXPBase;
} }
} }

View File

@ -47,7 +47,7 @@ public class ConfigExperienceSkills {
* BOILER PLATE GETTERS * BOILER PLATE GETTERS
*/ */
public double getPlayerBredMobsXPMult() { public Float getPlayerBredMobsXPMult() {
return experienceCombat.getPlayerBredMobsXPMult(); return experienceCombat.getPlayerBredMobsXPMult();
} }
@ -111,11 +111,11 @@ public class ConfigExperienceSkills {
return experienceSmelting.getSmeltingExperienceMap(); return experienceSmelting.getSmeltingExperienceMap();
} }
public HashMap<String, Double> getItemMaterialXPMultiplier() { public HashMap<String, Float> getItemMaterialXPMultiplier() {
return experienceRepair.getItemMaterialXPMultiplier(); return experienceRepair.getItemMaterialXPMultiplier();
} }
public double getRepairXPBase() { public Float getRepairXPBase() {
return experienceRepair.getRepairXPBase(); return experienceRepair.getRepairXPBase();
} }
@ -123,7 +123,7 @@ public class ConfigExperienceSkills {
return experienceAcrobatics.getAcrobaticsXPMap(); return experienceAcrobatics.getAcrobaticsXPMap();
} }
public Double getFeatherFallMultiplier() { public Float getFeatherFallMultiplier() {
return experienceAcrobatics.getFeatherFallMultiplier(); return experienceAcrobatics.getFeatherFallMultiplier();
} }
@ -167,11 +167,15 @@ public class ConfigExperienceSkills {
return experienceCombat.isPvpXPEnabled(); return experienceCombat.isPvpXPEnabled();
} }
public HashMap<String, Double> getCombatExperienceMap() { public HashMap<String, Float> getCombatExperienceMap() {
return experienceCombat.getCombatExperienceMap(); return experienceCombat.getCombatExperienceMap();
} }
public double getDistanceMultiplier() { public HashMap<String, Float> getSpecialCombatExperienceMap() {
return experienceCombat.getSpecialCombatExperienceMap();
}
public Float getDistanceMultiplier() {
return experienceArchery.getDistanceMultiplier(); return experienceArchery.getDistanceMultiplier();
} }
@ -195,15 +199,15 @@ public class ConfigExperienceSkills {
return experienceFishing.getShakeXP(); return experienceFishing.getShakeXP();
} }
public double getSpawnedMobXPMult() { public Float getSpawnedMobXPMult() {
return experienceCombat.getSpawnedMobXPMult(); return experienceCombat.getSpawnedMobXPMult();
} }
public double getPVPXPMult() { public Float getPVPXPMult() {
return experienceCombat.getPVPXPMult(); return experienceCombat.getPVPXPMult();
} }
public double getAnimalsXPMult() { public Float getAnimalsXPMult() {
return experienceCombat.getAnimalsXPMult(); return experienceCombat.getAnimalsXPMult();
} }
} }

View File

@ -19,18 +19,56 @@ public class ExperienceMapManager implements Unload {
private HashMap<String, Integer> woodcuttingFullyQualifiedBlockXpMap; private HashMap<String, Integer> woodcuttingFullyQualifiedBlockXpMap;
private HashMap<String, Integer> excavationFullyQualifiedBlockXpMap; private HashMap<String, Integer> excavationFullyQualifiedBlockXpMap;
private HashMap<EntityType, Float> tamingExperienceMap; private HashMap<EntityType, Float> tamingExperienceMap;
private HashMap<EntityType, Float> combatXPMultiplierMap;
private HashMap<EntityType, Float> specialCombatXPMultiplierMap; //Applies to "groups" of things for convenience
private double globalXpMult; private double globalXpMult;
public ExperienceMapManager() { public ExperienceMapManager() {
initExperienceMaps();
//Register with unloader
mcMMO.getConfigManager().registerUnloadable(this);
}
private void initExperienceMaps() {
miningFullyQualifiedBlockXpMap = new HashMap<>(); miningFullyQualifiedBlockXpMap = new HashMap<>();
herbalismFullyQualifiedBlockXpMap = new HashMap<>(); herbalismFullyQualifiedBlockXpMap = new HashMap<>();
woodcuttingFullyQualifiedBlockXpMap = new HashMap<>(); woodcuttingFullyQualifiedBlockXpMap = new HashMap<>();
excavationFullyQualifiedBlockXpMap = new HashMap<>(); excavationFullyQualifiedBlockXpMap = new HashMap<>();
combatXPMultiplierMap = new HashMap<>();
specialCombatXPMultiplierMap = new HashMap<>();
tamingExperienceMap = new HashMap<>(); tamingExperienceMap = new HashMap<>();
}
//Register with unloader /**
mcMMO.getConfigManager().registerUnloadable(this); * Fills the combat XP multiplier map with values from a platform generic map
* Platform safe map, is just a map which uses strings to define target entities/etc
* Platform safe maps are converted to ENUMs for the platform for convenience
* @param platformSafeMap the platform safe map
*/
public void fillCombatXPMultiplierMap(HashMap<String, Float> platformSafeMap) {
for(String entityString : platformSafeMap.keySet())
{
//Iterate over all EntityType(s)
for(EntityType type : EntityType.values())
{
//Match ignoring case
if(entityString.equalsIgnoreCase(entityString))
{
//Check for duplicates and warn the admin
if(combatXPMultiplierMap.containsKey(entityString))
{
mcMMO.p.getLogger().severe("Entity named "+entityString+" has multiple values in the combat experience config!");
}
//Match found
combatXPMultiplierMap.put(type, platformSafeMap.get(entityString));
} else {
//Log an error so the admin can deal with figuring it out
mcMMO.p.getLogger().severe("No entity could be matched for the combat experience config value named - "+entityString);
}
}
}
} }
/** /**