diff --git a/src/de/steamwar/misslewars/MissileWars.java b/src/de/steamwar/misslewars/MissileWars.java index cb93539..69e9670 100644 --- a/src/de/steamwar/misslewars/MissileWars.java +++ b/src/de/steamwar/misslewars/MissileWars.java @@ -31,9 +31,15 @@ import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.GameMode; import org.bukkit.Sound; +import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; +import java.util.List; +import java.util.Set; +import java.util.UUID; +import java.util.stream.Collectors; + public class MissileWars extends JavaPlugin { private static MissileWars plugin; private static MWTeam redTeam; //red has South side -> spawns missles towards north @@ -93,8 +99,11 @@ public class MissileWars extends JavaPlugin { fightState = FightState.WAITING; StateDependent.setupState(fightState); - Config.RedLeader = null; - Config.BlueLeader = null; + Set uuidList = Bukkit.getOnlinePlayers().stream().map(Entity::getUniqueId).collect(Collectors.toSet()); + if (!uuidList.contains(Config.RedLeader) || !uuidList.contains(Config.BlueLeader)) { + Config.RedLeader = null; + Config.BlueLeader = null; + } redTeam.reset(); blueTeam.reset();