File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed
AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/lagpreventions
AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/lagpreventions Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -31,12 +31,15 @@ public void disable() {
3131 @ EventHandler (priority = EventPriority .HIGHEST , ignoreCancelled = true )
3232 private void onEntityDamage (EntityDamageEvent event ) {
3333 if (event .getEntityType () != XEntityType .ITEM .get ()) return ;
34- Item item = (Item ) event .getEntity ();
35- if (!MaterialTags .SHULKER_BOXES .isTagged (item .getItemStack ())) return ;
3634
37- if (event .getFinalDamage () >= item .getHealth ()) {
38- event .setCancelled (true ); // Cancel damage so the drop logic doesn't happen
39- item .remove (); // remove entity
35+ if (event .getCause () == EntityDamageEvent .DamageCause .BLOCK_EXPLOSION || event .getCause () == EntityDamageEvent .DamageCause .ENTITY_EXPLOSION ) {
36+ Item item = (Item ) event .getEntity ();
37+ if (!MaterialTags .SHULKER_BOXES .isTagged (item .getItemStack ())) return ;
38+
39+ if (event .getFinalDamage () >= item .getHealth ()) {
40+ event .setCancelled (true ); // Cancel damage so the drop logic doesn't happen
41+ item .remove (); // remove entity
42+ }
4043 }
4144 }
4245}
Original file line number Diff line number Diff line change @@ -31,10 +31,13 @@ public void disable() {
3131 @ EventHandler (priority = EventPriority .HIGHEST , ignoreCancelled = true )
3232 private void onEntityDamage (EntityDamageEvent event ) {
3333 if (event .getEntityType () != XEntityType .ITEM .get ()) return ;
34- Item item = (Item ) event .getEntity ();
35- if (MaterialUtil .SHULKER_BOXES .contains (item .getItemStack ().getType ())) {
36- event .setCancelled (true ); // Cancel damage so the drop logic doesn't happen
37- item .remove (); // remove entity
34+
35+ if (event .getCause () == EntityDamageEvent .DamageCause .BLOCK_EXPLOSION || event .getCause () == EntityDamageEvent .DamageCause .ENTITY_EXPLOSION ) {
36+ Item item = (Item ) event .getEntity ();
37+ if (MaterialUtil .SHULKER_BOXES .contains (item .getItemStack ().getType ())) {
38+ event .setCancelled (true ); // Cancel damage so the drop logic doesn't happen
39+ item .remove (); // remove entity
40+ }
3841 }
3942 }
4043}
You can’t perform that action at this time.
0 commit comments