Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
dd90ee1ced
Commit
628e7b093c
@ -312,6 +312,10 @@ public class BungeeCore extends Plugin {
|
|||||||
final Configuration server = servers.getSection(serverName);
|
final Configuration server = servers.getSection(serverName);
|
||||||
List<String> cmds = server.getStringList("commands");
|
List<String> cmds = server.getStringList("commands");
|
||||||
String cmd = cmds.remove(0);
|
String cmd = cmds.remove(0);
|
||||||
|
|
||||||
|
if(server.contains("spectatePort"))
|
||||||
|
EventStarter.addSpectateServer(server.getInt("spectatePort"), cmd);
|
||||||
|
|
||||||
new ServerSwitchCommand(
|
new ServerSwitchCommand(
|
||||||
cmd,
|
cmd,
|
||||||
serverName,
|
serverName,
|
||||||
|
@ -23,34 +23,33 @@ import de.steamwar.sql.EventFight;
|
|||||||
import de.steamwar.sql.Team;
|
import de.steamwar.sql.Team;
|
||||||
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.scheduler.ScheduledTask;
|
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static de.steamwar.bungeecore.Storage.eventServer;
|
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();
|
EventFight.loadAllComingFights();
|
||||||
|
ProxyServer.getInstance().getScheduler().schedule(BungeeCore.get(), this::run, 1, 10, TimeUnit.SECONDS);
|
||||||
if(task != null)
|
|
||||||
task.cancel();
|
|
||||||
|
|
||||||
ProxyServer.getInstance().getScheduler().schedule(BungeeCore.get(), this, 1, 10, TimeUnit.SECONDS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<Integer, Subserver> getEventServer() {
|
public static Map<Integer, Subserver> getEventServer() {
|
||||||
return eventServer;
|
return eventServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void run() {
|
||||||
public void run() {
|
|
||||||
eventServer.entrySet().removeIf(entry -> Subserver.getSubserver(entry.getValue().getServer()) == null);
|
eventServer.entrySet().removeIf(entry -> Subserver.getSubserver(entry.getValue().getServer()) == null);
|
||||||
Queue<EventFight> fights = EventFight.getFights();
|
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());
|
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, 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