mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 16:46:46 +01:00
Made 'shooterless' arrows dodgeable
This commit is contained in:
parent
3e20dc7de6
commit
d51fa92b46
@ -35,6 +35,7 @@ Version 1.3.09
|
|||||||
= Fixed possible NPE when falling with no item in hand
|
= Fixed possible NPE when falling with no item in hand
|
||||||
! API methods can now only be used in a static way
|
! API methods can now only be used in a static way
|
||||||
! Arrows shot from a bow having the Infitity enchantment can no longer be retrieved
|
! Arrows shot from a bow having the Infitity enchantment can no longer be retrieved
|
||||||
|
! Arrows that aren't shot by an entity are now dodgeable (currently only from dispensers)
|
||||||
! Changed Spout settings to be in their own config file (spout.yml)
|
! Changed Spout settings to be in their own config file (spout.yml)
|
||||||
! Changed file format for parties (parties.yml), previous files are no longer used
|
! Changed file format for parties (parties.yml), previous files are no longer used
|
||||||
! Changed mcMMO to inform on corrupt Chunklets and make new ones
|
! Changed mcMMO to inform on corrupt Chunklets and make new ones
|
||||||
|
@ -62,25 +62,19 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Entity attacker = event.getDamager();
|
Entity attacker = event.getDamager();
|
||||||
|
Entity defender = event.getEntity();
|
||||||
|
|
||||||
if (attacker instanceof Projectile) {
|
if (attacker instanceof Projectile) {
|
||||||
attacker = ((Projectile) attacker).getShooter();
|
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) {
|
else if (attacker instanceof Tameable) {
|
||||||
AnimalTamer animalTamer = ((Tameable) attacker).getOwner();
|
AnimalTamer animalTamer = ((Tameable) attacker).getOwner();
|
||||||
|
|
||||||
if (animalTamer instanceof Player) {
|
if (animalTamer instanceof Entity) {
|
||||||
attacker = (Player) animalTamer;
|
attacker = (Entity) animalTamer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity defender = event.getEntity();
|
|
||||||
|
|
||||||
if (attacker instanceof Player && defender instanceof Player) {
|
if (attacker instanceof Player && defender instanceof Player) {
|
||||||
if (PartyManager.getInstance().inSameParty((Player) defender, (Player) attacker)) {
|
if (PartyManager.getInstance().inSameParty((Player) defender, (Player) attacker)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -173,8 +173,8 @@ public class Combat {
|
|||||||
case ARROW:
|
case ARROW:
|
||||||
LivingEntity shooter = ((Arrow) damager).getShooter();
|
LivingEntity shooter = ((Arrow) damager).getShooter();
|
||||||
|
|
||||||
if (shooter.getType() != EntityType.PLAYER) {
|
if (shooter == null || shooter.getType() != EntityType.PLAYER) {
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetIsPlayer || targetIsTamedPet) {
|
if (targetIsPlayer || targetIsTamedPet) {
|
||||||
@ -191,7 +191,7 @@ public class Combat {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetIsPlayer && damager instanceof LivingEntity) {
|
if (targetIsPlayer) {
|
||||||
Player player = (Player) target;
|
Player player = (Player) target;
|
||||||
|
|
||||||
AcrobaticsManager acroManager = new AcrobaticsManager(player);
|
AcrobaticsManager acroManager = new AcrobaticsManager(player);
|
||||||
@ -207,7 +207,7 @@ public class Combat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (configInstance.getSwordsPVE()) {
|
if (configInstance.getSwordsPVE() && damager instanceof LivingEntity) {
|
||||||
swordsManager.counterAttackChecks((LivingEntity) damager, event.getDamage());
|
swordsManager.counterAttackChecks((LivingEntity) damager, event.getDamage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user