diff --git a/src/main/java/com/gmail/nossr50/config/hocon/CustomXPPerkSerializer.java b/src/main/java/com/gmail/nossr50/config/hocon/CustomXPPerkSerializer.java index 52080317b..be1fe1aa3 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/CustomXPPerkSerializer.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/CustomXPPerkSerializer.java @@ -4,6 +4,7 @@ import com.gmail.nossr50.api.exceptions.InvalidSkillException; import com.gmail.nossr50.datatypes.experience.CustomXPPerk; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.util.StringUtils; import com.google.common.reflect.TypeResolver; import com.google.common.reflect.TypeToken; import ninja.leaping.configurate.ConfigurationNode; @@ -25,6 +26,9 @@ public class CustomXPPerkSerializer implements TypeSerializer { { try { PrimarySkillType primarySkillType = matchIgnoreCase(configurationNode.getValue(TypeToken.of(String.class))); + if(primarySkillType.isChildSkill()) + continue; //Child skills gross + float boostValue = configurationNode.getNode("XP-Multiplier").getValue(TypeToken.of(Float.class)); customXPPerk.setCustomXPValue(primarySkillType, boostValue); } catch (InvalidSkillException e) { @@ -40,7 +44,21 @@ public class CustomXPPerkSerializer implements TypeSerializer { @Override public void serialize(@NonNull TypeToken type, @Nullable CustomXPPerk obj, @NonNull ConfigurationNode value) throws ObjectMappingException { + String name = obj.getPerkName(); + value.getNode("name").setValue(name); + + for(PrimarySkillType primarySkillType : PrimarySkillType.values()) + { + float xpMultValue = obj.getXPMultiplierValue(primarySkillType); + + //Ignore default values + if(xpMultValue == 1.0F) + continue; + + //Set value + value.getNode("name").getNode(StringUtils.getCapitalized(primarySkillType.toString())).setValue(xpMultValue); + } } private PrimarySkillType matchIgnoreCase(String string) throws InvalidSkillException diff --git a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java index 547117a79..0c74e0683 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java +++ b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java @@ -777,15 +777,8 @@ public class McMMOPlayer { xp = (float) (xp / primarySkillType.getXpModifier() * mcMMO.getConfigManager().getExperienceMapManager().getGlobalXpMult()); - /*if (MainConfig.getInstance().getToolModsEnabled()) { - CustomTool tool = mcMMO.getModManager().getTool(player.getInventory().getItemInMainHand()); - - if (tool != null) { - xp *= tool.getXpMultiplier(); - } - }*/ - - return xp * mcMMO.getPlayerLevelUtils().getPlayersPersonalXPRate(this, primarySkillType); + //Multiply by the players personal XP rate + return xp * personalXPModifiers.get(primarySkillType); } public void checkGodMode() { diff --git a/src/main/java/com/gmail/nossr50/util/Motd.java b/src/main/java/com/gmail/nossr50/util/Motd.java index 1d861069f..83111b617 100644 --- a/src/main/java/com/gmail/nossr50/util/Motd.java +++ b/src/main/java/com/gmail/nossr50/util/Motd.java @@ -86,10 +86,10 @@ public final class Motd { */ public static void displayXpPerks(Player player) { for (PrimarySkillType skill : PrimarySkillType.values()) { - if (PerksUtils.handleXpPerks(player, 1, skill) > 1) { - player.sendMessage(PERK_PREFIX + LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Perks.XP.Name"), LocaleLoader.getString("Perks.XP.Desc"))); - return; - } +// if (PerksUtils.handleXpPerks(player, 1, skill) > 1) { +// player.sendMessage(PERK_PREFIX + LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Perks.XP.Name"), LocaleLoader.getString("Perks.XP.Desc"))); +// return; +// } } }