diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
index 861936a..edc3e56 100644
--- a/.idea/jarRepositories.xml
+++ b/.idea/jarRepositories.xml
@@ -11,6 +11,11 @@
+
+
+
+
+
@@ -21,6 +26,11 @@
+
+
+
+
+
diff --git a/BedWars.iml b/BedWars.iml
index b74e7bb..08b5f7a 100644
--- a/BedWars.iml
+++ b/BedWars.iml
@@ -21,6 +21,7 @@
+
diff --git a/src/main/java/rip/tilly/bedwars/listeners/RandomListeners.java b/src/main/java/rip/tilly/bedwars/listeners/RandomListeners.java
index eaac268..ad08a6d 100644
--- a/src/main/java/rip/tilly/bedwars/listeners/RandomListeners.java
+++ b/src/main/java/rip/tilly/bedwars/listeners/RandomListeners.java
@@ -5,7 +5,9 @@ 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.EntityDamageByEntityEvent;
import org.bukkit.event.entity.FoodLevelChangeEvent;
+import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.hanging.HangingBreakEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerToggleFlightEvent;
@@ -26,6 +28,7 @@ public class RandomListeners implements Listener {
@EventHandler
public void onPlayerDropItem(PlayerDropItemEvent event) {
PlayerData playerData = this.plugin.getPlayerDataManager().getPlayerData(event.getPlayer().getUniqueId());
+
if (playerData.getPlayerState() != PlayerState.PLAYING) {
event.setCancelled(true);
}
@@ -88,4 +91,13 @@ public class RandomListeners implements Listener {
event.setCancelled(true);
}
}
+
+ @EventHandler
+ public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
+ PlayerData playerData = this.plugin.getPlayerDataManager().getPlayerData(event.getEntity().getUniqueId());
+
+ if (playerData.getPlayerState() != PlayerState.PLAYING) {
+ 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 2743f42..04bcf0f 100644
--- a/src/main/java/rip/tilly/bedwars/listeners/game/WorldListener.java
+++ b/src/main/java/rip/tilly/bedwars/listeners/game/WorldListener.java
@@ -91,6 +91,12 @@ public class WorldListener implements Listener {
return;
}
+ if (block.getType() == Material.BED) {
+ block.getDrops().clear();
+
+ return;
+ }
+
player.getInventory().addItem(block.getDrops().toArray(new ItemStack[0]));
game.removePlacedBlock(block);
block.setType(Material.AIR);