Paper/patches/server/0622-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch

26 lines
2.2 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Connor Linfoot <connorlinfoot@me.com>
Date: Wed, 12 May 2021 08:09:19 +0100
Subject: [PATCH] Add raw address to AsyncPlayerPreLoginEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 8a2fdfb701ec663310c8f3f86607b6df1f2e01a4..fdd64b7bf24314a0d01444f0b074019b2031efdc 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -371,12 +371,13 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se
2022-08-08 17:25:41 +02:00
public void fireEvents() throws Exception {
2021-06-15 04:59:31 +02:00
String playerName = ServerLoginPacketListenerImpl.this.gameProfile.getName();
java.net.InetAddress address = ((java.net.InetSocketAddress) ServerLoginPacketListenerImpl.this.connection.getRemoteAddress()).getAddress();
2021-06-11 14:02:28 +02:00
+ java.net.InetAddress rawAddress = ((java.net.InetSocketAddress) connection.getRawAddress()).getAddress(); // Paper
2021-06-15 04:59:31 +02:00
java.util.UUID uniqueId = ServerLoginPacketListenerImpl.this.gameProfile.getId();
2021-06-11 14:02:28 +02:00
final org.bukkit.craftbukkit.CraftServer server = ServerLoginPacketListenerImpl.this.server.server;
2022-03-01 06:43:03 +01:00
// Paper start
com.destroystokyo.paper.profile.PlayerProfile profile = com.destroystokyo.paper.profile.CraftPlayerProfile.asBukkitMirror(ServerLoginPacketListenerImpl.this.gameProfile);
- AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId, profile);
+ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, rawAddress, uniqueId, profile); // Paper - add rawAddress
2021-06-11 14:02:28 +02:00
server.getPluginManager().callEvent(asyncEvent);
2022-03-01 06:43:03 +01:00
profile = asyncEvent.getPlayerProfile();
profile.complete(true); // Paper - setPlayerProfileAPI