mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-25 02:04:44 +02:00
Made 'shooterless' arrows dodgeable
This commit is contained in:
@ -62,25 +62,19 @@ public class EntityListener implements Listener {
|
||||
}
|
||||
|
||||
Entity attacker = event.getDamager();
|
||||
Entity defender = event.getEntity();
|
||||
|
||||
if (attacker instanceof Projectile) {
|
||||
attacker = ((Projectile) attacker).getShooter();
|
||||
|
||||
//There is no shooter when a projectile is thrown by a dispenser
|
||||
if (attacker == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (attacker instanceof Tameable) {
|
||||
AnimalTamer animalTamer = ((Tameable) attacker).getOwner();
|
||||
|
||||
if (animalTamer instanceof Player) {
|
||||
attacker = (Player) animalTamer;
|
||||
if (animalTamer instanceof Entity) {
|
||||
attacker = (Entity) animalTamer;
|
||||
}
|
||||
}
|
||||
|
||||
Entity defender = event.getEntity();
|
||||
|
||||
if (attacker instanceof Player && defender instanceof Player) {
|
||||
if (PartyManager.getInstance().inSameParty((Player) defender, (Player) attacker)) {
|
||||
event.setCancelled(true);
|
||||
|
@ -173,8 +173,8 @@ public class Combat {
|
||||
case ARROW:
|
||||
LivingEntity shooter = ((Arrow) damager).getShooter();
|
||||
|
||||
if (shooter.getType() != EntityType.PLAYER) {
|
||||
return;
|
||||
if (shooter == null || shooter.getType() != EntityType.PLAYER) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (targetIsPlayer || targetIsTamedPet) {
|
||||
@ -191,7 +191,7 @@ public class Combat {
|
||||
break;
|
||||
}
|
||||
|
||||
if (targetIsPlayer && damager instanceof LivingEntity) {
|
||||
if (targetIsPlayer) {
|
||||
Player player = (Player) target;
|
||||
|
||||
AcrobaticsManager acroManager = new AcrobaticsManager(player);
|
||||
@ -207,7 +207,7 @@ public class Combat {
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (configInstance.getSwordsPVE()) {
|
||||
if (configInstance.getSwordsPVE() && damager instanceof LivingEntity) {
|
||||
swordsManager.counterAttackChecks((LivingEntity) damager, event.getDamage());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user