2021-08-07 16:35:21 +10:00
From 63061c68ce6c432f877e1096084ea8ca5f373ad3 Mon Sep 17 00:00:00 2001
2013-05-14 21:14:43 +10:00
From: md_5 <md_5@live.com.au>
2013-06-02 15:22:22 +10:00
Date: Sun, 2 Jun 2013 15:20:49 +1000
2013-05-14 21:14:43 +10:00
Subject: [PATCH] BungeeCord Support
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
2021-08-07 16:35:21 +10:00
index 89dd126e..64d19b69 100644
2013-05-14 21:14:43 +10:00
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
2021-08-07 16:35:21 +10:00
@@ -1314,6 +1314,16 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
2020-01-24 17:56:32 +11:00
// Spigot start
public class Spigot extends Entity.Spigot {
2017-05-15 15:44:15 +10:00
2013-06-02 15:22:22 +10:00
+ /**
+ * Gets the connection address of this player, regardless of whether it
+ * has been spoofed or not.
+ *
+ * @return the player's connection address
+ */
2019-03-13 17:43:06 +11:00
+ @NotNull
2020-01-24 17:56:32 +11:00
+ public InetSocketAddress getRawAddress() {
+ throw new UnsupportedOperationException("Not supported yet.");
2013-06-02 15:22:22 +10:00
+ }
2017-05-15 15:44:15 +10:00
}
2019-03-13 17:43:06 +11:00
@NotNull
2013-05-21 20:45:44 +10:00
diff --git a/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java b/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java
2019-05-20 20:53:04 +10:00
index 498f0be8..084ca8cf 100644
2013-05-21 20:45:44 +10:00
--- a/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java
2019-04-23 14:40:20 +10:00
@@ -18,6 +18,7 @@ public class PlayerLoginEvent extends PlayerEvent {
2013-05-21 20:45:44 +10:00
private final String hostname;
private Result result = Result.ALLOWED;
private String message = "";
+ private final InetAddress realAddress; // Spigot
/**
2016-11-17 12:41:12 +11:00
* This constructor defaults message to an empty string, and result to
2019-05-20 20:45:24 +10:00
@@ -27,11 +28,19 @@ public class PlayerLoginEvent extends PlayerEvent {
* @param hostname The hostname that was used to connect to the server
2013-12-18 17:48:18 +11:00
* @param address The address the player used to connect, provided for
* timing issues
2019-05-20 20:53:04 +10:00
+ * @param realAddress the actual, unspoofed connecting address
2013-05-21 20:45:44 +10:00
*/
2019-03-13 17:43:06 +11:00
- public PlayerLoginEvent(@NotNull final Player player, @NotNull final String hostname, @NotNull final InetAddress address) {
+ public PlayerLoginEvent(@NotNull final Player player, @NotNull final String hostname, @NotNull final InetAddress address, final @NotNull InetAddress realAddress) { // Spigot
2013-05-21 20:45:44 +10:00
super(player);
this.hostname = hostname;
this.address = address;
+ // Spigot start
2014-03-27 11:53:41 +00:00
+ this.realAddress = realAddress;
2013-05-21 20:45:44 +10:00
+ }
+
2019-03-13 17:43:06 +11:00
+ public PlayerLoginEvent(@NotNull final Player player, @NotNull final String hostname, @NotNull final InetAddress address) {
2013-05-21 20:45:44 +10:00
+ this(player, hostname, address, address);
+ // Spigot end
}
/**
2019-05-20 20:45:24 +10:00
@@ -43,13 +52,26 @@ public class PlayerLoginEvent extends PlayerEvent {
* timing issues
2013-05-21 20:45:44 +10:00
* @param result The result status for this event
* @param message The message to be displayed if result denies login
2019-05-20 20:53:04 +10:00
+ * @param realAddress the actual, unspoofed connecting address
2013-05-21 20:45:44 +10:00
*/
2019-03-13 17:43:06 +11:00
- public PlayerLoginEvent(@NotNull final Player player, @NotNull String hostname, @NotNull final InetAddress address, @NotNull final Result result, @NotNull final String message) {
2013-05-21 20:45:44 +10:00
- this(player, hostname, address);
2019-03-13 17:43:06 +11:00
+ public PlayerLoginEvent(@NotNull final Player player, @NotNull String hostname, @NotNull final InetAddress address, @NotNull final Result result, @NotNull final String message, @NotNull final InetAddress realAddress) { // Spigot
2013-05-21 20:45:44 +10:00
+ this(player, hostname, address, realAddress); // Spigot
this.result = result;
this.message = message;
}
+ // Spigot start
+ /**
+ * Gets the connection address of this player, regardless of whether it has been spoofed or not.
+ *
+ * @return the player's connection address
+ */
2019-03-13 17:43:06 +11:00
+ @NotNull
2013-05-21 20:45:44 +10:00
+ public InetAddress getRealAddress() {
+ return realAddress;
+ }
+ // Spigot end
+
/**
* Gets the current result of the login, as an enum
*
2013-05-14 21:14:43 +10:00
--
2020-05-09 18:48:11 +10:00
2.25.1
2013-07-04 12:09:15 +10:00