SteamWar/BungeeCore
Archiviert
13
2

Use new Referee table, Multi spectate server support
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2024-03-13 13:36:13 +01:00
Ursprung b852423442
Commit dd90ee1ced
3 geänderte Dateien mit 6 neuen und 18 gelöschten Zeilen

@ -1 +1 @@
Subproject commit bfc72ddcb77199bbb8eb19bdfc50744f7234745a Subproject commit a473e59048a73aae4b40ecb5d6d6b79f0791a138

Datei anzeigen

@ -20,12 +20,9 @@
package de.steamwar.bungeecore; package de.steamwar.bungeecore;
import de.steamwar.sql.EventFight; import de.steamwar.sql.EventFight;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.Team; import de.steamwar.sql.Team;
import de.steamwar.sql.Event;
import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.ClickEvent; 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 net.md_5.bungee.api.scheduler.ScheduledTask;
import java.sql.Timestamp; import java.sql.Timestamp;
@ -63,13 +60,9 @@ public class EventStarter implements Runnable {
Team red = Team.get(next.getTeamRed()); Team red = Team.get(next.getTeamRed());
//Don't start EventServer if not the event bungee //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); 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 -> { starter.callback(subserver -> {
eventServer.put(blue.getTeamId(), subserver); eventServer.put(blue.getTeamId(), subserver);
eventServer.put(red.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()); new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/event " + blue.getTeamKuerzel()), blue.getTeamColor(), blue.getTeamName(), red.getTeamColor(), red.getTeamName());
} else { } else {
Message.broadcast("EVENT_FIGHT_BROADCAST", "EVENT_FIGHT_BROADCAST_HOVER", 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());
} }
} }
} }

Datei anzeigen

@ -1,10 +1,7 @@
package de.steamwar.bungeecore.listeners; package de.steamwar.bungeecore.listeners;
import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.Message;
import de.steamwar.sql.EventFight; import de.steamwar.sql.*;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.TeamTeilnahme;
import de.steamwar.sql.Event;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.event.PostLoginEvent; import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.event.EventHandler; import net.md_5.bungee.event.EventHandler;
@ -24,10 +21,8 @@ public class EventModeListener extends BasicListener {
if(TeamTeilnahme.nimmtTeil(user.getTeam(), event.getEventID())) if(TeamTeilnahme.nimmtTeil(user.getTeam(), event.getEventID()))
return; return;
for(EventFight eventFight : EventFight.getEvent(event.getEventID())){ if(Referee.get(event.getEventID()).contains(user.getId()))
if(eventFight.getKampfleiter() == user.getId())
return; return;
}
e.getPlayer().disconnect(TextComponent.fromLegacyText(Message.parse("EVENTMODE_KICK", e.getPlayer()))); e.getPlayer().disconnect(TextComponent.fromLegacyText(Message.parse("EVENTMODE_KICK", e.getPlayer())));
} }