mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
Wire up smelting XP values
This commit is contained in:
parent
d1298c0cd2
commit
2b0931314a
@ -10,7 +10,6 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.boss.BarColor;
|
||||
import org.bukkit.boss.BarStyle;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.gmail.nossr50.config.hocon.playerleveling;
|
||||
|
||||
import com.gmail.nossr50.api.exceptions.InvalidSkillException;
|
||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.gmail.nossr50.datatypes.experience;
|
||||
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
|
||||
|
@ -3,7 +3,6 @@ package com.gmail.nossr50;
|
||||
import com.gmail.nossr50.config.ConfigManager;
|
||||
import com.gmail.nossr50.config.CoreSkillsConfig;
|
||||
import com.gmail.nossr50.config.MainConfig;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.config.hocon.database.ConfigSectionCleaning;
|
||||
import com.gmail.nossr50.config.hocon.database.ConfigSectionMySQL;
|
||||
import com.gmail.nossr50.config.hocon.party.ConfigSectionPartyExperienceSharing;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.gmail.nossr50.runnables.database;
|
||||
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.database.DatabaseManager;
|
||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
|
@ -1,8 +1,7 @@
|
||||
package com.gmail.nossr50.skills.smelting;
|
||||
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -14,7 +13,6 @@ public class Smelting {
|
||||
}
|
||||
|
||||
protected static int getResourceXp(ItemStack smelting) {
|
||||
//return mcMMO.getModManager().isCustomOre(smelting.getType()) ? mcMMO.getModManager().getBlock(smelting.getType()).getSmeltingXpGain() : ExperienceConfig.getInstance().getXp(PrimarySkillType.SMELTING, smelting.getType());
|
||||
return ExperienceConfig.getInstance().getXp(PrimarySkillType.SMELTING, smelting.getType());
|
||||
return mcMMO.getDynamicSettingsManager().getExperienceManager().getFurnaceItemXP(smelting.getType());
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ public class ExperienceManager {
|
||||
private HashMap<String, Integer> herbalismFullyQualifiedBlockXpMap;
|
||||
private HashMap<String, Integer> woodcuttingFullyQualifiedBlockXpMap;
|
||||
private HashMap<String, Integer> excavationFullyQualifiedBlockXpMap;
|
||||
private HashMap<String, Integer> furnaceFullyQualifiedItemXpMap;
|
||||
private HashMap<EntityType, Float> tamingExperienceMap;
|
||||
private HashMap<EntityType, Float> combatXPMultiplierMap;
|
||||
private HashMap<SpecialXPKey, Float> specialCombatXPMultiplierMap; //Applies to "groups" of things for convenience
|
||||
@ -36,6 +37,7 @@ public class ExperienceManager {
|
||||
herbalismFullyQualifiedBlockXpMap = new HashMap<>();
|
||||
woodcuttingFullyQualifiedBlockXpMap = new HashMap<>();
|
||||
excavationFullyQualifiedBlockXpMap = new HashMap<>();
|
||||
furnaceFullyQualifiedItemXpMap = new HashMap<>();
|
||||
combatXPMultiplierMap = new HashMap<>();
|
||||
specialCombatXPMultiplierMap = new HashMap<>();
|
||||
tamingExperienceMap = new HashMap<>();
|
||||
@ -44,7 +46,9 @@ public class ExperienceManager {
|
||||
private void registerDefaultValues()
|
||||
{
|
||||
fillCombatXPMultiplierMap(mcMMO.getConfigManager().getConfigExperience().getCombatExperienceMap());
|
||||
registerSpecialCombatXPMultiplierMap(mcMMO.getConfigManager().getConfigExperience().getSpecialCombatExperienceMap());
|
||||
buildBlockXPMaps();
|
||||
buildFurnaceXPMap();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -78,12 +82,21 @@ public class ExperienceManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void copySpecialCombatXPMultiplierMap(HashMap<SpecialXPKey, Float> map)
|
||||
/**
|
||||
* Registers the map values for special combat XP to the specified map
|
||||
* @param map target map
|
||||
*/
|
||||
public void registerSpecialCombatXPMultiplierMap(HashMap<SpecialXPKey, Float> map)
|
||||
{
|
||||
mcMMO.p.getLogger().info("Registering special combat XP values...");
|
||||
specialCombatXPMultiplierMap = map;
|
||||
}
|
||||
|
||||
private void buildFurnaceXPMap() {
|
||||
mcMMO.p.getLogger().info("Mapping xp values for furnaces...");
|
||||
fillBlockXPMap(mcMMO.getConfigManager().getConfigExperience().getSmeltingExperienceMap(), furnaceFullyQualifiedItemXpMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds fully qualified name to xp value maps of blocks for XP lookups
|
||||
* This method servers two purposes
|
||||
@ -347,6 +360,16 @@ public class ExperienceManager {
|
||||
return excavationFullyQualifiedBlockXpMap.get(material.getKey());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the XP value for converting an item in the furnace
|
||||
*
|
||||
* @param material the target item material value
|
||||
* @return the raw XP value before any modifiers are applied
|
||||
*/
|
||||
public int getFurnaceItemXP(Material material) {
|
||||
return furnaceFullyQualifiedItemXpMap.get(material.getKey());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the XP multiplier value for a special XP group
|
||||
* @param specialXPKey target special XP group
|
||||
|
Loading…
Reference in New Issue
Block a user