From 72ef2bc4867b5797f3e9e5fecb27dfb7a7570740 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 6 Jun 2023 18:08:18 +0200 Subject: [PATCH] Fix item pickup and exploding chests Signed-off-by: Lixfel --- .../fightsystem/listener/DenyInventoryMovement.java | 6 ++++++ .../de/steamwar/fightsystem/listener/Permanent.java | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/DenyInventoryMovement.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/DenyInventoryMovement.java index bb3454c..6c7f71f 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/listener/DenyInventoryMovement.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/listener/DenyInventoryMovement.java @@ -27,6 +27,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryDragEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; public class DenyInventoryMovement implements Listener { @@ -48,4 +49,9 @@ public class DenyInventoryMovement implements Listener { if(!PersonalKitCreator.inKitCreator(event.getWhoClicked())) event.setCancelled(true); } + + @EventHandler + public void onItemPickup(PlayerPickupItemEvent event) { + event.setCancelled(true); + } } diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/Permanent.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/Permanent.java index 4ae1875..3b1b606 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/listener/Permanent.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/listener/Permanent.java @@ -40,6 +40,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockDispenseEvent; import org.bukkit.event.block.BlockFromToEvent; +import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.SpawnerSpawnEvent; @@ -178,6 +179,18 @@ public class Permanent implements Listener { } } + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onExplosion(EntityExplodeEvent e) { + e.blockList().removeIf(block -> { + if(block.getType() == Material.TNT) { + return false; + } else { + block.setType(Material.AIR); + return true; + } + }); + } + @EventHandler public void onWorldLoad(WorldLoadEvent e) { if(!Config.ArenaLeaveable)