mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-13 00:37:52 +00:00
Add IP address to client disconnect message. Closes #9603
This commit is contained in:
1 file changed
+4
-1
@@ -184,7 +184,10 @@ public class ServerLifecycleHooks
|
||||
|
||||
private static void rejectConnection(final Connection manager, ConnectionType type, String message) {
|
||||
manager.setProtocol(ConnectionProtocol.LOGIN);
|
||||
LOGGER.info(SERVERHOOKS, "Disconnecting {} connection attempt: {}", type, message);
|
||||
String ip = "local";
|
||||
if (manager.getRemoteAddress() != null)
|
||||
ip = manager.getRemoteAddress().toString();
|
||||
LOGGER.info(SERVERHOOKS, "[{}] Disconnecting {} connection attempt: {}", ip, type, message);
|
||||
MutableComponent text = Component.literal(message);
|
||||
manager.send(new ClientboundLoginDisconnectPacket(text));
|
||||
manager.disconnect(text);
|
||||
|
||||
Reference in new issue
Block a user