mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 15:09:25 +00:00
39 lines
2.0 KiB
Diff
39 lines
2.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
|
Date: Sat, 29 Jul 2023 11:20:35 +0200
|
|
Subject: [PATCH] Do not log disconnections with null id
|
|
|
|
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
|
Gale - https://galemc.org
|
|
|
|
This patch is based on the following patch:
|
|
"Add option to suppress null ID disconnections"
|
|
By: Kevin Raneri <kevin.raneri@gmail.com>
|
|
As part of: Pufferfish (https://github.com/pufferfish-gg/Pufferfish)
|
|
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
|
|
|
* Pufferfish description *
|
|
|
|
This can help to hide annoying scanning bots from showing up in console.
|
|
|
|
diff --git a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
index 7950f4f88d8a83ed5610b7af4e134557d32da3f0..27fa7bbfc64dd103b7cd1c1216482af3719e3dbb 100644
|
|
--- a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
+++ b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
@@ -145,6 +145,15 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
|
|
|
public void disconnect(Component reason) {
|
|
try {
|
|
+ // Gale start - Pufferfish - do not log disconnections with null id
|
|
+ if (!org.galemc.gale.configuration.GaleGlobalConfiguration.get().logToConsole.nullIdDisconnections && this.authenticatedProfile != null && this.authenticatedProfile.getId() == null) {
|
|
+ var reasonString = reason.getString();
|
|
+
|
|
+ if ("Disconnected".equals(reasonString) || Component.translatable("multiplayer.disconnect.generic").getString().equals(reasonString)) {
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
+ // Gale end - Pufferfish - do not log disconnections with null id
|
|
LOGGER.info("Disconnecting {}: {}", this.getUserName(), reason.getString());
|
|
this.connection.send(new ClientboundLoginDisconnectPacket(reason));
|
|
this.connection.disconnect(reason);
|