mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-15 15:16:06 +01:00
Make 'invincibility-removes-mobs' affect projectile shooting entities.
This commit is contained in:
parent
874e429779
commit
c7ed49388c
@ -27,6 +27,7 @@
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityCombustEvent;
|
||||
@ -74,6 +75,10 @@ public void onEntityDamage(EntityDamageEvent event) {
|
||||
EntityDamageByEntityEvent byEntityEvent = (EntityDamageByEntityEvent) event;
|
||||
Entity attacker = byEntityEvent.getDamager();
|
||||
|
||||
if (attacker instanceof Projectile && ((Projectile) attacker).getShooter() instanceof Entity) {
|
||||
attacker = (Entity) ((Projectile) attacker).getShooter();
|
||||
}
|
||||
|
||||
if (worldConfig.regionInvinciblityRemovesMobs
|
||||
&& attacker instanceof LivingEntity && !(attacker instanceof Player)
|
||||
&& !(attacker instanceof Tameable && ((Tameable) attacker).isTamed())) {
|
||||
|
Loading…
Reference in New Issue
Block a user