Expose client protocol version and virtual host

This commit is contained in:
Minecrell
2017-10-10 18:45:20 +02:00
parent 70e24c1b60
commit 8838089321
4 changed files with 83 additions and 8 deletions

View File

@@ -29,11 +29,15 @@
@Nullable
private volatile PacketListener disconnectListener;
@Nullable
@@ -114,6 +119,19 @@
@@ -114,6 +119,23 @@
private volatile DisconnectionDetails delayedDisconnect;
@Nullable
BandwidthDebugMonitor bandwidthDebugMonitor;
+ public String hostname = ""; // CraftBukkit - add field
+ // Paper start - NetworkClient implementation
+ public int protocolVersion;
+ public java.net.InetSocketAddress virtualHost;
+ // Paper end
+
+ // Paper start - add utility methods
+ public final net.minecraft.server.level.ServerPlayer getPlayer() {
@@ -49,7 +53,7 @@
public Connection(PacketFlow side) {
this.receiving = side;
@@ -123,6 +141,9 @@
@@ -123,6 +145,9 @@
super.channelActive(channelhandlercontext);
this.channel = channelhandlercontext.channel();
this.address = this.channel.remoteAddress();
@@ -59,7 +63,7 @@
if (this.delayedDisconnect != null) {
this.disconnect(this.delayedDisconnect);
}
@@ -176,6 +197,7 @@
@@ -176,6 +201,7 @@
}
}
@@ -67,7 +71,7 @@
}
protected void channelRead0(ChannelHandlerContext channelhandlercontext, Packet<?> packet) {
@@ -205,7 +227,7 @@
@@ -205,7 +231,7 @@
}
private static <T extends PacketListener> void genericsFtw(Packet<T> packet, PacketListener listener) {
@@ -76,7 +80,7 @@
}
private void validateListener(ProtocolInfo<?> state, PacketListener listener) {
@@ -464,12 +486,15 @@
@@ -464,12 +490,15 @@
}
public void disconnect(DisconnectionDetails disconnectionInfo) {
@@ -93,7 +97,7 @@
this.disconnectionDetails = disconnectionInfo;
}
@@ -537,7 +562,7 @@
@@ -537,7 +566,7 @@
}
public void configurePacketHandler(ChannelPipeline pipeline) {
@@ -102,7 +106,7 @@
public void write(ChannelHandlerContext channelhandlercontext, Object object, ChannelPromise channelpromise) throws Exception {
super.write(channelhandlercontext, object, channelpromise);
}
@@ -661,6 +686,7 @@
@@ -661,6 +690,7 @@
packetlistener1.onDisconnect(disconnectiondetails);
}