mirror of
https://github.com/bloodmc/GriefDefender.git
synced 2024-11-25 12:45:48 +01:00
Ignore entity damage caused by suffocation.
This can only occur when an entity is stuck in a wall so it should always be allowed to happen.
This commit is contained in:
parent
cb69fab753
commit
8f4d761c76
@ -68,6 +68,7 @@
|
||||
import org.spongepowered.api.event.cause.Cause;
|
||||
import org.spongepowered.api.event.cause.EventContext;
|
||||
import org.spongepowered.api.event.cause.EventContextKeys;
|
||||
import org.spongepowered.api.event.cause.entity.damage.DamageTypes;
|
||||
import org.spongepowered.api.event.cause.entity.damage.source.DamageSource;
|
||||
import org.spongepowered.api.event.cause.entity.damage.source.EntityDamageSource;
|
||||
import org.spongepowered.api.event.cause.entity.damage.source.IndirectEntityDamageSource;
|
||||
@ -417,6 +418,10 @@ public void onEntityDamage(DamageEntityEvent event, @First DamageSource damageSo
|
||||
}
|
||||
|
||||
public boolean protectEntity(Event event, Entity targetEntity, Cause cause, DamageSource damageSource) {
|
||||
if (damageSource.getType() == DamageTypes.SUFFOCATE) {
|
||||
// Ignore as this can only happen if an entity is stuck in wall
|
||||
return false;
|
||||
}
|
||||
if (!GDFlags.ENTITY_DAMAGE || !GriefDefenderPlugin.getInstance().claimsEnabledForWorld(targetEntity.getWorld().getUniqueId())) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user