1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-02-17 02:34:30 +01:00

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 | Martin <admin@minidigger.dev>
This commit is contained in:
cakoyo 2020-12-16 21:43:09 +01:00
parent dc04ee87f8
commit 7a84defae4

View file

@ -37,8 +37,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ 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!