Use new Referee table, Multi spectate server support #510
@ -312,6 +312,10 @@ public class BungeeCore extends Plugin {
|
||||
final Configuration server = servers.getSection(serverName);
|
||||
List<String> cmds = server.getStringList("commands");
|
||||
String cmd = cmds.remove(0);
|
||||
|
||||
if(server.contains("spectatePort"))
|
||||
EventStarter.addSpectateServer(server.getInt("spectatePort"), cmd);
|
||||
|
||||
new ServerSwitchCommand(
|
||||
cmd,
|
||||
serverName,
|
||||
|
@ -23,34 +23,33 @@ import de.steamwar.sql.EventFight;
|
||||
import de.steamwar.sql.Team;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.scheduler.ScheduledTask;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static de.steamwar.bungeecore.Storage.eventServer;
|
||||
|
||||
public class EventStarter implements Runnable {
|
||||
public class EventStarter {
|
||||
|
||||
private static ScheduledTask task = null;
|
||||
private static final Map<Integer, String> spectatePorts = new HashMap<>();
|
||||
|
||||
EventStarter(){
|
||||
public static void addSpectateServer(int port, String command) {
|
||||
spectatePorts.put(port, command);
|
||||
}
|
||||
|
||||
public EventStarter() {
|
||||
EventFight.loadAllComingFights();
|
||||
|
||||
if(task != null)
|
||||
task.cancel();
|
||||
|
||||
ProxyServer.getInstance().getScheduler().schedule(BungeeCore.get(), this, 1, 10, TimeUnit.SECONDS);
|
||||
ProxyServer.getInstance().getScheduler().schedule(BungeeCore.get(), this::run, 1, 10, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public static Map<Integer, Subserver> getEventServer() {
|
||||
return eventServer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
private void run() {
|
||||
eventServer.entrySet().removeIf(entry -> Subserver.getSubserver(entry.getValue().getServer()) == null);
|
||||
Queue<EventFight> fights = EventFight.getFights();
|
||||
|
||||
@ -72,7 +71,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, next.getSpectatePort() == 2222 ? "/spectate" : "/spectate2"), blue.getTeamColor(), blue.getTeamName(), red.getTeamColor(), red.getTeamName());
|
||||
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/" + spectatePorts.get(next.getSpectatePort())), blue.getTeamColor(), blue.getTeamName(), red.getTeamColor(), red.getTeamName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren