From f210b41f2e9937fa3c7be974e1d8f9a611e02501 Mon Sep 17 00:00:00 2001 From: Luca Date: Wed, 24 Nov 2021 18:20:05 +0100 Subject: [PATCH] e --- .../java/rip/tilly/bedwars/customitems/e.java | 4 ++++ .../customitems/popuptower/PlaceTower.java | 8 ++++++++ .../bedwars/listeners/RandomListeners.java | 18 ++++++++++++++++++ .../bedwars/listeners/game/WorldListener.java | 7 +++++++ 4 files changed, 37 insertions(+) create mode 100644 src/main/java/rip/tilly/bedwars/customitems/e.java create mode 100644 src/main/java/rip/tilly/bedwars/customitems/popuptower/PlaceTower.java diff --git a/src/main/java/rip/tilly/bedwars/customitems/e.java b/src/main/java/rip/tilly/bedwars/customitems/e.java new file mode 100644 index 0000000..d6fb9b4 --- /dev/null +++ b/src/main/java/rip/tilly/bedwars/customitems/e.java @@ -0,0 +1,4 @@ +package rip.tilly.bedwars.customitems; + +public class e { +} diff --git a/src/main/java/rip/tilly/bedwars/customitems/popuptower/PlaceTower.java b/src/main/java/rip/tilly/bedwars/customitems/popuptower/PlaceTower.java new file mode 100644 index 0000000..16a6f94 --- /dev/null +++ b/src/main/java/rip/tilly/bedwars/customitems/popuptower/PlaceTower.java @@ -0,0 +1,8 @@ +package rip.tilly.bedwars.customitems.popuptower; + +import org.bukkit.block.Block; + +public class PlaceTower { + + public PlaceTower(Block block, String xyz, ) +} diff --git a/src/main/java/rip/tilly/bedwars/listeners/RandomListeners.java b/src/main/java/rip/tilly/bedwars/listeners/RandomListeners.java index d84591d..e4ddc1f 100644 --- a/src/main/java/rip/tilly/bedwars/listeners/RandomListeners.java +++ b/src/main/java/rip/tilly/bedwars/listeners/RandomListeners.java @@ -1,15 +1,19 @@ package rip.tilly.bedwars.listeners; import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.*; import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.hanging.HangingBreakEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.player.PlayerToggleFlightEvent; import org.bukkit.event.weather.WeatherChangeEvent; import rip.tilly.bedwars.BedWars; +import rip.tilly.bedwars.playerdata.PlayerData; import rip.tilly.bedwars.playerdata.PlayerState; public class RandomListeners implements Listener { @@ -82,4 +86,18 @@ public class RandomListeners implements Listener { event.setCancelled(true); } } + + @EventHandler + public void onInventoryClick(InventoryClickEvent event) { + Player player = (Player) event.getWhoClicked(); + PlayerData playerData = this.plugin.getPlayerDataManager().getPlayerData(player.getUniqueId()); + if (playerData.getPlayerState() != PlayerState.PLAYING) { + event.setCancelled(true); + return; + } + + if (event.getSlotType() == InventoryType.SlotType.ARMOR) { + event.setCancelled(true); + } + } } diff --git a/src/main/java/rip/tilly/bedwars/listeners/game/WorldListener.java b/src/main/java/rip/tilly/bedwars/listeners/game/WorldListener.java index 1b37aab..33c7039 100644 --- a/src/main/java/rip/tilly/bedwars/listeners/game/WorldListener.java +++ b/src/main/java/rip/tilly/bedwars/listeners/game/WorldListener.java @@ -158,6 +158,13 @@ public class WorldListener implements Listener { return; } + Block chest = event.getBlockPlaced(); + if (chest.getType() == Material.CHEST) { + Location location = event.getBlockPlaced().getLocation(); + event.setCancelled(true); + return; + } + game.addPlacedBlock(block); }