Temporary fix for MCPC+ entity issues. This change will be reverted

after the fix is made in MCPC+.

Fixes #1197
This commit is contained in:
GJ 2013-07-17 10:29:42 -04:00
parent 1647ef4fae
commit 7b5372a985

View File

@ -232,48 +232,78 @@ public final class CombatUtils {
} }
} }
switch (damager.getType()) { /* Temporary fix for MCPC+
case WOLF: *
* This will be reverted back to the switch statement once the fix is addressed on their end.
*/
if (damager.getType() == EntityType.WOLF) {
Wolf wolf = (Wolf) damager; Wolf wolf = (Wolf) damager;
AnimalTamer tamer = wolf.getOwner(); AnimalTamer tamer = wolf.getOwner();
if (tamer == null || !(tamer instanceof Player) || !shouldProcessSkill(target, SkillType.TAMING)) { if (tamer != null && tamer instanceof Player && shouldProcessSkill(target, SkillType.TAMING)) {
break;
}
Player master = (Player) tamer; Player master = (Player) tamer;
if (Misc.isNPCEntity(master)) { if (!Misc.isNPCEntity(master) && Permissions.skillEnabled(master, SkillType.TAMING)) {
break;
}
if (Permissions.skillEnabled(master, SkillType.TAMING)) {
processTamingCombat(target, master, wolf, event); processTamingCombat(target, master, wolf, event);
} }
}
}
break; if (damager.getType() == EntityType.ARROW) {
case ARROW:
LivingEntity shooter = ((Arrow) damager).getShooter(); LivingEntity shooter = ((Arrow) damager).getShooter();
if (shooter == null || !(shooter instanceof Player) || !shouldProcessSkill(target, SkillType.ARCHERY)) { if (shooter != null && shooter instanceof Player && shouldProcessSkill(target, SkillType.ARCHERY)) {
break;
}
Player player = (Player) shooter; Player player = (Player) shooter;
if (Misc.isNPCEntity(player)) { if (!Misc.isNPCEntity(player) && Permissions.skillEnabled(player, SkillType.ARCHERY)) {
break;
}
if (Permissions.skillEnabled(player, SkillType.ARCHERY)) {
processArcheryCombat(target, player, event, damager); 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 (target instanceof Player) {
if (Misc.isNPCEntity(target)) { if (Misc.isNPCEntity(target)) {