Fix entity kill xp

This commit is contained in:
t00thpick1 2016-12-04 20:53:51 -05:00
parent 4b20db47b2
commit 6c5fb5f398
2 changed files with 16 additions and 23 deletions

View File

@ -207,9 +207,8 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
/* Combat XP Multipliers */ /* Combat XP Multipliers */
public double getCombatXP(EntityType entity) { return config.getDouble("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); } 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 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 */ /* Materials */
public int getXp(SkillType skill, Material material) { return config.getInt("Experience." + StringUtils.getCapitalized(skill.toString()) + "." + StringUtils.getPrettyItemString(material).replace(" ", "_")); } public int getXp(SkillType skill, Material material) { return config.getInt("Experience." + StringUtils.getCapitalized(skill.toString()) + "." + StringUtils.getPrettyItemString(material).replace(" ", "_")); }

View File

@ -13,6 +13,7 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.Guardian; import org.bukkit.entity.Guardian;
import org.bukkit.entity.IronGolem; import org.bukkit.entity.IronGolem;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton; import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Tameable; import org.bukkit.entity.Tameable;
@ -458,7 +459,13 @@ public final class CombatUtils {
baseXP = mcMMO.getModManager().getEntity(target).getXpMultiplier(); baseXP = mcMMO.getModManager().getEntity(target).getXpMultiplier();
} }
else if (target instanceof Animals) { 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 { else {
EntityType type = target.getType(); EntityType type = target.getType();
@ -467,7 +474,7 @@ public final class CombatUtils {
case BAT: case BAT:
case SQUID: case SQUID:
case RABBIT: case RABBIT:
baseXP = ExperienceConfig.getInstance().getAnimalsXP(); baseXP = ExperienceConfig.getInstance().getAnimalsXP(type);
break; break;
case BLAZE: case BLAZE:
@ -486,20 +493,15 @@ public final class CombatUtils {
case SPIDER: case SPIDER:
case WITCH: case WITCH:
case WITHER: case WITHER:
case ZOMBIE_VILLAGER:
case ZOMBIE: case ZOMBIE:
case GUARDIAN:
case ELDER_GUARDIAN:
case HUSK:
case STRAY:
case WITHER_SKELETON:
baseXP = ExperienceConfig.getInstance().getCombatXP(type); 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; break;
case IRON_GOLEM: case IRON_GOLEM:
@ -508,14 +510,6 @@ public final class CombatUtils {
} }
break; break;
case GUARDIAN:
if (((Guardian) target).isElder()) {
baseXP = ExperienceConfig.getInstance().getElderGuardianXP();
} else {
baseXP = ExperienceConfig.getInstance().getCombatXP(type);
}
break;
default: default:
baseXP = 1.0; baseXP = 1.0;
mcMMO.getModManager().addCustomEntity(target); mcMMO.getModManager().addCustomEntity(target);