From fa79a64d6ba6aed9b99290b4c938d14a825c2566 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Wed, 30 Mar 2022 16:49:21 +0200 Subject: [PATCH] Announce event fights on spectate Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/EventStarter.java | 28 +++++++++++--------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/de/steamwar/bungeecore/EventStarter.java b/src/de/steamwar/bungeecore/EventStarter.java index 98d75e3..0de5667 100644 --- a/src/de/steamwar/bungeecore/EventStarter.java +++ b/src/de/steamwar/bungeecore/EventStarter.java @@ -59,23 +59,27 @@ public class EventStarter implements Runnable { EventFight next; while((next = nextFight(fights)) != null){ - if(!BungeeCore.EVENT_MODE && Event.get(next.getEventID()).spectateSystem()) - break; //Don't start EventServer if not the event bungee - Team blue = Team.get(next.getTeamBlue()); Team red = Team.get(next.getTeamRed()); - ServerStarter starter = new ServerStarter().event(next); - ProxiedPlayer leiter = ProxyServer.getInstance().getPlayer(SteamwarUser.get(next.getKampfleiter()).getUuid()); - if(leiter != null) - starter.send(leiter); + //Don't start EventServer if not the event bungee + if(BungeeCore.EVENT_MODE || !Event.get(next.getEventID()).spectateSystem()) { + ServerStarter starter = new ServerStarter().event(next); - Subserver subserver = starter.start(); + ProxiedPlayer leiter = ProxyServer.getInstance().getPlayer(SteamwarUser.get(next.getKampfleiter()).getUuid()); + if(leiter != null) + starter.send(leiter); - eventServer.put(blue.getTeamId(), subserver); - eventServer.put(red.getTeamId(), subserver); - Message.broadcast("EVENT_FIGHT_BROADCAST", "EVENT_FIGHT_BROADCAST_HOVER", - new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/event " + blue.getTeamKuerzel()), blue.getTeamColor(), blue.getTeamName(), red.getTeamColor(), red.getTeamName()); + Subserver subserver = starter.start(); + + eventServer.put(blue.getTeamId(), subserver); + eventServer.put(red.getTeamId(), subserver); + Message.broadcast("EVENT_FIGHT_BROADCAST", "EVENT_FIGHT_BROADCAST_HOVER", + new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/event " + blue.getTeamKuerzel()), blue.getTeamColor(), blue.getTeamName(), red.getTeamColor(), red.getTeamName()); + } else { + Message.broadcast("EVENT_FIGHT_BROADCAST", "EVENT_FIGHT_BROADCAST_HOVER", + new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/spectate"), blue.getTeamColor(), blue.getTeamName(), red.getTeamColor(), red.getTeamName()); + } } }