mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-21 15:59:23 +00:00
add configurable option to prevent server ping responses before startup (rewritten purpur patch)
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
--- a/net/minecraft/server/network/ServerStatusPacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerStatusPacketListenerImpl.java
|
||||
@@ -37,7 +_,10 @@
|
||||
} else {
|
||||
this.hasRequestedStatus = true;
|
||||
// this.connection.send(new ClientboundStatusResponsePacket(this.status)); // Paper
|
||||
- if (net.minecraft.server.MinecraftServer.getServer().getStatus().version().isEmpty()) return; // Purpur - Fix 'outdated server' showing in ping before server fully boots - do not respond to pings before we know the protocol version
|
||||
+ // DivineMC start - Don't respond ping before start fully - rewritten Purpur patch (configurable)
|
||||
+ var status = net.minecraft.server.MinecraftServer.getServer().getStatus();
|
||||
+ if (org.bxteam.divinemc.DivineConfig.dontRespondPingBeforeStart && (status == null || status.version().isEmpty())) return;
|
||||
+ // DivineMC end - Don't respond ping before start fully - rewritten Purpur patch (configurable)
|
||||
com.destroystokyo.paper.network.StandardPaperServerListPingEventImpl.processRequest(net.minecraft.server.MinecraftServer.getServer(), this.connection); // Paper - handle status request
|
||||
}
|
||||
}
|
||||
@@ -309,6 +309,7 @@ public class DivineConfig {
|
||||
public static boolean disableDisconnectSpam = false;
|
||||
public static boolean connectionFlushQueueRewrite = false;
|
||||
public static boolean gracefulTeleportHandling = false;
|
||||
public static boolean dontRespondPingBeforeStart = true;
|
||||
private static void networkSettings() {
|
||||
disableDisconnectSpam = getBoolean("settings.network.disable-disconnect-spam", disableDisconnectSpam,
|
||||
"Prevents players being disconnected by 'disconnect.spam' when sending too many chat packets");
|
||||
@@ -319,6 +320,8 @@ public class DivineConfig {
|
||||
"Note: May increase the Netty thread usage");
|
||||
gracefulTeleportHandling = getBoolean("settings.network.graceful-teleport-handling", gracefulTeleportHandling ,
|
||||
"Disables being disconnected from 'multiplayer.disconnect.invalid_player_movement' (also declines the packet handling).");
|
||||
dontRespondPingBeforeStart = getBoolean("settings.network.dont-respond-ping-before-start", dontRespondPingBeforeStart,
|
||||
"Prevents the server from responding to pings before the server is fully booted.");
|
||||
}
|
||||
|
||||
public static boolean enableFasterTntOptimization = true;
|
||||
|
||||
Reference in New Issue
Block a user