From 6c5fb5f398ca3865cfad38db4a342f4e20e9ca29 Mon Sep 17 00:00:00 2001 From: t00thpick1 Date: Sun, 4 Dec 2016 20:53:51 -0500 Subject: [PATCH] Fix entity kill xp --- .../config/experience/ExperienceConfig.java | 3 +- .../nossr50/util/skills/CombatUtils.java | 36 ++++++++----------- 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java index 0062d7b7f..1787e91a1 100644 --- a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java +++ b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java @@ -207,9 +207,8 @@ public class ExperienceConfig extends AutoUpdateConfigLoader { /* Combat XP Multipliers */ public double getCombatXP(EntityType entity) { return config.getDouble("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); } + public double getAnimalsXP(EntityType entity) { return config.getDouble("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_"), getAnimalsXP()); } public double getAnimalsXP() { return config.getDouble("Experience.Combat.Multiplier.Animals", 1.0); } - public double getWitherSkeletonXP() { return config.getDouble("Experience.Combat.Multiplier.Wither_Skeleton", 4.0); } - public double getElderGuardianXP() { return config.getDouble("Experience.Combat.Multiplier.Elder_Guardian", 4.0); } /* Materials */ public int getXp(SkillType skill, Material material) { return config.getInt("Experience." + StringUtils.getCapitalized(skill.toString()) + "." + StringUtils.getPrettyItemString(material).replace(" ", "_")); } diff --git a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java index 92d19fb29..55cc06f6d 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java @@ -13,6 +13,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.Guardian; import org.bukkit.entity.IronGolem; import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Monster; import org.bukkit.entity.Player; import org.bukkit.entity.Skeleton; import org.bukkit.entity.Tameable; @@ -458,7 +459,13 @@ public final class CombatUtils { baseXP = mcMMO.getModManager().getEntity(target).getXpMultiplier(); } else if (target instanceof Animals) { - baseXP = ExperienceConfig.getInstance().getAnimalsXP(); + ntityType type = target.getType(); + baseXP = ExperienceConfig.getInstance().getAnimalsXP(type); + } + else if (target instanceof Monster) + { + EntityType type = target.getType(); + baseXP = ExperienceConfig.getInstance().getCombatXP(type); } else { EntityType type = target.getType(); @@ -467,7 +474,7 @@ public final class CombatUtils { case BAT: case SQUID: case RABBIT: - baseXP = ExperienceConfig.getInstance().getAnimalsXP(); + baseXP = ExperienceConfig.getInstance().getAnimalsXP(type); break; case BLAZE: @@ -486,20 +493,15 @@ public final class CombatUtils { case SPIDER: case WITCH: case WITHER: + case ZOMBIE_VILLAGER: case ZOMBIE: + case GUARDIAN: + case ELDER_GUARDIAN: + case HUSK: + case STRAY: + case WITHER_SKELETON: baseXP = ExperienceConfig.getInstance().getCombatXP(type); - - break; - case SKELETON: - switch (((Skeleton) target).getSkeletonType()) { - case WITHER: - baseXP = ExperienceConfig.getInstance().getWitherSkeletonXP(); - break; - default: - baseXP = ExperienceConfig.getInstance().getCombatXP(type); - break; - } break; case IRON_GOLEM: @@ -508,14 +510,6 @@ public final class CombatUtils { } break; - case GUARDIAN: - if (((Guardian) target).isElder()) { - baseXP = ExperienceConfig.getInstance().getElderGuardianXP(); - } else { - baseXP = ExperienceConfig.getInstance().getCombatXP(type); - } - break; - default: baseXP = 1.0; mcMMO.getModManager().addCustomEntity(target);