From bad4efd52096c398dd5d23f1ee6ff3b085568d46 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 8 Jun 2022 13:28:56 +0200 Subject: [PATCH 1/2] Convert everything from waterfall to plain bungee --- CommonCore | 2 +- build.gradle | 2 +- .../steamwar/bungeecore/commands/TeamCommand.java | 14 ++++++++++++++ .../listeners/SubserverProtocolFixer.java | 7 ++++--- .../bungeecore/listeners/TablistManager.java | 2 +- 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/CommonCore b/CommonCore index 919c4d5..492894c 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit 919c4d525ea39756b24bd961bb72d8d58bdd5bd4 +Subproject commit 492894ca8d41ee0bde4dcb9d520db5f7478c50c7 diff --git a/build.gradle b/build.gradle index 7b1f796..44b7071 100644 --- a/build.gradle +++ b/build.gradle @@ -92,7 +92,7 @@ dependencies { annotationProcessor 'org.projectlombok:lombok:1.18.22' testAnnotationProcessor 'org.projectlombok:lombok:1.18.22' - compileOnly files("${projectDir}/lib/BungeeCord.jar") + compileOnly files("${projectDir}/lib/BungeeCord-Neu.jar") compileOnly files("${projectDir}/lib/PersistentBungeeCore.jar") compileOnly files("${projectDir}/lib/BungeeTabListPlus.jar") implementation("net.dv8tion:JDA:4.3.0_299") { diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index a6f4acc..f5aab33 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -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){ diff --git a/src/de/steamwar/bungeecore/listeners/SubserverProtocolFixer.java b/src/de/steamwar/bungeecore/listeners/SubserverProtocolFixer.java index 927d47c..ff74ed7 100644 --- a/src/de/steamwar/bungeecore/listeners/SubserverProtocolFixer.java +++ b/src/de/steamwar/bungeecore/listeners/SubserverProtocolFixer.java @@ -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); } diff --git a/src/de/steamwar/bungeecore/listeners/TablistManager.java b/src/de/steamwar/bungeecore/listeners/TablistManager.java index b7dd44b..6b9ea41 100644 --- a/src/de/steamwar/bungeecore/listeners/TablistManager.java +++ b/src/de/steamwar/bungeecore/listeners/TablistManager.java @@ -88,7 +88,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; From f63213c9aa43647eab219f1ebf692c274e867f79 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 8 Jun 2022 16:05:17 +0200 Subject: [PATCH 2/2] Fix build.gradle --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 44b7071..7b1f796 100644 --- a/build.gradle +++ b/build.gradle @@ -92,7 +92,7 @@ dependencies { annotationProcessor 'org.projectlombok:lombok:1.18.22' testAnnotationProcessor 'org.projectlombok:lombok:1.18.22' - compileOnly files("${projectDir}/lib/BungeeCord-Neu.jar") + compileOnly files("${projectDir}/lib/BungeeCord.jar") compileOnly files("${projectDir}/lib/PersistentBungeeCore.jar") compileOnly files("${projectDir}/lib/BungeeTabListPlus.jar") implementation("net.dv8tion:JDA:4.3.0_299") {