mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-23 19:16:40 +01:00
Fix mobs not being able to attack players regardless of permission.
Fixes WORLDGUARD-3172.
This commit is contained in:
parent
6d5d9934cc
commit
125595e6b9
@ -401,12 +401,13 @@ public void onDamageEntity(DamageEntityEvent event) {
|
||||
RegionAssociable associable = createRegionAssociable(event.getCause());
|
||||
|
||||
RegionQuery query = getPlugin().getRegionContainer().createQuery();
|
||||
Object rootCause = event.getCause().getRootCause();
|
||||
Player attacker;
|
||||
boolean canDamage;
|
||||
String what;
|
||||
|
||||
/* Hostile / ambient mob override */
|
||||
if (Entities.isHostile(event.getEntity()) || Entities.isAmbient(event.getEntity())) {
|
||||
if (isWhitelistedEntity(event.getEntity()) || (rootCause instanceof Entity && isWhitelistedEntity((Entity) rootCause))) {
|
||||
canDamage = true;
|
||||
what = "hit that";
|
||||
|
||||
@ -465,4 +466,8 @@ public void onVehicleExit(VehicleExitEvent event) {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isWhitelistedEntity(Entity entity) {
|
||||
return Entities.isHostile(entity) || Entities.isAmbient(entity);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user