2020-01-22 02:02:07 +00:00
|
|
|
From acb615089a33d457c84bce216ba87649efe7e50d Mon Sep 17 00:00:00 2001
|
2017-10-10 16:45:43 +00:00
|
|
|
From: Minecrell <minecrell@minecrell.net>
|
|
|
|
Date: Tue, 10 Oct 2017 18:44:42 +0200
|
|
|
|
Subject: [PATCH] Expose client protocol version and virtual host
|
|
|
|
|
|
|
|
Add a NetworkClient interface that provides access to:
|
|
|
|
- The socket address
|
|
|
|
- The protocol version
|
|
|
|
- The virtual host (the hostname/port the client used to connect
|
|
|
|
to the server)
|
|
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/network/NetworkClient.java b/src/main/java/com/destroystokyo/paper/network/NetworkClient.java
|
|
|
|
new file mode 100644
|
2019-06-25 01:47:58 +00:00
|
|
|
index 00000000..7b2af1bd
|
2017-10-10 16:45:43 +00:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/network/NetworkClient.java
|
2019-03-20 00:28:15 +00:00
|
|
|
@@ -0,0 +1,41 @@
|
2017-10-10 16:45:43 +00:00
|
|
|
+package com.destroystokyo.paper.network;
|
|
|
|
+
|
|
|
|
+import java.net.InetSocketAddress;
|
|
|
|
+
|
2019-03-20 00:28:15 +00:00
|
|
|
+import org.jetbrains.annotations.NotNull;
|
|
|
|
+import org.jetbrains.annotations.Nullable;
|
2017-10-10 16:45:43 +00:00
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * Represents a client connected to the server.
|
|
|
|
+ */
|
|
|
|
+public interface NetworkClient {
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Returns the socket address of the client.
|
|
|
|
+ *
|
|
|
|
+ * @return The client's socket address
|
|
|
|
+ */
|
2019-03-20 00:28:15 +00:00
|
|
|
+ @NotNull
|
2017-10-10 16:45:43 +00:00
|
|
|
+ InetSocketAddress getAddress();
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Returns the protocol version of the client.
|
|
|
|
+ *
|
|
|
|
+ * @return The client's protocol version, or {@code -1} if unknown
|
|
|
|
+ * @see <a href="http://wiki.vg/Protocol_version_numbers">List of protocol
|
|
|
|
+ * version numbers</a>
|
|
|
|
+ */
|
|
|
|
+ int getProtocolVersion();
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Returns the virtual host the client is connected to.
|
|
|
|
+ *
|
|
|
|
+ * <p>The virtual host refers to the hostname/port the client used to
|
|
|
|
+ * connect to the server.</p>
|
|
|
|
+ *
|
|
|
|
+ * @return The client's virtual host, or {@code null} if unknown
|
|
|
|
+ */
|
|
|
|
+ @Nullable
|
|
|
|
+ InetSocketAddress getVirtualHost();
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
2020-01-22 02:02:07 +00:00
|
|
|
index da36c8df..dbe53123 100644
|
2017-10-10 16:45:43 +00:00
|
|
|
--- a/src/main/java/org/bukkit/entity/Player.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/Player.java
|
2019-12-10 23:56:33 +00:00
|
|
|
@@ -31,7 +31,7 @@ import org.jetbrains.annotations.Nullable;
|
2017-10-10 16:45:43 +00:00
|
|
|
/**
|
|
|
|
* Represents a player, connected or not
|
|
|
|
*/
|
2018-11-03 00:23:27 +00:00
|
|
|
-public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginMessageRecipient {
|
|
|
|
+public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginMessageRecipient, com.destroystokyo.paper.network.NetworkClient { // Paper - Extend NetworkClient
|
2017-10-10 16:45:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the "friendly" name to display of this player. This may include
|
|
|
|
--
|
2020-01-22 02:02:07 +00:00
|
|
|
2.25.0.windows.1
|
2017-10-10 16:45:43 +00:00
|
|
|
|