|
| 1 | +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| 2 | +From: MCMDEV <john-m.1@gmx.de> |
| 3 | +Date: Fri, 24 Sep 2021 17:59:23 +0200 |
| 4 | +Subject: [PATCH] Added getHostname to AsyncPlayerPreLoginEvent |
| 5 | + |
| 6 | + |
| 7 | +diff --git a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java |
| 8 | +index 694a81769076ea58aae9f14f076ab80c9952c957..356d1154b0732e2daf242d60fa715dba9f2dc9db 100644 |
| 9 | +--- a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java |
| 10 | ++++ b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java |
| 11 | +@@ -22,6 +22,7 @@ public class AsyncPlayerPreLoginEvent extends Event { |
| 12 | + private final InetAddress ipAddress; |
| 13 | + private final InetAddress rawAddress; // Paper |
| 14 | + //private UUID uniqueId; // Paper - Not used anymore |
| 15 | ++ private final String hostname; // Paper |
| 16 | + |
| 17 | + @Deprecated |
| 18 | + public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress) { |
| 19 | +@@ -66,7 +67,14 @@ public class AsyncPlayerPreLoginEvent extends Event { |
| 20 | + this(name, ipAddress, ipAddress, uniqueId, profile); |
| 21 | + } |
| 22 | + |
| 23 | ++ @Deprecated // Paper - Add hostname |
| 24 | + public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final InetAddress rawAddress, @NotNull final UUID uniqueId, @NotNull PlayerProfile profile) { |
| 25 | ++ // Paper start - Add hostname |
| 26 | ++ this(name, ipAddress, rawAddress, uniqueId, profile, ""); |
| 27 | ++ } |
| 28 | ++ |
| 29 | ++ public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final InetAddress rawAddress, @NotNull final UUID uniqueId, @NotNull PlayerProfile profile, @NotNull String hostname) { |
| 30 | ++ // Paper end - Add hostname |
| 31 | + super(true); |
| 32 | + this.profile = profile; |
| 33 | + // Paper end |
| 34 | +@@ -76,6 +84,7 @@ public class AsyncPlayerPreLoginEvent extends Event { |
| 35 | + this.ipAddress = ipAddress; |
| 36 | + this.rawAddress = rawAddress; // Paper |
| 37 | + //this.uniqueId = uniqueId; // Paper - Not used anymore |
| 38 | ++ this.hostname = hostname; // Paper - Add hostname |
| 39 | + } |
| 40 | + |
| 41 | + /** |
| 42 | +@@ -261,6 +270,19 @@ public class AsyncPlayerPreLoginEvent extends Event { |
| 43 | + return profile.getId(); // Paper |
| 44 | + } |
| 45 | + |
| 46 | ++ // Paper start |
| 47 | ++ /** |
| 48 | ++ * Gets the hostname that the player used to connect to the server, or |
| 49 | ++ * blank if unknown |
| 50 | ++ * |
| 51 | ++ * @return The hostname |
| 52 | ++ */ |
| 53 | ++ @NotNull |
| 54 | ++ public String getHostname() { |
| 55 | ++ return hostname; |
| 56 | ++ } |
| 57 | ++ // Paper end |
| 58 | ++ |
| 59 | + @NotNull |
| 60 | + @Override |
| 61 | + public HandlerList getHandlers() { |
0 commit comments