Send subserver start packet on lobby #308
@ -69,7 +69,7 @@ public class EventStarter implements Runnable {
|
||||
|
||||
ProxiedPlayer leiter = ProxyServer.getInstance().getPlayer(SteamwarUser.get(next.getKampfleiter()).getUuid());
|
||||
if(leiter != null)
|
||||
subserver.sendPlayer(leiter);
|
||||
SubserverSystem.sendPlayer(subserver, leiter);
|
||||
|
||||
eventServer.put(blue.getTeamId(), subserver);
|
||||
eventServer.put(red.getTeamId(), subserver);
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
package de.steamwar.bungeecore;
|
||||
|
||||
import de.steamwar.bungeecore.comms.handlers.FightInfoHandler;
|
||||
import de.steamwar.bungeecore.comms.packets.StartingServerPacket;
|
||||
import de.steamwar.bungeecore.sql.EventFight;
|
||||
import de.steamwar.bungeecore.sql.IgnoreSystem;
|
||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||
@ -142,7 +144,7 @@ public class SubserverSystem {
|
||||
}
|
||||
|
||||
public static void startTestServer(ProxiedPlayer p, ArenaMode m, String map, int checkSchemId, int prepareSchemId){
|
||||
startArena(m, map, -1, checkSchemId, prepareSchemId, 0, p.getName() + "s Bau", p.getName(), p.getUniqueId(), null).sendPlayer(p);
|
||||
sendPlayer(startArena(m, map, -1, checkSchemId, prepareSchemId, 0, p.getName() + "s Bau", p.getName(), p.getUniqueId(), null), p);
|
||||
}
|
||||
|
||||
private static synchronized void sendToBau(ProxiedPlayer p, UUID owner, String prototype, String worldFolder, String serverJar, String worldDir, String worldName, String xmx, String serverName){
|
||||
@ -155,9 +157,10 @@ public class SubserverSystem {
|
||||
Node node = Node.getNode();
|
||||
int port = bauPorts.freePort();
|
||||
|
||||
new Bauserver(user.getUserName() + "s Bau", owner, port, node.startServer(
|
||||
|
||||
sendPlayer(new Bauserver(user.getUserName() + "s Bau", owner, port, node.startServer(
|
||||
serverJar, directory, worldDir, worldName, port, xmx, "logPath=" + worldName
|
||||
), () -> {}).sendPlayer(p);
|
||||
), () -> {}), p);
|
||||
}
|
||||
|
||||
public static void sendToBauServer(ProxiedPlayer p, UUID owner){
|
||||
@ -183,10 +186,16 @@ public class SubserverSystem {
|
||||
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/bau addmember " + p.getName()));
|
||||
}
|
||||
|
||||
public static void sendPlayer(Subserver subserver, ProxiedPlayer player) {
|
||||
subserver.sendPlayer(player);
|
||||
if(!subserver.hasStarted() && FightInfoHandler.onLobby(player))
|
||||
new StartingServerPacket().send(player);
|
||||
}
|
||||
|
||||
private static boolean bauRunning(ProxiedPlayer p, UUID owner){
|
||||
for(Subserver subserver : Subserver.getServerList()){
|
||||
if(subserver.getType() == Servertype.BAUSERVER && ((Bauserver)subserver).getOwner().equals(owner)){
|
||||
subserver.sendPlayer(p);
|
||||
sendPlayer(subserver, p);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ package de.steamwar.bungeecore.commands;
|
||||
import de.steamwar.bungeecore.Message;
|
||||
import de.steamwar.bungeecore.Servertype;
|
||||
import de.steamwar.bungeecore.Subserver;
|
||||
import de.steamwar.bungeecore.SubserverSystem;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
@ -51,6 +52,6 @@ public class ArenaCommand extends BasicCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
subserver.sendPlayer(player);
|
||||
SubserverSystem.sendPlayer(subserver, player);
|
||||
}
|
||||
}
|
||||
|
@ -78,8 +78,8 @@ public class ChallengeCommand extends BasicCommand {
|
||||
|
||||
Subserver arena = SubserverSystem.startArena(mode, map, 0, 0, 0, 0, null, null, player.getUniqueId(), target.getUniqueId());
|
||||
|
||||
arena.sendPlayer(player);
|
||||
arena.sendPlayer(target);
|
||||
SubserverSystem.sendPlayer(arena, player);
|
||||
SubserverSystem.sendPlayer(arena, target);
|
||||
|
||||
Message.broadcast("CHALLENGE_BROADCAST", "CHALLENGE_BROADCAST_HOVER",
|
||||
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/arena " + arena.getServer().getName()), mode.getDisplayName(), player.getName(), target.getName());
|
||||
|
@ -19,10 +19,7 @@
|
||||
|
||||
package de.steamwar.bungeecore.commands;
|
||||
|
||||
import de.steamwar.bungeecore.BungeeCore;
|
||||
import de.steamwar.bungeecore.EventStarter;
|
||||
import de.steamwar.bungeecore.Message;
|
||||
import de.steamwar.bungeecore.Subserver;
|
||||
import de.steamwar.bungeecore.*;
|
||||
import de.steamwar.bungeecore.sql.Event;
|
||||
import de.steamwar.bungeecore.sql.EventFight;
|
||||
import de.steamwar.bungeecore.sql.Team;
|
||||
@ -72,7 +69,7 @@ public class EventCommand extends BasicCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
eventArena.sendPlayer(player);
|
||||
SubserverSystem.sendPlayer(eventArena, player);
|
||||
}
|
||||
|
||||
private void noCurrentEvent(ProxiedPlayer player){
|
||||
|
@ -165,7 +165,7 @@ public class FightCommand extends BasicCommand {
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
createArena(sender, "/fight ", args, 0, false, (player, mode, map) -> {
|
||||
Subserver arena = SubserverSystem.startArena(mode, map, 0, 0, 0, 0, null, null, player.getUniqueId(), null);
|
||||
arena.sendPlayer(player);
|
||||
SubserverSystem.sendPlayer(arena, player);
|
||||
Message.broadcast("FIGHT_BROADCAST", "FIGHT_BROADCAST_HOVER"
|
||||
, new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/arena " + arena.getServer().getName()), mode.getDisplayName(), player.getName());
|
||||
});
|
||||
|
@ -37,7 +37,7 @@ public class HistoricCommand extends BasicCommand {
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
FightCommand.createArena(sender, "/historic ", args, 0, true, (player, mode, map) -> {
|
||||
Subserver arena = SubserverSystem.startArena(mode, map, 0, 0, 0, 0, null, null, player.getUniqueId(), null);
|
||||
arena.sendPlayer(player);
|
||||
SubserverSystem.sendPlayer(arena, player);
|
||||
Message.broadcast("HISTORIC_BROADCAST", "HISTORIC_BROADCAST_HOVER"
|
||||
, new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/arena " + arena.getServer().getName()), mode.getDisplayName(), player.getName());
|
||||
});
|
||||
|
@ -59,12 +59,12 @@ public class JoinmeCommand extends BasicCommand {
|
||||
if(subserver != null) {
|
||||
Servertype type = subserver.getType();
|
||||
if (type == Servertype.ARENA) {
|
||||
subserver.sendPlayer(player);
|
||||
SubserverSystem.sendPlayer(subserver, player);
|
||||
} else if (type == Servertype.BAUSERVER) {
|
||||
Bauserver bauserver = (Bauserver) subserver;
|
||||
if (bauserver.getOwner().equals(player.getUniqueId()) ||
|
||||
BauweltMember.getBauMember(bauserver.getOwner(), player.getUniqueId()) != null) {
|
||||
subserver.sendPlayer(player);
|
||||
SubserverSystem.sendPlayer(subserver, player);
|
||||
} else {
|
||||
SubserverSystem.sendDeniedMessage(player, bauserver.getOwner());
|
||||
Message.send("JOIN_PLAYER_BLOCK", player);
|
||||
|
@ -35,7 +35,7 @@ public class ReplayCommand extends BasicCommand {
|
||||
}
|
||||
ArenaMode mode = fight.getGameMode();
|
||||
|
||||
SubserverSystem.startArena(mode, mode.getRandomMap(), 0, 0, 0, fight.getFightID(), null, null, null, null).sendPlayer(player);
|
||||
SubserverSystem.sendPlayer(SubserverSystem.startArena(mode, mode.getRandomMap(), 0, 0, 0, fight.getFightID(), null, null, null, null), player);
|
||||
}, page -> Fight.getPage(page, 45).stream().map(fight -> new SWListInv.SWListEntry<>(getFightItem(player, fight), fight)).collect(Collectors.toList())).open();
|
||||
}
|
||||
|
||||
|
@ -118,12 +118,12 @@ public class TpCommand extends BasicCommand {
|
||||
if(subserver != null) {
|
||||
Servertype type = subserver.getType();
|
||||
if (type == Servertype.ARENA) {
|
||||
subserver.sendPlayer(player);
|
||||
SubserverSystem.sendPlayer(subserver, player);
|
||||
} else if (type == Servertype.BAUSERVER) {
|
||||
Bauserver bauserver = (Bauserver) subserver;
|
||||
if (bauserver.getOwner().equals(player.getUniqueId()) ||
|
||||
BauweltMember.getBauMember(bauserver.getOwner(), player.getUniqueId()) != null) {
|
||||
subserver.sendPlayer(player);
|
||||
SubserverSystem.sendPlayer(subserver, player);
|
||||
} else {
|
||||
SubserverSystem.sendDeniedMessage(player, bauserver.getOwner());
|
||||
Message.send("JOIN_PLAYER_BLOCK", player);
|
||||
|
@ -37,4 +37,5 @@ public class PacketIdManager {
|
||||
public static final byte I_AM_A_LOBBY = 0x20;
|
||||
public static final byte FIGHT_INFO = 0x21;
|
||||
public static final byte FIGHT_ENDS = 0x22;
|
||||
public static final byte STARTING_SERVER = 0x23;
|
||||
}
|
||||
|
@ -38,6 +38,10 @@ public class FightInfoHandler implements SpigotHandler {
|
||||
lobbys.add(lobby);
|
||||
}
|
||||
|
||||
public static boolean onLobby(ProxiedPlayer player) {
|
||||
return lobbys.contains(player.getServer().getInfo());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(ByteArrayDataInput in, ServerInfo info) {
|
||||
FightInfoPacket packet = new FightInfoPacket(in);
|
||||
|
18
src/de/steamwar/bungeecore/comms/packets/StartingServerPacket.java
Normale Datei
18
src/de/steamwar/bungeecore/comms/packets/StartingServerPacket.java
Normale Datei
@ -0,0 +1,18 @@
|
||||
package de.steamwar.bungeecore.comms.packets;
|
||||
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import de.steamwar.bungeecore.comms.BungeePacket;
|
||||
import de.steamwar.bungeecore.comms.PacketIdManager;
|
||||
|
||||
public class StartingServerPacket extends BungeePacket {
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return PacketIdManager.STARTING_SERVER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeVars(ByteArrayDataOutput byteArrayDataOutput) {
|
||||
//nothing to write
|
||||
}
|
||||
}
|
In neuem Issue referenzieren
Einen Benutzer sperren