Skip to content

Commit

Permalink
Dont respond ping before start fully
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yh-china committed Jul 17, 2023
1 parent d28a165 commit 3b98bb8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
9 changes: 7 additions & 2 deletions patches/server/0004-Leaves-Server-Config-And-Command.patch
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ index 35d2da9d91dcdd89de7c0f4af028fd182376ea8d..d73482fb1e71fe2951e96ae0593de268
.withRequiredArg()
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..415b726132f549495b5bff09bed2ca4eaf2e01fe
index 0000000000000000000000000000000000000000..cbe32042289b6a00293e98771e5dbc2153fa54b3
--- /dev/null
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -0,0 +1,836 @@
@@ -0,0 +1,841 @@
+package top.leavesmc.leaves;
+
+import com.destroystokyo.paper.util.SneakyThrow;
Expand Down Expand Up @@ -793,6 +793,11 @@ index 0000000000000000000000000000000000000000..415b726132f549495b5bff09bed2ca4e
+ dontTriggerLootableRefreshNonPlayer = getBoolean("settings.performance.dont-trigger-lootable-refresh-for-non-player", dontTriggerLootableRefreshNonPlayer);
+ }
+
+ public static boolean dontRespondPingBeforeStart = true;
+ private static void dontRespondPingBeforeStart() {
+ dontRespondPingBeforeStart = getBoolean("settings.misc.dont-respond-ping-before-start-fully", dontRespondPingBeforeStart);
+ }
+
+ public static final class WorldConfig {
+
+ public final String worldName;
Expand Down
24 changes: 24 additions & 0 deletions patches/server/0089-Dont-respond-ping-before-start-fully.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Mon, 17 Jul 2023 23:16:58 +0800
Subject: [PATCH] Dont respond ping before start fully

This patch is Powered by Gale(https://github.com/GaleMC/Gale)

diff --git a/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java
index 2c13147bc063a09bb7907d6f90c3a1e811a09eb1..b6332639468dbfc3086f100809fdb3d471867d12 100644
--- a/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java
@@ -153,6 +153,12 @@ public class ServerStatusPacketListenerImpl implements ServerStatusPacketListene
this.connection.send(new ClientboundStatusResponsePacket(ping));
// CraftBukkit end
*/
+ // Leaves start - dont respond it before start full
+ var status = MinecraftServer.getServer().getStatus();
+ if (top.leavesmc.leaves.LeavesConfig.dontRespondPingBeforeStart && (status == null || status.version() == null || status.version().isEmpty())) {
+ return;
+ }
+ // Leaves end - dont respond it before start full
com.destroystokyo.paper.network.StandardPaperServerListPingEventImpl.processRequest(MinecraftServer.getServer(), this.connection);
// Paper end
}

0 comments on commit 3b98bb8

Please sign in to comment.