From 7b5372a985ffd88cff25b30ff6f33dc28f77df16 Mon Sep 17 00:00:00 2001 From: GJ Date: Wed, 17 Jul 2013 10:29:42 -0400 Subject: [PATCH] Temporary fix for MCPC+ entity issues. This change will be reverted after the fix is made in MCPC+. Fixes #1197 --- .../nossr50/util/skills/CombatUtils.java | 88 +++++++++++++------ 1 file changed, 59 insertions(+), 29 deletions(-) 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 4b0dc21ee..77c747bff 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java @@ -232,49 +232,79 @@ public final class CombatUtils { } } - switch (damager.getType()) { - case WOLF: - Wolf wolf = (Wolf) damager; - AnimalTamer tamer = wolf.getOwner(); + /* Temporary fix for MCPC+ + * + * This will be reverted back to the switch statement once the fix is addressed on their end. + */ - if (tamer == null || !(tamer instanceof Player) || !shouldProcessSkill(target, SkillType.TAMING)) { - break; - } + if (damager.getType() == EntityType.WOLF) { + Wolf wolf = (Wolf) damager; + AnimalTamer tamer = wolf.getOwner(); + if (tamer != null && tamer instanceof Player && shouldProcessSkill(target, SkillType.TAMING)) { Player master = (Player) tamer; - if (Misc.isNPCEntity(master)) { - break; - } - - if (Permissions.skillEnabled(master, SkillType.TAMING)) { + if (!Misc.isNPCEntity(master) && Permissions.skillEnabled(master, SkillType.TAMING)) { processTamingCombat(target, master, wolf, event); } + } + } - break; - - case ARROW: - LivingEntity shooter = ((Arrow) damager).getShooter(); - - if (shooter == null || !(shooter instanceof Player) || !shouldProcessSkill(target, SkillType.ARCHERY)) { - break; - } + if (damager.getType() == EntityType.ARROW) { + LivingEntity shooter = ((Arrow) damager).getShooter(); + if (shooter != null && shooter instanceof Player && shouldProcessSkill(target, SkillType.ARCHERY)) { Player player = (Player) shooter; - if (Misc.isNPCEntity(player)) { - break; - } - - if (Permissions.skillEnabled(player, SkillType.ARCHERY)) { + if (!Misc.isNPCEntity(player) && Permissions.skillEnabled(player, SkillType.ARCHERY)) { processArcheryCombat(target, player, event, damager); } - break; - - default: - break; + } } +// switch (damager.getType()) { +// case WOLF: +// Wolf wolf = (Wolf) damager; +// AnimalTamer tamer = wolf.getOwner(); +// +// if (tamer == null || !(tamer instanceof Player) || !shouldProcessSkill(target, SkillType.TAMING)) { +// break; +// } +// +// Player master = (Player) tamer; +// +// if (Misc.isNPCEntity(master)) { +// break; +// } +// +// if (Permissions.skillEnabled(master, SkillType.TAMING)) { +// processTamingCombat(target, master, wolf, event); +// } +// +// break; +// +// case ARROW: +// LivingEntity shooter = ((Arrow) damager).getShooter(); +// +// if (shooter == null || !(shooter instanceof Player) || !shouldProcessSkill(target, SkillType.ARCHERY)) { +// break; +// } +// +// Player player = (Player) shooter; +// +// if (Misc.isNPCEntity(player)) { +// break; +// } +// +// if (Permissions.skillEnabled(player, SkillType.ARCHERY)) { +// processArcheryCombat(target, player, event, damager); +// } +// break; +// +// default: +// break; +// } + if (target instanceof Player) { if (Misc.isNPCEntity(target)) { return;