mirror of
https://hub.spigotmc.org/stash/scm/spigot/spigot.git
synced 2025-04-13 09:32:09 +00:00
92 lines
3.8 KiB
Diff
92 lines
3.8 KiB
Diff
From ec7713dcc90af97111fbf28336d1eda5b3123472 Mon Sep 17 00:00:00 2001
|
|
From: md_5 <md_5@live.com.au>
|
|
Date: Sun, 2 Jun 2013 15:20:49 +1000
|
|
Subject: [PATCH] BungeeCord Support
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
|
index 76bf37b5..190d7f7c 100644
|
|
--- a/src/main/java/org/bukkit/entity/Player.java
|
|
+++ b/src/main/java/org/bukkit/entity/Player.java
|
|
@@ -1925,6 +1925,16 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
|
// Spigot start
|
|
public class Spigot extends Entity.Spigot {
|
|
|
|
+ /**
|
|
+ * Gets the connection address of this player, regardless of whether it
|
|
+ * has been spoofed or not.
|
|
+ *
|
|
+ * @return the player's connection address
|
|
+ */
|
|
+ @NotNull
|
|
+ public InetSocketAddress getRawAddress() {
|
|
+ throw new UnsupportedOperationException("Not supported yet.");
|
|
+ }
|
|
}
|
|
|
|
@NotNull
|
|
diff --git a/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java b/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java
|
|
index 498f0be8..084ca8cf 100644
|
|
--- a/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java
|
|
+++ b/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java
|
|
@@ -18,6 +18,7 @@ public class PlayerLoginEvent extends PlayerEvent {
|
|
private final String hostname;
|
|
private Result result = Result.ALLOWED;
|
|
private String message = "";
|
|
+ private final InetAddress realAddress; // Spigot
|
|
|
|
/**
|
|
* This constructor defaults message to an empty string, and result to
|
|
@@ -27,11 +28,19 @@ public class PlayerLoginEvent extends PlayerEvent {
|
|
* @param hostname The hostname that was used to connect to the server
|
|
* @param address The address the player used to connect, provided for
|
|
* timing issues
|
|
+ * @param realAddress the actual, unspoofed connecting address
|
|
*/
|
|
- 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
|
|
super(player);
|
|
this.hostname = hostname;
|
|
this.address = address;
|
|
+ // Spigot start
|
|
+ this.realAddress = realAddress;
|
|
+ }
|
|
+
|
|
+ public PlayerLoginEvent(@NotNull final Player player, @NotNull final String hostname, @NotNull final InetAddress address) {
|
|
+ this(player, hostname, address, address);
|
|
+ // Spigot end
|
|
}
|
|
|
|
/**
|
|
@@ -43,13 +52,26 @@ public class PlayerLoginEvent extends PlayerEvent {
|
|
* timing issues
|
|
* @param result The result status for this event
|
|
* @param message The message to be displayed if result denies login
|
|
+ * @param realAddress the actual, unspoofed connecting address
|
|
*/
|
|
- public PlayerLoginEvent(@NotNull final Player player, @NotNull String hostname, @NotNull final InetAddress address, @NotNull final Result result, @NotNull final String message) {
|
|
- this(player, hostname, address);
|
|
+ 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
|
|
+ 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
|
|
+ */
|
|
+ @NotNull
|
|
+ public InetAddress getRealAddress() {
|
|
+ return realAddress;
|
|
+ }
|
|
+ // Spigot end
|
|
+
|
|
/**
|
|
* Gets the current result of the login, as an enum
|
|
*
|
|
--
|
|
2.42.0
|
|
|