From 943988778521ca4a0449fd819605dc6a1fd44ac1 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 8 Jun 2022 13:18:24 +0200 Subject: [PATCH 1/6] Fix TablistManager for newer BTLP plugin --- CommonCore | 2 +- src/de/steamwar/bungeecore/listeners/TablistManager.java | 5 ++++- 2 files changed, 5 insertions(+), 2 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/src/de/steamwar/bungeecore/listeners/TablistManager.java b/src/de/steamwar/bungeecore/listeners/TablistManager.java index b7dd44b..6730c51 100644 --- a/src/de/steamwar/bungeecore/listeners/TablistManager.java +++ b/src/de/steamwar/bungeecore/listeners/TablistManager.java @@ -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,7 +49,9 @@ public class TablistManager extends BasicListener { @EventHandler public synchronized void onJoin(PostLoginEvent e){ - tablists.put(e.getPlayer(), new Tablist(e.getPlayer())); + BungeeCord.getInstance().getScheduler().schedule(BungeeCore.get(), () -> { + tablists.put(e.getPlayer(), new Tablist(e.getPlayer())); + }, 1, TimeUnit.SECONDS); } @EventHandler From bad4efd52096c398dd5d23f1ee6ff3b085568d46 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 8 Jun 2022 13:28:56 +0200 Subject: [PATCH 2/6] 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 3/6] 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") { From 6769fd88e7c0105a92d0da5527911bf8ed19fc86 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 8 Jun 2022 16:06:31 +0200 Subject: [PATCH 4/6] Fix TablistManager --- src/de/steamwar/bungeecore/listeners/TablistManager.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/listeners/TablistManager.java b/src/de/steamwar/bungeecore/listeners/TablistManager.java index 6730c51..48d9adb 100644 --- a/src/de/steamwar/bungeecore/listeners/TablistManager.java +++ b/src/de/steamwar/bungeecore/listeners/TablistManager.java @@ -50,7 +50,9 @@ public class TablistManager extends BasicListener { @EventHandler public synchronized void onJoin(PostLoginEvent e){ BungeeCord.getInstance().getScheduler().schedule(BungeeCore.get(), () -> { - tablists.put(e.getPlayer(), new Tablist(e.getPlayer())); + if (BungeeCord.getInstance().getPlayer(e.getPlayer().getUniqueId()) != null) { + tablists.put(e.getPlayer(), new Tablist(e.getPlayer())); + } }, 1, TimeUnit.SECONDS); } From 2f06ea374ec75e812a1555946c6efec8ac9b0726 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Wed, 8 Jun 2022 16:18:04 +0200 Subject: [PATCH 5/6] Simplify connection detection Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/listeners/TablistManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/listeners/TablistManager.java b/src/de/steamwar/bungeecore/listeners/TablistManager.java index 48d9adb..f2a76d5 100644 --- a/src/de/steamwar/bungeecore/listeners/TablistManager.java +++ b/src/de/steamwar/bungeecore/listeners/TablistManager.java @@ -50,7 +50,7 @@ public class TablistManager extends BasicListener { @EventHandler public synchronized void onJoin(PostLoginEvent e){ BungeeCord.getInstance().getScheduler().schedule(BungeeCore.get(), () -> { - if (BungeeCord.getInstance().getPlayer(e.getPlayer().getUniqueId()) != null) { + if (e.getPlayer().isConnected()) { tablists.put(e.getPlayer(), new Tablist(e.getPlayer())); } }, 1, TimeUnit.SECONDS); From 01ea928652bc619f654087006593a3a4e6bd76f1 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 10 Jun 2022 19:30:15 +0200 Subject: [PATCH 6/6] 1.19 Build server Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/ServerStarter.java | 10 +++++----- src/de/steamwar/bungeecore/commands/BauCommand.java | 12 +++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/de/steamwar/bungeecore/ServerStarter.java b/src/de/steamwar/bungeecore/ServerStarter.java index 36ccac6..35a97dd 100644 --- a/src/de/steamwar/bungeecore/ServerStarter.java +++ b/src/de/steamwar/bungeecore/ServerStarter.java @@ -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; diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index 4840915..ea21cd9 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -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)));