2021-10-07 18:02:40 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Noah van der Aa <ndvdaa@gmail.com>
|
|
|
|
Date: Tue, 5 Oct 2021 20:04:21 +0200
|
|
|
|
Subject: [PATCH] Add config option for logging player ip addresses
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java
|
2022-12-07 21:05:01 +00:00
|
|
|
index 21393ad40095a4049e5b6871169b2db7aa92d13c..e6553b936dac1eb25a310d1a33acb0b1a5e646d2 100644
|
2021-10-07 18:02:40 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java
|
2022-07-27 21:32:15 +00:00
|
|
|
@@ -185,7 +185,7 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter {
|
2021-10-07 18:02:40 +00:00
|
|
|
buf.release();
|
|
|
|
this.buf = null;
|
|
|
|
|
|
|
|
- LOGGER.debug("Ping: (1.6) from {}", ctx.channel().remoteAddress());
|
2022-06-09 08:51:45 +00:00
|
|
|
+ LOGGER.debug("Ping: (1.6) from {}", io.papermc.paper.configuration.GlobalConfiguration.get().logging.logPlayerIpAddresses ? ctx.channel().remoteAddress() : "<ip address withheld>"); // Paper
|
2021-10-07 18:02:40 +00:00
|
|
|
|
|
|
|
InetSocketAddress virtualHost = com.destroystokyo.paper.network.PaperNetworkClient.prepareVirtualHost(host, port);
|
2022-03-01 05:43:03 +00:00
|
|
|
com.destroystokyo.paper.event.server.PaperServerListPingEvent event = com.destroystokyo.paper.network.PaperLegacyStatusClient.processRequest(
|
2021-10-07 18:02:40 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
|
2023-06-08 07:20:03 +00:00
|
|
|
index 14f037e721ac8ba885536cab43d3d398b011a397..17f42a4097d9c91bae2ccb02365498a0f7c7f8f8 100644
|
2021-10-07 18:02:40 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
|
2023-06-08 07:20:03 +00:00
|
|
|
@@ -204,7 +204,7 @@ public class ServerConnectionListener {
|
2021-10-07 18:02:40 +00:00
|
|
|
throw new ReportedException(CrashReport.forThrowable(exception, "Ticking memory connection"));
|
|
|
|
}
|
|
|
|
|
|
|
|
- ServerConnectionListener.LOGGER.warn("Failed to handle packet for {}", networkmanager.getRemoteAddress(), exception);
|
2022-06-09 08:51:45 +00:00
|
|
|
+ ServerConnectionListener.LOGGER.warn("Failed to handle packet for {}", io.papermc.paper.configuration.GlobalConfiguration.get().logging.logPlayerIpAddresses ? String.valueOf(networkmanager.getRemoteAddress()) : "<ip address withheld>", exception); // Paper
|
2022-06-08 11:44:30 +00:00
|
|
|
MutableComponent ichatmutablecomponent = Component.literal("Internal server error");
|
2021-10-07 18:02:40 +00:00
|
|
|
|
2022-07-27 21:32:15 +00:00
|
|
|
networkmanager.send(new ClientboundDisconnectPacket(ichatmutablecomponent), PacketSendListener.thenRun(() -> {
|
2021-10-07 18:02:40 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
2023-03-14 23:29:38 +00:00
|
|
|
index 595779cfd0ee1c405d7936f00a7cae1706125e7f..ed3af916dfa875dd0a5f1e730d20d11efd6419c6 100644
|
2021-10-07 18:02:40 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
2022-12-07 21:05:01 +00:00
|
|
|
@@ -206,7 +206,10 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
2021-10-07 18:02:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public String getUserName() {
|
|
|
|
- return this.gameProfile != null ? this.gameProfile + " (" + this.connection.getRemoteAddress() + ")" : String.valueOf(this.connection.getRemoteAddress());
|
|
|
|
+ // Paper start
|
2022-06-09 08:51:45 +00:00
|
|
|
+ String ip = io.papermc.paper.configuration.GlobalConfiguration.get().logging.logPlayerIpAddresses ? String.valueOf(this.connection.getRemoteAddress()) : "<ip address withheld>";
|
2021-10-07 18:02:40 +00:00
|
|
|
+ return this.gameProfile != null ? this.gameProfile + " (" + ip + ")" : String.valueOf(ip);
|
|
|
|
+ // Paper end
|
|
|
|
}
|
|
|
|
|
2022-12-07 21:05:01 +00:00
|
|
|
@Override
|
2021-10-07 18:02:40 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
2023-06-08 07:20:03 +00:00
|
|
|
index 348265d5686072d625d694a5a3cdbe3060c950f7..5f957a28e9d30144f724ebdc581d5f0b80bf6dc1 100644
|
2021-10-07 18:02:40 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
2023-06-08 07:20:03 +00:00
|
|
|
@@ -255,7 +255,7 @@ public abstract class PlayerList {
|
2022-12-19 10:46:55 +00:00
|
|
|
String s1 = "local";
|
2021-10-07 18:02:40 +00:00
|
|
|
|
|
|
|
if (connection.getRemoteAddress() != null) {
|
|
|
|
- s1 = connection.getRemoteAddress().toString();
|
2022-06-09 08:51:45 +00:00
|
|
|
+ s1 = io.papermc.paper.configuration.GlobalConfiguration.get().logging.logPlayerIpAddresses ? connection.getRemoteAddress().toString() : "<ip address withheld>"; // Paper
|
2021-10-07 18:02:40 +00:00
|
|
|
}
|
2022-12-19 10:46:55 +00:00
|
|
|
|
|
|
|
// Spigot start - spawn location event
|