Skip to content

Commit

Permalink
Aggressively prevent NPC item damage
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Aug 27, 2023
1 parent c5ffaf6 commit 09afe2d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/org/mcmonkey/sentinel/SentinelEventHandler.java
Expand Up @@ -434,4 +434,15 @@ public void onInvClose(InventoryCloseEvent event) {
}
}
}

/**
* Called when armor or weapons are damaged, used to block unwanted item damage.
*/
@EventHandler
public void onItemDamage(PlayerItemDamageEvent event) {
SentinelTrait sentinel = SentinelUtilities.tryGetSentinel(event.getPlayer());
if (sentinel != null && !sentinel.needsAmmo) {
event.setCancelled(true);
}
}
}

0 comments on commit 09afe2d

Please sign in to comment.