From ede41fe1634dd20a5537fa512bb84e04ce668cc6 Mon Sep 17 00:00:00 2001 From: cakoyo Date: Wed, 16 Dec 2020 21:43:09 +0100 Subject: [PATCH] Emancipate more features to PlayerHandshakeEvent * The hostname and socket address was not null when the event fired, but the event does not provide the value, the change allows plugins to use the old value. * Since `proxyLogicEnabled` will be checked after the event fired, to check the config value will allow plugins to modify it during the event handling. Signed-off-by: MiniDigger --- ...d-handshake-event-to-allow-plugins-to-handle-clien.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Spigot-Server-Patches/0087-Add-handshake-event-to-allow-plugins-to-handle-clien.patch b/Spigot-Server-Patches/0087-Add-handshake-event-to-allow-plugins-to-handle-clien.patch index 42ee3f800c..80676bf40e 100644 --- a/Spigot-Server-Patches/0087-Add-handshake-event-to-allow-plugins-to-handle-clien.patch +++ b/Spigot-Server-Patches/0087-Add-handshake-event-to-allow-plugins-to-handle-clien.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add handshake event to allow plugins to handle client diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java -index 69fd0a7b230c6f6eb46a43477465f77b265cc3c9..396c3f824968512e55987fd98d82d10e9cad6903 100644 +index 69fd0a7b230c6f6eb46a43477465f77b265cc3c9..4de8646811f25b6217cffcd31fc14bcf79151b1a 100644 --- a/src/main/java/net/minecraft/server/HandshakeListener.java +++ b/src/main/java/net/minecraft/server/HandshakeListener.java @@ -14,7 +14,7 @@ public class HandshakeListener implements PacketHandshakingInListener { @@ -37,8 +37,8 @@ index 69fd0a7b230c6f6eb46a43477465f77b265cc3c9..396c3f824968512e55987fd98d82d10e + return; + } + -+ packethandshakinginsetprotocol.hostname = event.getServerHostname(); -+ this.getNetworkManager().socketAddress = new java.net.InetSocketAddress(event.getSocketAddressHostname(), ((java.net.InetSocketAddress) this.getNetworkManager().getSocketAddress()).getPort()); ++ if (event.getServerHostname() != null) packethandshakinginsetprotocol.hostname = event.getServerHostname(); ++ if (event.getSocketAddressHostname() != null) this.getNetworkManager().socketAddress = new java.net.InetSocketAddress(event.getSocketAddressHostname(), ((java.net.InetSocketAddress) this.getNetworkManager().getSocketAddress()).getPort()); + this.getNetworkManager().spoofedUUID = event.getUniqueId(); + this.getNetworkManager().spoofedProfile = gson.fromJson(event.getPropertiesJson(), com.mojang.authlib.properties.Property[].class); + handledByEvent = true; // Hooray, we did it!