SteamWar/BungeeCore
Archiviert
13
2

Merge remote-tracking branch 'origin/master'
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2022-06-12 18:17:51 +02:00
Commit 8267966409
6 geänderte Dateien mit 38 neuen und 16 gelöschten Zeilen

@ -1 +1 @@
Subproject commit 919c4d525ea39756b24bd961bb72d8d58bdd5bd4
Subproject commit 492894ca8d41ee0bde4dcb9d520db5f7478c50c7

Datei anzeigen

@ -26,7 +26,7 @@ public class ServerStarter {
private static final String EVENT_PATH = BACKBONE + "event/";
public static final String TEMP_WORLD_PATH = BACKBONE + "arenaserver/";
public static final String TUTORIAL_PATH = BACKBONE + "tutorials/";
public static final String WORLDS18_PATH = BACKBONE + "userworlds18/";
public static final String WORLDS19_PATH = BACKBONE + "userworlds19/";
private File directory = null;
private String worldDir = null;
@ -109,10 +109,10 @@ public class ServerStarter {
return this;
}
public ServerStarter build18(UUID owner) {
directory = new File(SERVER_PATH, "Bau18");
serverJar = "paper-1.18.2.jar";
worldDir = WORLDS18_PATH;
public ServerStarter build19(UUID owner) {
directory = new File(SERVER_PATH, "Bau19");
serverJar = "paper-1.19.jar";
worldDir = WORLDS19_PATH;
worldName = String.valueOf(SteamwarUser.get(owner).getId());
buildWithWorld(owner, new File(directory, "Bauwelt").getPath());
return this;

Datei anzeigen

@ -46,7 +46,7 @@ public class BauCommand extends BasicCommand {
ProxiedPlayer p = (ProxiedPlayer) sender;
versionSelector(p, args, 0,
() -> new ServerStarter().build18(p.getUniqueId()).send(p).start(),
() -> new ServerStarter().build19(p.getUniqueId()).send(p).start(),
() -> new ServerStarter().build15(p.getUniqueId()).send(p).start(),
() -> new ServerStarter().build12(p.getUniqueId()).send(p).start(),
() -> {
@ -128,13 +128,13 @@ public class BauCommand extends BasicCommand {
}
versionSelector(p, args, 2,
() -> new ServerStarter().build18(worldOwner.getUuid()).send(p).start(),
() -> new ServerStarter().build19(worldOwner.getUuid()).send(p).start(),
() -> new ServerStarter().build15(worldOwner.getUuid()).send(p).start(),
() -> new ServerStarter().build12(worldOwner.getUuid()).send(p).start(),
() -> HelpCommand.sendBauHelp(ChatSender.of(p)));
}
private static void versionSelector(ProxiedPlayer p, String[] args, int pos, Runnable run18, Runnable run15, Runnable run12, Runnable runElse) {
private static void versionSelector(ProxiedPlayer p, String[] args, int pos, Runnable run19, Runnable run15, Runnable run12, Runnable runElse) {
if(args.length <= pos) {
int version = p.getPendingConnection().getVersion();
if(version > 340) { // Version > 1.12.2
@ -146,9 +146,11 @@ public class BauCommand extends BasicCommand {
}
switch (args[pos].toLowerCase()) {
case "19":
case "1.19":
case "18":
case "1.18":
run18.run();
run19.run();
break;
case "ws":
case "warship":
@ -231,7 +233,7 @@ public class BauCommand extends BasicCommand {
private static void delete(ProxiedPlayer p, String[] args){
SteamwarUser user = SteamwarUser.get(p.getUniqueId());
versionSelector(p, args, 1,
() -> deleteConfirmation(p, () -> deleteWorld(p, ServerStarter.WORLDS18_PATH + user.getId())),
() -> deleteConfirmation(p, () -> deleteWorld(p, ServerStarter.WORLDS19_PATH + user.getId())),
() -> deleteConfirmation(p, () -> deleteWorld(p, BungeeCore.USERWORLDS15 + user.getId())),
() -> deleteConfirmation(p, () -> deleteWorld(p, BungeeCore.WORLD_FOLDER + p.getUniqueId().toString())),
() -> HelpCommand.sendBauHelp(ChatSender.of(p)));

Datei anzeigen

@ -31,6 +31,7 @@ import net.md_5.bungee.UserConnection;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.ServerConnectRequest;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
@ -595,11 +596,24 @@ public class TeamCommand extends BasicCommand {
ProxyServer.getInstance().getServers().put(info.getName(), info);
return info;
});
player.connect(ServerConnectRequest.builder()
.target(serverInfo)
.connectTimeout(BungeeCord.getInstance().getConfig().getServerConnectTimeout())
.retry(false)
.reason(ServerConnectEvent.Reason.PLUGIN)
.callback((success, error) -> {
if (error != null) {
Message.send("TEAM_OFFLINE", player);
}
})
.build());
/*
((UserConnection) player).connect(serverInfo, (success, error) -> {
if (error != null) {
Message.send("TEAM_OFFLINE", player);
}
}, false, ServerConnectEvent.Reason.PLUGIN, BungeeCord.getInstance().getConfig().getServerConnectTimeout(), false);
*/
}
private void server(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){

Datei anzeigen

@ -19,12 +19,12 @@
package de.steamwar.bungeecore.listeners;
import io.github.waterfallmc.waterfall.utils.UUIDUtils;
import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.api.event.LoginEvent;
import net.md_5.bungee.connection.InitialHandler;
import net.md_5.bungee.connection.LoginResult;
import net.md_5.bungee.event.EventHandler;
import net.md_5.bungee.protocol.Property;
import net.md_5.bungee.util.AddressUtil;
import java.lang.reflect.Field;
@ -50,11 +50,12 @@ public class SubserverProtocolFixer extends BasicListener {
public void loginEvent(LoginEvent e) {
InitialHandler initialHandler = ((InitialHandler) e.getConnection());
String extraData = "\00" + AddressUtil.sanitizeAddress(inetSocketAddress) + "\00" + UUIDUtils.undash(initialHandler.getUniqueId().toString());
String undashedUUID = initialHandler.getUniqueId().toString().replace("-", "");
String extraData = "\00" + AddressUtil.sanitizeAddress(inetSocketAddress) + "\00" + undashedUUID;
LoginResult result = initialHandler.getLoginProfile();
if (result != null) {
LoginResult.Property[] properties = result.getProperties();
Property[] properties = result.getProperties();
if (properties.length > 0) {
extraData += "\00" + BungeeCord.getInstance().gson.toJson(properties);
}

Datei anzeigen

@ -29,6 +29,7 @@ import de.steamwar.bungeecore.Subserver;
import de.steamwar.bungeecore.comms.packets.FightInfoPacket;
import de.steamwar.bungeecore.sql.SteamwarUser;
import de.steamwar.bungeecore.sql.UserGroup;
import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -48,8 +49,12 @@ public class TablistManager extends BasicListener {
@EventHandler
public synchronized void onJoin(PostLoginEvent e){
BungeeCord.getInstance().getScheduler().schedule(BungeeCore.get(), () -> {
if (e.getPlayer().isConnected()) {
tablists.put(e.getPlayer(), new Tablist(e.getPlayer()));
}
}, 1, TimeUnit.SECONDS);
}
@EventHandler
public synchronized void onLeave(PlayerDisconnectEvent e){
@ -88,7 +93,7 @@ public class TablistManager extends BasicListener {
//Calculate server-player-map
tablist = new TablistGroup(true, "");
TablistGroup bau = new TablistGroup(false, "Bau");
for (ServerInfo server : ProxyServer.getInstance().getServersCopy().values()){
for (ServerInfo server : new ArrayList<>(ProxyServer.getInstance().getServers().values())){
if(server.getPlayers().isEmpty())
continue;