From efcddb11281d8d03186ea50bb878d5828ea217e9 Mon Sep 17 00:00:00 2001 From: pintux98 Date: Wed, 1 May 2019 02:37:54 +0200 Subject: [PATCH] Fixed Random Join puttin you in all arenas at once --- MultiArena-TheBridge/plugin.yml | 2 +- .../src/cx/sfy/TheBridge/cmds/SetupCMD.java | 36 +- .../src/cx/sfy/TheBridge/game/Game.java | 4 +- .../src/cx/sfy/TheBridge/game/GameFour.java | 559 ++++++++---------- .../TheBridge/listeners/PlayerListener.java | 13 +- 5 files changed, 277 insertions(+), 337 deletions(-) diff --git a/MultiArena-TheBridge/plugin.yml b/MultiArena-TheBridge/plugin.yml index 6eefb03..33b6980 100644 --- a/MultiArena-TheBridge/plugin.yml +++ b/MultiArena-TheBridge/plugin.yml @@ -1,7 +1,7 @@ main: cx.sfy.TheBridge.Main name: TheBridge version: 2.3.10 -authors: [Stefatorus, Leonardo0013YT] +authors: [Stefatorus, Leonardo0013YT,pintux98] softdepend: [PlaceholderAPI, LeaderHeads, FastAsyncWorldEdit, WorldEdit, MultiWorld, Multiverse-Core] commands: bridges: diff --git a/MultiArena-TheBridge/src/cx/sfy/TheBridge/cmds/SetupCMD.java b/MultiArena-TheBridge/src/cx/sfy/TheBridge/cmds/SetupCMD.java index d248468..9139cf7 100644 --- a/MultiArena-TheBridge/src/cx/sfy/TheBridge/cmds/SetupCMD.java +++ b/MultiArena-TheBridge/src/cx/sfy/TheBridge/cmds/SetupCMD.java @@ -152,36 +152,36 @@ public class SetupCMD implements CommandExecutor { } switch (args[1].toLowerCase()) { case "normal": + Game g = null; + int alto = 0; for (final Game game : plugin.getGM().getGames()) { - Game g = null; - int alto = 0; if (game.isState(State.FINISH) || game.isState(State.INGAME) || game.isState(State.RESTARTING) || game.isState(State.PREGAME)) continue; if (game.getPlayers() == game.getMax()) continue; if (game.getPlayers() <= alto) { g = game; alto = game.getPlayers(); } - if (g != null) - plugin.getGM().addPlayerGame(p, game); - else - p.sendMessage(plugin.getLang().get("messages.noGames")); } + if (g != null) + plugin.getGM().addPlayerGame(p, g); + else + p.sendMessage(plugin.getLang().get("messages.noGames")); break; case "four": - for (final GameFour game : plugin.getGM().getGamesFour()) { - GameFour g = null; - int alto = 0; - if (game.isState(FState.FINISH) || game.isState(FState.INGAME) || game.isState(FState.RESTARTING) || game.isState(FState.PREGAME)) continue; - if (game.getPlayers().size() == game.getMax()) continue; - if (game.getPlayers().size() <= alto) { - g = game; - alto = game.getPlayers().size(); + GameFour g4 = null; + int alto4 = 0; + for (final GameFour game4 : plugin.getGM().getGamesFour()) { + if (game4.isState(FState.FINISH) || game4.isState(FState.INGAME) || game4.isState(FState.RESTARTING) || game4.isState(FState.PREGAME)) continue; + if (game4.getPlayers().size() == game4.getMax()) continue; + if (game4.getPlayers().size() <= alto4) { + g4 = game4; + alto4 = game4.getPlayers().size(); } - if (g != null) - plugin.getGM().addPlayerGameFour(p, game); - else - p.sendMessage(plugin.getLang().get("messages.noGames")); } + if (g4 != null) + plugin.getGM().addPlayerGameFour(p, g4); + else + p.sendMessage(plugin.getLang().get("messages.noGames")); break; } break; diff --git a/MultiArena-TheBridge/src/cx/sfy/TheBridge/game/Game.java b/MultiArena-TheBridge/src/cx/sfy/TheBridge/game/Game.java index 27491d8..afbff06 100644 --- a/MultiArena-TheBridge/src/cx/sfy/TheBridge/game/Game.java +++ b/MultiArena-TheBridge/src/cx/sfy/TheBridge/game/Game.java @@ -161,7 +161,7 @@ public class Game { checkCancel(); } - // FIXME: Not properly giving coins + // TODO: Fireworks should spawn randomly around the map and not inside the lobby cage public boolean checkWin(Player w, Team team, int goals) { if (isState(State.FINISH)) return false; @@ -173,6 +173,7 @@ public class Game { for (final Player r : win.getTeamPlayers()) PlayerStat.getPlayerStat(r).addNormalWins(); for (final Player p : players) { + p.getInventory().clear(); p.teleport(lobby); updateSB(p); plugin.getNMS().sendTitle(p, 0, 60, 0, @@ -223,6 +224,7 @@ public class Game { for (final Player r : win.getTeamPlayers()) PlayerStat.getPlayerStat(r).addNormalWins(); for (final Player p : players) { + p.getInventory().clear(); p.teleport(lobby); plugin.getNMS().sendTitle(p, 0, 60, 0, plugin.getLang().get("titles.win.title") diff --git a/MultiArena-TheBridge/src/cx/sfy/TheBridge/game/GameFour.java b/MultiArena-TheBridge/src/cx/sfy/TheBridge/game/GameFour.java index d20260d..d7539f2 100644 --- a/MultiArena-TheBridge/src/cx/sfy/TheBridge/game/GameFour.java +++ b/MultiArena-TheBridge/src/cx/sfy/TheBridge/game/GameFour.java @@ -1,5 +1,10 @@ package cx.sfy.TheBridge.game; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Random; + import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Color; @@ -25,31 +30,26 @@ import cx.sfy.TheBridge.utils.CenterMessage; import cx.sfy.TheBridge.utils.ItemBuilder; import cx.sfy.TheBridge.utils.Utils; -import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Random; - public class GameFour { - private Main plugin; - private HashMap teams; - private HashMap teamPlayer; - private ArrayList players; - private ArrayList spects; - private HashMap pd = new HashMap(); - private HashMap goals = new HashMap(); - private HashMap kills = new HashMap(); - private ArrayList build = new ArrayList(); - private ArrayList placed = new ArrayList(); - private ArrayList holograms = new ArrayList(); - private Location lobby; - private Location spect; - private String name; - private String mode; - private int min; - private int max; - private int teamSize; + private final Main plugin; + private final HashMap teams; + private final HashMap teamPlayer; + private final ArrayList players; + private final ArrayList spects; + private final HashMap pd = new HashMap<>(); + private final HashMap goals = new HashMap<>(); + private final HashMap kills = new HashMap<>(); + private final ArrayList build = new ArrayList<>(); + private final ArrayList placed = new ArrayList<>(); + private final ArrayList holograms = new ArrayList<>(); + private final Location lobby; + private final Location spect; + private final String name; + private final String mode; + private final int min; + private final int max; + private final int teamSize; private int starting; private int prestart; private BukkitTask start; @@ -75,20 +75,18 @@ public class GameFour { this.teams = new HashMap<>(); this.players = new ArrayList<>(); this.spects = new ArrayList<>(); - int gn = Math.min(buildMin.getBlockX(), buildMax.getBlockX()); - int gn2 = Math.max(buildMin.getBlockX(), buildMax.getBlockX()); - int gn3 = Math.min(buildMin.getBlockZ(), buildMax.getBlockZ()); - int gn4 = Math.max(buildMin.getBlockZ(), buildMax.getBlockZ()); - int gn5 = Math.min(buildMin.getBlockY(), buildMax.getBlockY()); - int gn6 = Math.max(buildMin.getBlockY(), buildMax.getBlockY()); - for (int i = gn; i <= gn2; ++i) { - for (int j = gn5; j <= gn6; ++j) { + final int gn = Math.min(buildMin.getBlockX(), buildMax.getBlockX()); + final int gn2 = Math.max(buildMin.getBlockX(), buildMax.getBlockX()); + final int gn3 = Math.min(buildMin.getBlockZ(), buildMax.getBlockZ()); + final int gn4 = Math.max(buildMin.getBlockZ(), buildMax.getBlockZ()); + final int gn5 = Math.min(buildMin.getBlockY(), buildMax.getBlockY()); + final int gn6 = Math.max(buildMin.getBlockY(), buildMax.getBlockY()); + for (int i = gn; i <= gn2; ++i) + for (int j = gn5; j <= gn6; ++j) for (int k = gn3; k <= gn4; ++k) { - Location location3 = new Location(buildMin.getWorld(), (double) i, (double) j, (double) k); + final Location location3 = new Location(buildMin.getWorld(), i, j, k); build.add(location3); } - } - } this.teams.put(ChatColor.BLUE, new TeamFour(this, ChatColor.BLUE, Color.BLUE, plugin.getConfig().getString("names.blue"), spawnBlue, respawnBlue, portalBlue, hBlue)); this.teams.put(ChatColor.RED, new TeamFour(this, ChatColor.RED, Color.RED, @@ -103,15 +101,13 @@ public class GameFour { public void checkCancel() { if (isState(FState.STARTING) && players.size() <= getMin()) { - if (start != null) { + if (start != null) start.cancel(); - } setState(FState.WAITING); starting = 30; updateSign(); - for (Player on : players) { + for (final Player on : players) updateSB(on); - } } } @@ -128,21 +124,21 @@ public class GameFour { } public boolean checkWin(TeamFour win, TeamFour death, Player e) { - + if (getTeamsAlive() <= 1 && !isState(FState.FINISH)) { setState(FState.FINISH); updateSign(); - DecimalFormat df = new DecimalFormat("#.##"); - for (Player w : win.getTeamPlayers()) { + final DecimalFormat df = new DecimalFormat("#.##"); + for (final Player w : win.getTeamPlayers()) PlayerStat.getPlayerStat(w).addFourWins(); - } - for (Player p : players) { + for (final Player p : players) { + p.getInventory().clear(); plugin.getNMS().sendTitle(p, 0, 60, 0, plugin.getLang().get("titles.winFour.title").replaceAll("", win.getLifeString()) - .replaceAll("", win.getTeamName()).replaceAll("", win.getColor() + ""), + .replaceAll("", win.getTeamName()).replaceAll("", win.getColor() + ""), plugin.getLang().get("titles.winFour.subtitle").replaceAll("", win.getLifeString()) - .replaceAll("", win.getTeamName()).replaceAll("", win.getColor() + "")); - for (String msg : plugin.getLang().getList("messages.winFour")) { + .replaceAll("", win.getTeamName()).replaceAll("", win.getColor() + "")); + for (final String msg : plugin.getLang().getList("messages.winFour")) CenterMessage.sendCenteredMessage(p, msg.replaceAll("&", "§").replaceAll("", e.getName()) .replaceAll("", df.format(e.getHealth())).replaceAll("", win.getTeamName()) .replaceAll("", String.valueOf(goals.get(e))) @@ -158,25 +154,21 @@ public class GameFour { .replaceAll("", (death.getTeamName() == null) ? "Stole" : death.getTeamName()) .replaceAll("", (win.getColor() == null) ? ChatColor.WHITE + "" : win.getColor() + "")); - } } new BukkitRunnable() { @Override public void run() { - for (TruenoHologram th : holograms) { + for (final TruenoHologram th : holograms) th.delete(); - } - for (Player p : spect.getWorld().getPlayers()) { + for (final Player p : spect.getWorld().getPlayers()) if (pd.containsKey(p)) { - for (Player on : Bukkit.getOnlinePlayers()) { + for (final Player on : Bukkit.getOnlinePlayers()) { on.showPlayer(p); p.showPlayer(on); } plugin.getGM().removePlayerFourGames(p); - } else { + } else p.teleport(plugin.getMainLobby()); - } - } } }.runTaskLater(plugin, 20 * 10); new BukkitRunnable() { @@ -191,7 +183,7 @@ public class GameFour { } public void celebrateGoal(TeamFour team, TeamFour death, Player e) { - DecimalFormat df = new DecimalFormat("#.##"); + final DecimalFormat df = new DecimalFormat("#.##"); addGoal(e); PlayerStat.getPlayerStat(e).addFourGoals(); firework(getSpect(), team.getFColor()); @@ -200,132 +192,122 @@ public class GameFour { death.removeLife(1); if (death.getLife() == 0) { death.killTeam(); - if (checkWin(team, death, e)) { + if (checkWin(team, death, e)) return; - } - for (Player p : players) { + for (final Player p : players) plugin.getNMS().sendTitle(p, 0, 20, 0, plugin.getLang().get("titles.goalFinal.title").replaceAll("", e.getName()) - .replaceAll("", "❤").replaceAll("", team.getTeamName()) - .replaceAll("", death.getTeamName()) - .replaceAll("", team.getColor() + ""), + .replaceAll("", "❤").replaceAll("", team.getTeamName()) + .replaceAll("", death.getTeamName()) + .replaceAll("", team.getColor() + ""), plugin.getLang().get("titles.goalFinal.subtitle").replaceAll("", e.getName()) - .replaceAll("", "❤").replaceAll("", team.getTeamName()) - .replaceAll("", death.getTeamName()) - .replaceAll("", team.getColor() + "")); - } - } else { - for (Player p : players) { + .replaceAll("", "❤").replaceAll("", team.getTeamName()) + .replaceAll("", death.getTeamName()) + .replaceAll("", team.getColor() + "")); + } else + for (final Player p : players) plugin.getNMS().sendTitle(p, 0, 20, 0, plugin.getLang().get("titles.goalNormal.title").replaceAll("", e.getName()) - .replaceAll("", "❤").replaceAll("", team.getTeamName()) - .replaceAll("", death.getTeamName()) - .replaceAll("", team.getColor() + ""), + .replaceAll("", "❤").replaceAll("", team.getTeamName()) + .replaceAll("", death.getTeamName()) + .replaceAll("", team.getColor() + ""), plugin.getLang().get("titles.goalNormal.subtitle").replaceAll("", e.getName()) - .replaceAll("", "â�¤").replaceAll("", team.getTeamName()) - .replaceAll("", death.getTeamName()) - .replaceAll("", team.getColor() + "")); - } - } - for (Player p : players) { + .replaceAll("", "â�¤").replaceAll("", team.getTeamName()) + .replaceAll("", death.getTeamName()) + .replaceAll("", team.getColor() + "")); + for (final Player p : players) { updateSB(p); - for (String msg : plugin.getLang().getList("messages.final")) { + for (final String msg : plugin.getLang().getList("messages.final")) CenterMessage.sendCenteredMessage(p, msg.replaceAll("&", "§").replaceAll("", death.getTeamName()) - .replaceAll("", String.valueOf(goals.get(e))) - .replaceAll("", (goals.get(e) > 1) ? "es" : "") - .replaceAll("", team.getTeamName()) - .replaceAll("", "" + team.getColor()).replaceAll("", e.getName()) - .replaceAll("", df.format(e.getHealth())) - .replaceAll("", team.getTeamName()) - .replaceAll("", teams.get(ChatColor.RED).getTeamName()) - .replaceAll("", teams.get(ChatColor.RED).getLifeString()) - .replaceAll("", teams.get(ChatColor.BLUE).getTeamName()) - .replaceAll("", teams.get(ChatColor.BLUE).getLifeString()) - .replaceAll("", teams.get(ChatColor.YELLOW).getTeamName()) - .replaceAll("", teams.get(ChatColor.YELLOW).getLifeString()) - .replaceAll("", teams.get(ChatColor.GREEN).getTeamName()) - .replaceAll("", teams.get(ChatColor.GREEN).getLifeString()) - .replaceAll("", "❤")); - } + .replaceAll("", String.valueOf(goals.get(e))) + .replaceAll("", (goals.get(e) > 1) ? "es" : "") + .replaceAll("", team.getTeamName()) + .replaceAll("", "" + team.getColor()).replaceAll("", e.getName()) + .replaceAll("", df.format(e.getHealth())) + .replaceAll("", team.getTeamName()) + .replaceAll("", teams.get(ChatColor.RED).getTeamName()) + .replaceAll("", teams.get(ChatColor.RED).getLifeString()) + .replaceAll("", teams.get(ChatColor.BLUE).getTeamName()) + .replaceAll("", teams.get(ChatColor.BLUE).getLifeString()) + .replaceAll("", teams.get(ChatColor.YELLOW).getTeamName()) + .replaceAll("", teams.get(ChatColor.YELLOW).getLifeString()) + .replaceAll("", teams.get(ChatColor.GREEN).getTeamName()) + .replaceAll("", teams.get(ChatColor.GREEN).getLifeString()) + .replaceAll("", "❤")); } } else { team.addLife(1); death.removeLife(1); if (death.getLife() == 0) { death.killTeam(); - if (checkWin(team, death, e)) { + if (checkWin(team, death, e)) return; - } - for (Player p : players) { + for (final Player p : players) plugin.getNMS().sendTitle(p, 0, 20, 0, plugin.getLang().get("titles.goalFinal.title").replaceAll("", e.getName()) - .replaceAll("", "❤").replaceAll("", team.getTeamName()) - .replaceAll("", death.getTeamName()) - .replaceAll("", team.getColor() + ""), + .replaceAll("", "❤").replaceAll("", team.getTeamName()) + .replaceAll("", death.getTeamName()) + .replaceAll("", team.getColor() + ""), plugin.getLang().get("titles.goalFinal.subtitle").replaceAll("", e.getName()) - .replaceAll("", "❤").replaceAll("", team.getTeamName()) - .replaceAll("", death.getTeamName()) - .replaceAll("", team.getColor() + "")); - } + .replaceAll("", "❤").replaceAll("", team.getTeamName()) + .replaceAll("", death.getTeamName()) + .replaceAll("", team.getColor() + "")); - } else { - for (Player p : players) { + } else + for (final Player p : players) plugin.getNMS().sendTitle(p, 0, 20, 0, plugin.getLang().get("titles.goalNormal.title").replaceAll("", e.getName()) - .replaceAll("", "❤").replaceAll("", team.getTeamName()) - .replaceAll("", death.getTeamName()) - .replaceAll("", team.getColor() + ""), + .replaceAll("", "❤").replaceAll("", team.getTeamName()) + .replaceAll("", death.getTeamName()) + .replaceAll("", team.getColor() + ""), plugin.getLang().get("titles.goalNormal.subtitle").replaceAll("", e.getName()) - .replaceAll("", "❤").replaceAll("", team.getTeamName()) - .replaceAll("", death.getTeamName()) - .replaceAll("", team.getColor() + "")); - } - } - for (Player p : players) { + .replaceAll("", "❤").replaceAll("", team.getTeamName()) + .replaceAll("", death.getTeamName()) + .replaceAll("", team.getColor() + "")); + for (final Player p : players) { updateSB(p); - for (String msg : plugin.getLang().getList("messages.stole")) { + for (final String msg : plugin.getLang().getList("messages.stole")) CenterMessage.sendCenteredMessage(p, msg.replaceAll("&", "§").replaceAll("", death.getTeamName()) - .replaceAll("", String.valueOf(goals.get(e))) - .replaceAll("", (goals.get(e) > 1) ? "es" : "") - .replaceAll("", "" + team.getColor()) - .replaceAll("", team.getTeamName()).replaceAll("", e.getName()) - .replaceAll("", df.format(e.getHealth())) - .replaceAll("", teams.get(ChatColor.RED).getTeamName()) - .replaceAll("", teams.get(ChatColor.RED).getLifeString()) - .replaceAll("", teams.get(ChatColor.BLUE).getTeamName()) - .replaceAll("", teams.get(ChatColor.BLUE).getLifeString()) - .replaceAll("", teams.get(ChatColor.YELLOW).getTeamName()) - .replaceAll("", teams.get(ChatColor.YELLOW).getLifeString()) - .replaceAll("", teams.get(ChatColor.GREEN).getTeamName()) - .replaceAll("", teams.get(ChatColor.GREEN).getLifeString()) - .replaceAll("", "❤")); - } + .replaceAll("", String.valueOf(goals.get(e))) + .replaceAll("", (goals.get(e) > 1) ? "es" : "") + .replaceAll("", "" + team.getColor()) + .replaceAll("", team.getTeamName()).replaceAll("", e.getName()) + .replaceAll("", df.format(e.getHealth())) + .replaceAll("", teams.get(ChatColor.RED).getTeamName()) + .replaceAll("", teams.get(ChatColor.RED).getLifeString()) + .replaceAll("", teams.get(ChatColor.BLUE).getTeamName()) + .replaceAll("", teams.get(ChatColor.BLUE).getLifeString()) + .replaceAll("", teams.get(ChatColor.YELLOW).getTeamName()) + .replaceAll("", teams.get(ChatColor.YELLOW).getLifeString()) + .replaceAll("", teams.get(ChatColor.GREEN).getTeamName()) + .replaceAll("", teams.get(ChatColor.GREEN).getLifeString()) + .replaceAll("", "❤")); } } } public void firework(Location loc, Color c1) { - Firework fa = (Firework) loc.getWorld().spawn( + final Firework fa = loc.getWorld().spawn( loc.clone().add(new Random().nextInt(5) + 1, new Random().nextInt(1) + 1, new Random().nextInt(5) + 1), Firework.class); - FireworkMeta fam = fa.getFireworkMeta(); - FireworkEffect.Type tipo = FireworkEffect.Type.STAR; - Color c2 = Color.WHITE; - FireworkEffect ef = FireworkEffect.builder().withColor(c1).withFade(c2).with(tipo).build(); + final FireworkMeta fam = fa.getFireworkMeta(); + final FireworkEffect.Type tipo = FireworkEffect.Type.STAR; + final Color c2 = Color.WHITE; + final FireworkEffect ef = FireworkEffect.builder().withColor(c1).withFade(c2).with(tipo).build(); fam.addEffect(ef); fam.setPower(0); fa.setFireworkMeta(fam); new BukkitRunnable() { @Override public void run() { - Firework fa = (Firework) loc.getWorld().spawn(loc.clone().add(new Random().nextInt(5) + 1, + final Firework fa = loc.getWorld().spawn(loc.clone().add(new Random().nextInt(5) + 1, new Random().nextInt(1) + 1, new Random().nextInt(5) + 1), Firework.class); - FireworkMeta fam = fa.getFireworkMeta(); - FireworkEffect.Type tipo = FireworkEffect.Type.STAR; - Color c2 = Color.WHITE; - FireworkEffect ef = FireworkEffect.builder().withColor(c1).withFade(c2).with(tipo).build(); + final FireworkMeta fam = fa.getFireworkMeta(); + final FireworkEffect.Type tipo = FireworkEffect.Type.STAR; + final Color c2 = Color.WHITE; + final FireworkEffect ef = FireworkEffect.builder().withColor(c1).withFade(c2).with(tipo).build(); fam.addEffect(ef); fam.setPower(0); fa.setFireworkMeta(fam); @@ -347,7 +329,7 @@ public class GameFour { givePlayerItems(p); } }.runTaskLater(plugin, 20); - for (Player on : players) { + for (final Player on : players) { on.sendMessage(plugin.getLang().get("messages.join").replaceAll("", p.getName()) .replaceAll("", String.valueOf(players.size())) .replaceAll("", String.valueOf(getMax()))); @@ -363,19 +345,16 @@ public class GameFour { pd.get(p).restore(); removeAllPlayerTeam(p); players.remove(p); - if (isState(FState.WAITING) || isState(FState.STARTING)) { - for (Player on : players) { + if (isState(FState.WAITING) || isState(FState.STARTING)) + for (final Player on : players) { on.sendMessage(plugin.getLang().get("messages.quit").replaceAll("", p.getName()) .replaceAll("", String.valueOf(players.size())) .replaceAll("", String.valueOf(getMax()))); on.playSound(on.getLocation(), Sound.valueOf(plugin.getSounds().get("sounds.game.quit")), 1.0f, 1.0f); updateSB(on); } - } else { - if (getTeamsAlive() == 1) { - checkWin(getLastTeam(), getTeamPlayer(p), getLastTeam().getTeamPlayers().get(0)); - } - } + else if (getTeamsAlive() == 1) + checkWin(getLastTeam(), getTeamPlayer(p), getLastTeam().getTeamPlayers().get(0)); updateSign(); checkCancel(); } @@ -384,16 +363,14 @@ public class GameFour { if (isState(FState.WAITING) && players.size() >= getMin()) { setState(FState.STARTING); updateSign(); - for (Player p : players) { + for (final Player p : players) p.setGameMode(GameMode.ADVENTURE); - } } if (isState(FState.STARTING)) { - for (Player p : players) { + for (final Player p : players) updateSB(p); - } - if (starting == 240 || starting == 180 || starting == 120) { - for (Player p : players) { + if (starting == 240 || starting == 180 || starting == 120) + for (final Player p : players) { p.sendMessage(plugin.getLang().get(p, "messages.starting") .replaceAll("