fix for arrow damage not being properly detected and prevented (when needed) which was broken by Bukkit's recent deprecation of EntityDamageByProjectileEvent
This commit is contained in:
parent
c89db2c4d6
commit
b5a1151178
@ -8,9 +8,9 @@ import org.bukkit.entity.Creeper;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Fireball;
|
import org.bukkit.entity.Fireball;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Projectile;
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityDeathEvent;
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
@ -81,11 +81,6 @@ public class FactionsEntityListener extends EntityListener {
|
|||||||
if ( ! this.canDamagerHurtDamagee(sub)) {
|
if ( ! this.canDamagerHurtDamagee(sub)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else if (event instanceof EntityDamageByProjectileEvent) {
|
|
||||||
EntityDamageByProjectileEvent sub = (EntityDamageByProjectileEvent)event;
|
|
||||||
if ( ! this.canDamagerHurtDamagee(sub)) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
} else if (Conf.safeZonePreventAllDamageToPlayers && isPlayerInSafeZone(event.getEntity())) {
|
} else if (Conf.safeZonePreventAllDamageToPlayers && isPlayerInSafeZone(event.getEntity())) {
|
||||||
// Players can not take any damage in a Safe Zone
|
// Players can not take any damage in a Safe Zone
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -167,7 +162,12 @@ public class FactionsEntityListener extends EntityListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Faction defLocFaction = Board.getFactionAt(new FLocation(defenderLoc));
|
Faction defLocFaction = Board.getFactionAt(new FLocation(defenderLoc));
|
||||||
|
|
||||||
|
// for damage caused by projectiles, getDamager() returns the projectile... what we need to know is the source
|
||||||
|
if (damager instanceof Projectile) {
|
||||||
|
damager = ((Projectile)damager).getShooter();
|
||||||
|
}
|
||||||
|
|
||||||
// Players can not take attack damage in a SafeZone, or possibly peaceful territory
|
// Players can not take attack damage in a SafeZone, or possibly peaceful territory
|
||||||
if (defLocFaction.noPvPInTerritory()) {
|
if (defLocFaction.noPvPInTerritory()) {
|
||||||
if (damager instanceof Player) {
|
if (damager instanceof Player) {
|
||||||
|
Loading…
Reference in New Issue
Block a user