mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-14 04:02:01 +01:00
Fix damage event cancellation
This commit is contained in:
parent
2517a5629d
commit
64b2396e07
@ -160,7 +160,7 @@ public class EventListen implements Listener {
|
||||
npc = npcRegistry.getNPC(((EntityDamageByEntityEvent) event).getDamager());
|
||||
if (npc == null)
|
||||
return;
|
||||
event.setCancelled(npc.data().get(NPC.DAMAGE_OTHERS_METADATA, true));
|
||||
event.setCancelled(!npc.data().get(NPC.DAMAGE_OTHERS_METADATA, true));
|
||||
NPCDamageEntityEvent damageEvent = new NPCDamageEntityEvent(npc, (EntityDamageByEntityEvent) event);
|
||||
Bukkit.getPluginManager().callEvent(damageEvent);
|
||||
}
|
||||
|
@ -117,7 +117,6 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
|
||||
if (cancelReason != null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
setPath();
|
||||
NMS.look(handle, target);
|
||||
if (aggro && canAttack()) {
|
||||
|
@ -87,9 +87,9 @@ public class NMS {
|
||||
}
|
||||
|
||||
boolean success = target.damageEntity(DamageSource.mobAttack(handle), damage);
|
||||
|
||||
if (!success)
|
||||
return;
|
||||
|
||||
if (knockbackLevel > 0) {
|
||||
target.g(-Math.sin(handle.yaw * Math.PI / 180.0F) * knockbackLevel * 0.5F, 0.1D,
|
||||
Math.cos(handle.yaw * Math.PI / 180.0F) * knockbackLevel * 0.5F);
|
||||
|
Loading…
Reference in New Issue
Block a user