diff --git a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/combat/SilentSwapDelay.java b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/combat/SilentSwapDelay.java index fe33809c..479a670b 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/combat/SilentSwapDelay.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/combat/SilentSwapDelay.java @@ -8,6 +8,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.inventory.InventoryInteractEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerItemHeldEvent; import org.bukkit.event.player.PlayerKickEvent; @@ -57,6 +58,15 @@ private void onPlayerItemHeld(PlayerItemHeldEvent event) { // Fired when a hot b } } + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + private void onInventoryInteract(InventoryInteractEvent event) { + if (!swapItemCooldowns.containsKey(event.getWhoClicked().getUniqueId())) return; + + if (swapItemCooldowns.get(event.getWhoClicked().getUniqueId()) > System.nanoTime()) { + event.setCancelled(true); + } + } + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) private void onEntityDamageByEntity(EntityDamageByEntityEvent event) { if (event.getDamager().getType() == XEntityType.PLAYER.get()) { diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/combat/SilentSwapDelay.java b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/combat/SilentSwapDelay.java index 4d9c5b1c..9f42f03a 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/combat/SilentSwapDelay.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/combat/SilentSwapDelay.java @@ -8,6 +8,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.inventory.InventoryInteractEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerItemHeldEvent; import org.bukkit.event.player.PlayerKickEvent; @@ -57,6 +58,15 @@ private void onPlayerItemHeld(PlayerItemHeldEvent event) { // Fired when a hot b } } + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + private void onInventoryInteract(InventoryInteractEvent event) { + if (!swapItemCooldowns.containsKey(event.getWhoClicked().getUniqueId())) return; + + if (swapItemCooldowns.get(event.getWhoClicked().getUniqueId()) > System.nanoTime()) { + event.setCancelled(true); + } + } + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) private void onEntityDamageByEntity(EntityDamageByEntityEvent event) { if (event.getDamager().getType() == XEntityType.PLAYER.get()) {