2022-01-12 18:21:29 +01:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MCMDEV <john-m.1@gmx.de>
Date: Fri, 24 Sep 2021 17:59:23 +0200
Subject: [PATCH] Added getHostname to AsyncPlayerPreLoginEvent
diff --git a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
2023-12-29 20:51:52 +01:00
index 35176b16d208c9756bd00ac74b2a1dcc3fc9febb..da07fc4ab0c299c1bb06ede36e7230626bbc28c9 100644
2022-01-12 18:21:29 +01:00
--- a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
+++ b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
2023-12-29 20:51:52 +01:00
@@ -29,6 +29,7 @@ public class AsyncPlayerPreLoginEvent extends Event {
2022-01-12 18:21:29 +01:00
private final InetAddress ipAddress;
private final InetAddress rawAddress; // Paper
//private UUID uniqueId; // Paper - Not used anymore
+ private final String hostname; // Paper
@Deprecated
public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress) {
2023-12-29 20:51:52 +01:00
@@ -74,7 +75,14 @@ public class AsyncPlayerPreLoginEvent extends Event {
2022-01-12 18:21:29 +01:00
this(name, ipAddress, ipAddress, uniqueId, profile);
}
+ @Deprecated // Paper - Add hostname
public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final InetAddress rawAddress, @NotNull final UUID uniqueId, @NotNull PlayerProfile profile) {
+ // Paper start - Add hostname
+ this(name, ipAddress, rawAddress, uniqueId, profile, "");
+ }
+
+ public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final InetAddress rawAddress, @NotNull final UUID uniqueId, @NotNull PlayerProfile profile, @NotNull String hostname) {
+ // Paper end - Add hostname
super(true);
this.profile = profile;
// Paper end
2023-12-29 20:51:52 +01:00
@@ -84,6 +92,7 @@ public class AsyncPlayerPreLoginEvent extends Event {
2022-01-12 18:21:29 +01:00
this.ipAddress = ipAddress;
this.rawAddress = rawAddress; // Paper
//this.uniqueId = uniqueId; // Paper - Not used anymore
+ this.hostname = hostname; // Paper - Add hostname
}
/**
2023-12-29 20:51:52 +01:00
@@ -269,6 +278,19 @@ public class AsyncPlayerPreLoginEvent extends Event {
2022-01-12 18:21:29 +01:00
return profile.getId(); // Paper
}
+ // Paper start
+ /**
+ * Gets the hostname that the player used to connect to the server, or
+ * blank if unknown
+ *
+ * @return The hostname
+ */
+ @NotNull
+ public String getHostname() {
+ return hostname;
+ }
+ // Paper end
+
@NotNull
@Override
public HandlerList getHandlers() {