SteamWar/BungeeCore
Archiviert
13
2

Merge branch 'master' into Ranked
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Lixfel 2022-03-13 09:09:56 +01:00
Commit 24b249acf7
13 geänderte Dateien mit 57 neuen und 20 gelöschten Zeilen

Datei anzeigen

@ -69,7 +69,7 @@ public class EventStarter implements Runnable {
ProxiedPlayer leiter = ProxyServer.getInstance().getPlayer(SteamwarUser.get(next.getKampfleiter()).getUuid()); ProxiedPlayer leiter = ProxyServer.getInstance().getPlayer(SteamwarUser.get(next.getKampfleiter()).getUuid());
if(leiter != null) if(leiter != null)
subserver.sendPlayer(leiter); SubserverSystem.sendPlayer(subserver, leiter);
eventServer.put(blue.getTeamId(), subserver); eventServer.put(blue.getTeamId(), subserver);
eventServer.put(red.getTeamId(), subserver); eventServer.put(red.getTeamId(), subserver);

Datei anzeigen

@ -19,6 +19,8 @@
package de.steamwar.bungeecore; 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.EventFight;
import de.steamwar.bungeecore.sql.IgnoreSystem; import de.steamwar.bungeecore.sql.IgnoreSystem;
import de.steamwar.bungeecore.sql.SteamwarUser; 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){ 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){ 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(); Node node = Node.getNode();
int port = bauPorts.freePort(); 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 serverJar, directory, worldDir, worldName, port, xmx, "logPath=" + worldName
), () -> {}).sendPlayer(p); ), () -> {}), p);
} }
public static void sendToBauServer(ProxiedPlayer p, UUID owner){ 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())); 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(SteamwarUser.get(player.getUniqueId())).send(player);
}
private static boolean bauRunning(ProxiedPlayer p, UUID owner){ private static boolean bauRunning(ProxiedPlayer p, UUID owner){
for(Subserver subserver : Subserver.getServerList()){ for(Subserver subserver : Subserver.getServerList()){
if(subserver.getType() == Servertype.BAUSERVER && ((Bauserver)subserver).getOwner().equals(owner)){ if(subserver.getType() == Servertype.BAUSERVER && ((Bauserver)subserver).getOwner().equals(owner)){
subserver.sendPlayer(p); sendPlayer(subserver, p);
return true; return true;
} }
} }

Datei anzeigen

@ -22,6 +22,7 @@ package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.Servertype; import de.steamwar.bungeecore.Servertype;
import de.steamwar.bungeecore.Subserver; import de.steamwar.bungeecore.Subserver;
import de.steamwar.bungeecore.SubserverSystem;
import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.config.ServerInfo;
@ -51,6 +52,6 @@ public class ArenaCommand extends BasicCommand {
return; return;
} }
subserver.sendPlayer(player); SubserverSystem.sendPlayer(subserver, player);
} }
} }

Datei anzeigen

@ -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()); Subserver arena = SubserverSystem.startArena(mode, map, 0, 0, 0, 0, null, null, player.getUniqueId(), target.getUniqueId());
arena.sendPlayer(player); SubserverSystem.sendPlayer(arena, player);
arena.sendPlayer(target); SubserverSystem.sendPlayer(arena, target);
Message.broadcast("CHALLENGE_BROADCAST", "CHALLENGE_BROADCAST_HOVER", Message.broadcast("CHALLENGE_BROADCAST", "CHALLENGE_BROADCAST_HOVER",
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/arena " + arena.getServer().getName()), mode.getDisplayName(), player.getName(), target.getName()); new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/arena " + arena.getServer().getName()), mode.getDisplayName(), player.getName(), target.getName());

Datei anzeigen

@ -19,10 +19,7 @@
package de.steamwar.bungeecore.commands; package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.*;
import de.steamwar.bungeecore.EventStarter;
import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.Subserver;
import de.steamwar.bungeecore.sql.Event; import de.steamwar.bungeecore.sql.Event;
import de.steamwar.bungeecore.sql.EventFight; import de.steamwar.bungeecore.sql.EventFight;
import de.steamwar.bungeecore.sql.Team; import de.steamwar.bungeecore.sql.Team;
@ -72,7 +69,7 @@ public class EventCommand extends BasicCommand {
return; return;
} }
eventArena.sendPlayer(player); SubserverSystem.sendPlayer(eventArena, player);
} }
private void noCurrentEvent(ProxiedPlayer player){ private void noCurrentEvent(ProxiedPlayer player){

Datei anzeigen

@ -165,7 +165,7 @@ public class FightCommand extends BasicCommand {
public void execute(CommandSender sender, String[] args) { public void execute(CommandSender sender, String[] args) {
createArena(sender, "/fight ", args, 0, false, (player, mode, map) -> { createArena(sender, "/fight ", args, 0, false, (player, mode, map) -> {
Subserver arena = SubserverSystem.startArena(mode, map, 0, 0, 0, 0, null, null, player.getUniqueId(), null); 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" Message.broadcast("FIGHT_BROADCAST", "FIGHT_BROADCAST_HOVER"
, new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/arena " + arena.getServer().getName()), mode.getDisplayName(), player.getName()); , new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/arena " + arena.getServer().getName()), mode.getDisplayName(), player.getName());
}); });

Datei anzeigen

@ -37,7 +37,7 @@ public class HistoricCommand extends BasicCommand {
public void execute(CommandSender sender, String[] args) { public void execute(CommandSender sender, String[] args) {
FightCommand.createArena(sender, "/historic ", args, 0, true, (player, mode, map) -> { 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); 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" Message.broadcast("HISTORIC_BROADCAST", "HISTORIC_BROADCAST_HOVER"
, new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/arena " + arena.getServer().getName()), mode.getDisplayName(), player.getName()); , new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/arena " + arena.getServer().getName()), mode.getDisplayName(), player.getName());
}); });

Datei anzeigen

@ -59,12 +59,12 @@ public class JoinmeCommand extends BasicCommand {
if(subserver != null) { if(subserver != null) {
Servertype type = subserver.getType(); Servertype type = subserver.getType();
if (type == Servertype.ARENA) { if (type == Servertype.ARENA) {
subserver.sendPlayer(player); SubserverSystem.sendPlayer(subserver, player);
} else if (type == Servertype.BAUSERVER) { } else if (type == Servertype.BAUSERVER) {
Bauserver bauserver = (Bauserver) subserver; Bauserver bauserver = (Bauserver) subserver;
if (bauserver.getOwner().equals(player.getUniqueId()) || if (bauserver.getOwner().equals(player.getUniqueId()) ||
BauweltMember.getBauMember(bauserver.getOwner(), player.getUniqueId()) != null) { BauweltMember.getBauMember(bauserver.getOwner(), player.getUniqueId()) != null) {
subserver.sendPlayer(player); SubserverSystem.sendPlayer(subserver, player);
} else { } else {
SubserverSystem.sendDeniedMessage(player, bauserver.getOwner()); SubserverSystem.sendDeniedMessage(player, bauserver.getOwner());
Message.send("JOIN_PLAYER_BLOCK", player); Message.send("JOIN_PLAYER_BLOCK", player);

Datei anzeigen

@ -35,7 +35,7 @@ public class ReplayCommand extends BasicCommand {
} }
ArenaMode mode = fight.getGameMode(); 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(); }, page -> Fight.getPage(page, 45).stream().map(fight -> new SWListInv.SWListEntry<>(getFightItem(player, fight), fight)).collect(Collectors.toList())).open();
} }

Datei anzeigen

@ -118,12 +118,12 @@ public class TpCommand extends BasicCommand {
if(subserver != null) { if(subserver != null) {
Servertype type = subserver.getType(); Servertype type = subserver.getType();
if (type == Servertype.ARENA) { if (type == Servertype.ARENA) {
subserver.sendPlayer(player); SubserverSystem.sendPlayer(subserver, player);
} else if (type == Servertype.BAUSERVER) { } else if (type == Servertype.BAUSERVER) {
Bauserver bauserver = (Bauserver) subserver; Bauserver bauserver = (Bauserver) subserver;
if (bauserver.getOwner().equals(player.getUniqueId()) || if (bauserver.getOwner().equals(player.getUniqueId()) ||
BauweltMember.getBauMember(bauserver.getOwner(), player.getUniqueId()) != null) { BauweltMember.getBauMember(bauserver.getOwner(), player.getUniqueId()) != null) {
subserver.sendPlayer(player); SubserverSystem.sendPlayer(subserver, player);
} else { } else {
SubserverSystem.sendDeniedMessage(player, bauserver.getOwner()); SubserverSystem.sendDeniedMessage(player, bauserver.getOwner());
Message.send("JOIN_PLAYER_BLOCK", player); Message.send("JOIN_PLAYER_BLOCK", player);

Datei anzeigen

@ -37,4 +37,5 @@ public class PacketIdManager {
public static final byte I_AM_A_LOBBY = 0x20; public static final byte I_AM_A_LOBBY = 0x20;
public static final byte FIGHT_INFO = 0x21; public static final byte FIGHT_INFO = 0x21;
public static final byte FIGHT_ENDS = 0x22; public static final byte FIGHT_ENDS = 0x22;
public static final byte STARTING_SERVER = 0x23;
} }

Datei anzeigen

@ -38,6 +38,10 @@ public class FightInfoHandler implements SpigotHandler {
lobbys.add(lobby); lobbys.add(lobby);
} }
public static boolean onLobby(ProxiedPlayer player) {
return lobbys.contains(player.getServer().getInfo());
}
@Override @Override
public void handle(ByteArrayDataInput in, ServerInfo info) { public void handle(ByteArrayDataInput in, ServerInfo info) {
FightInfoPacket packet = new FightInfoPacket(in); FightInfoPacket packet = new FightInfoPacket(in);

Datei anzeigen

@ -0,0 +1,25 @@
package de.steamwar.bungeecore.comms.packets;
import com.google.common.io.ByteArrayDataOutput;
import de.steamwar.bungeecore.comms.BungeePacket;
import de.steamwar.bungeecore.comms.PacketIdManager;
import de.steamwar.bungeecore.sql.SteamwarUser;
public class StartingServerPacket extends BungeePacket {
private final int user;
public StartingServerPacket(SteamwarUser user) {
this.user = user.getId();
}
@Override
public int getId() {
return PacketIdManager.STARTING_SERVER;
}
@Override
public void writeVars(ByteArrayDataOutput out) {
out.writeInt(user);
}
}