SteamWar/FightSystem
Archiviert
13
1

Despawn all tnt at end of fight

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2020-10-15 22:10:08 +02:00
Ursprung cc8b7bd96e
Commit 20f14670df

Datei anzeigen

@ -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;