diff --git a/CommonCore b/CommonCore index bfc72dd..a473e59 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit bfc72ddcb77199bbb8eb19bdfc50744f7234745a +Subproject commit a473e59048a73aae4b40ecb5d6d6b79f0791a138 diff --git a/src/de/steamwar/bungeecore/EventStarter.java b/src/de/steamwar/bungeecore/EventStarter.java index b2992f3..3a45996 100644 --- a/src/de/steamwar/bungeecore/EventStarter.java +++ b/src/de/steamwar/bungeecore/EventStarter.java @@ -20,12 +20,9 @@ package de.steamwar.bungeecore; import de.steamwar.sql.EventFight; -import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.Team; -import de.steamwar.sql.Event; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.chat.ClickEvent; -import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.scheduler.ScheduledTask; import java.sql.Timestamp; @@ -63,13 +60,9 @@ public class EventStarter implements Runnable { Team red = Team.get(next.getTeamRed()); //Don't start EventServer if not the event bungee - if(BungeeCore.EVENT_MODE || !Event.get(next.getEventID()).spectateSystem()) { + if(BungeeCore.EVENT_MODE || next.getSpectatePort() == 0) { ServerStarter starter = new ServerStarter().event(next); - ProxiedPlayer leiter = ProxyServer.getInstance().getPlayer(SteamwarUser.get(next.getKampfleiter()).getUUID()); - if(leiter != null) - starter.send(leiter); - starter.callback(subserver -> { eventServer.put(blue.getTeamId(), subserver); eventServer.put(red.getTeamId(), subserver); @@ -79,7 +72,7 @@ public class EventStarter implements Runnable { 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()); + new ClickEvent(ClickEvent.Action.RUN_COMMAND, next.getSpectatePort() == 2222 ? "/spectate" : "/spectate2"), blue.getTeamColor(), blue.getTeamName(), red.getTeamColor(), red.getTeamName()); } } } diff --git a/src/de/steamwar/bungeecore/listeners/EventModeListener.java b/src/de/steamwar/bungeecore/listeners/EventModeListener.java index 4d2b23f..c221dba 100644 --- a/src/de/steamwar/bungeecore/listeners/EventModeListener.java +++ b/src/de/steamwar/bungeecore/listeners/EventModeListener.java @@ -1,10 +1,7 @@ package de.steamwar.bungeecore.listeners; import de.steamwar.bungeecore.Message; -import de.steamwar.sql.EventFight; -import de.steamwar.sql.SteamwarUser; -import de.steamwar.sql.TeamTeilnahme; -import de.steamwar.sql.Event; +import de.steamwar.sql.*; import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.event.PostLoginEvent; import net.md_5.bungee.event.EventHandler; @@ -24,10 +21,8 @@ public class EventModeListener extends BasicListener { if(TeamTeilnahme.nimmtTeil(user.getTeam(), event.getEventID())) return; - for(EventFight eventFight : EventFight.getEvent(event.getEventID())){ - if(eventFight.getKampfleiter() == user.getId()) - return; - } + if(Referee.get(event.getEventID()).contains(user.getId())) + return; e.getPlayer().disconnect(TextComponent.fromLegacyText(Message.parse("EVENTMODE_KICK", e.getPlayer()))); }