From 20f14670dff0a43423e46e16cf9ad93a9f04c757 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Thu, 15 Oct 2020 22:10:08 +0200 Subject: [PATCH] Despawn all tnt at end of fight Signed-off-by: Lixfel --- .../steamwar/fightsystem/listener/EventRecordListener.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/listener/EventRecordListener.java b/FightSystem_Main/src/de/steamwar/fightsystem/listener/EventRecordListener.java index c50a3be..3249c75 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/listener/EventRecordListener.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/listener/EventRecordListener.java @@ -29,6 +29,7 @@ import de.steamwar.fightsystem.states.FightState; import org.bukkit.*; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.entity.TNTPrimed; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockPhysicsEvent; @@ -194,6 +195,7 @@ public class EventRecordListener extends BasicListener { }else if(state == FightState.SPECTATE){ despawnTeam(Fight.getRedTeam()); despawnTeam(Fight.getBlueTeam()); + despawnTNT(); } } @@ -228,6 +230,11 @@ public class EventRecordListener extends BasicListener { } } + private void despawnTNT(){ + for(TNTPrimed tnt : Bukkit.getWorlds().get(0).getEntitiesByClass(TNTPrimed.class)) + RecordSystem.entityDespawns(tnt); + } + private boolean isNotSent(Player p){ FightPlayer fp = Fight.getFightPlayer(p); return fp == null || !fp.isLiving() || FightSystem.getFightState() == FightState.SPECTATE;