From e6f2fb48e557047e86f8f9fb6b9f42387877f1e3 Mon Sep 17 00:00:00 2001 From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> Date: Sun, 20 Jul 2025 16:12:09 +0300 Subject: [PATCH] Fire ServerListPingEvent for secondary motd send --- ...rverListPingEvent-for-secondary-motd.patch | 32 ++++++++++++ ...rverListPingEvent-for-secondary-motd.patch | 50 +++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 divinemc-server/minecraft-patches/features/0067-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch create mode 100644 divinemc-server/paper-patches/features/0020-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch diff --git a/divinemc-server/minecraft-patches/features/0067-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch b/divinemc-server/minecraft-patches/features/0067-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch new file mode 100644 index 0000000..992853c --- /dev/null +++ b/divinemc-server/minecraft-patches/features/0067-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> +Date: Sun, 20 Jul 2025 16:09:38 +0300 +Subject: [PATCH] Paper PR: Fire ServerListPingEvent for secondary motd send + +Original license: GPLv3 +Original project: https://github.com/PaperMC/Paper +Paper pull request: https://github.com/PaperMC/Paper/pull/8074 + +diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java +index b59078273bb6214295a448d5607538557d7eb1ee..c097afcdece95e33486c833063dc2aed159d93f7 100644 +--- a/net/minecraft/server/players/PlayerList.java ++++ b/net/minecraft/server/players/PlayerList.java +@@ -304,10 +304,15 @@ public abstract class PlayerList { + mutableComponent.withStyle(ChatFormatting.YELLOW); + Component joinMessage = mutableComponent; // Paper - Adventure + serverGamePacketListenerImpl.teleport(player.getX(), player.getY(), player.getZ(), player.getYRot(), player.getXRot()); +- ServerStatus status = this.server.getStatus(); +- if (status != null && !cookie.transferred()) { +- player.sendServerStatus(status); ++ // DivineMC start - Paper PR: Fire ServerListPingEvent for secondary motd send ++ if (!cookie.transferred()) { ++ io.papermc.paper.util.MCUtil.scheduleAsyncTask(() -> { ++ if (player.hasDisconnected()) return; ++ net.minecraft.network.protocol.status.ServerStatus status = com.destroystokyo.paper.network.StandardPaperServerListPingEventImpl.getEventResponse(this.server, player.connection.connection); ++ if (status != null) player.sendServerStatus(status); ++ }); + } ++ // DivineMC end - Paper PR: Fire ServerListPingEvent for secondary motd send + + // player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players)); // CraftBukkit - replaced with loop below + this.players.add(player); diff --git a/divinemc-server/paper-patches/features/0020-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch b/divinemc-server/paper-patches/features/0020-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch new file mode 100644 index 0000000..e89431b --- /dev/null +++ b/divinemc-server/paper-patches/features/0020-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> +Date: Sun, 20 Jul 2025 16:10:25 +0300 +Subject: [PATCH] Paper PR: Fire ServerListPingEvent for secondary motd send + +Original license: GPLv3 +Original project: https://github.com/PaperMC/Paper +Paper pull request: https://github.com/PaperMC/Paper/pull/8074 + +diff --git a/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java +index 30a19d10869f73d67b794e8e4c035bc5c10209e6..95acdc0e849c4bb36bab33ee8bc9a9d4e8667829 100644 +--- a/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java ++++ b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java +@@ -64,13 +64,24 @@ public final class StandardPaperServerListPingEventImpl extends PaperServerListP + } + + public static void processRequest(MinecraftServer server, Connection networkManager) { ++ // DivineMC start - Paper PR: Fire ServerListPingEvent for secondary motd send ++ ServerStatus ping = getEventResponse(server, networkManager); ++ if (ping == null) { ++ networkManager.disconnect((Component) null); ++ return; ++ } ++ ++ networkManager.send(new ClientboundStatusResponsePacket(ping)); ++ } ++ ++ public static ServerStatus getEventResponse(MinecraftServer server, Connection networkManager) { ++ // DivineMC end - Paper PR: Fire ServerListPingEvent for secondary motd send + StandardPaperServerListPingEventImpl event = new StandardPaperServerListPingEventImpl(server, networkManager, server.getStatus()); + server.server.getPluginManager().callEvent(event); + + // Close connection immediately if event is cancelled + if (event.isCancelled()) { +- networkManager.disconnect((Component) null); +- return; ++ return null; // DivineMC - Paper PR: Fire ServerListPingEvent for secondary motd send + } + + // Setup response +@@ -98,8 +109,6 @@ public final class StandardPaperServerListPingEventImpl extends PaperServerListP + } + final ServerStatus ping = new ServerStatus(description, players, Optional.of(version), favicon, server.enforceSecureProfile()); + +- // Send response +- networkManager.send(new ClientboundStatusResponsePacket(ping)); ++ return ping; // DivineMC - Paper PR: Fire ServerListPingEvent for secondary motd send + } +- + }