Paper/patches/api/0344-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch
Jake Potrebic 5730a94208
Updated Upstream (Bukkit/CraftBukkit) (#8991)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
2b4582fb SPIGOT-5916: getLastColors does not work with the rgb colors

CraftBukkit Changes:
f7707086d SPIGOT-7299: Fix indirect/anvil damage events and minor improvements
2023-03-18 10:05:04 -07:00

62 lines
2.6 KiB
Diff

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
index baee5038ec7c3e190a328016d9ab290ae48badf6..635b8787fc235b61c0d5677def034656e4ec4cef 100644
--- a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
+++ b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
@@ -22,6 +22,7 @@ public class AsyncPlayerPreLoginEvent extends Event {
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) {
@@ -66,7 +67,14 @@ public class AsyncPlayerPreLoginEvent extends Event {
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
@@ -76,6 +84,7 @@ public class AsyncPlayerPreLoginEvent extends Event {
this.ipAddress = ipAddress;
this.rawAddress = rawAddress; // Paper
//this.uniqueId = uniqueId; // Paper - Not used anymore
+ this.hostname = hostname; // Paper - Add hostname
}
/**
@@ -261,6 +270,19 @@ public class AsyncPlayerPreLoginEvent extends Event {
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() {