forked from SteamWar/SteamWar
Fix for events
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
package de.steamwar.towerrun.countdowns;
|
||||
|
||||
import de.steamwar.towerrun.TowerRun;
|
||||
import de.steamwar.towerrun.config.Config;
|
||||
import de.steamwar.towerrun.game.TowerRunGame;
|
||||
import de.steamwar.towerrun.state.GameStates;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -48,7 +49,11 @@ public class EndCountdown extends Countdown {
|
||||
void timerEnd() {
|
||||
Bukkit.getOnlinePlayers().forEach(player -> player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 1, 1));
|
||||
if (RESETS) {
|
||||
TowerRunGame.reset();
|
||||
if (Config.event()) {
|
||||
Bukkit.shutdown();
|
||||
} else {
|
||||
TowerRunGame.reset();
|
||||
}
|
||||
lobbyCountdown.setTime(lobbyCountdown.defaultTime());
|
||||
} else {
|
||||
Bukkit.shutdown();
|
||||
|
||||
@@ -62,12 +62,13 @@ public class LobbyListener extends GameStateBukkitListener {
|
||||
int team = user.getTeam();
|
||||
|
||||
if (team != Config.EVENT_TEAM_BLUE_ID && team != Config.EVENT_TEAM_RED_ID) {
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (TowerRunGame.PLAYERS_ALIVE.stream().map(towerRunPlayer -> SteamwarUser.get(towerRunPlayer.player().getUniqueId()).getTeam()).filter(integer -> integer == team).count() < Config.EVENT_MAXIMUM_TEAM_MEMBERS) {
|
||||
TowerRunGame.PLAYERS_ALIVE.add(TowerRunPlayer.get(player));
|
||||
} else {
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
}
|
||||
} else {
|
||||
TowerRunGame.PLAYERS_ALIVE.add(TowerRunPlayer.get(player));
|
||||
|
||||
Reference in New Issue
Block a user