mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Added getHostname to AsyncPlayerPreLoginEvent (#6656)
This commit is contained in:
parent
a6ae1cc540
commit
a8a9f84e87
2 changed files with 80 additions and 0 deletions
|
@ -0,0 +1,61 @@
|
|||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
|
||||
@@ -0,0 +0,0 @@ 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) {
|
||||
@@ -0,0 +0,0 @@ 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
|
||||
@@ -0,0 +0,0 @@ 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
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -0,0 +0,0 @@ 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() {
|
|
@ -0,0 +1,19 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MCMDEV <john-m.1@gmx.de>
|
||||
Date: Fri, 24 Sep 2021 17:59:21 +0200
|
||||
Subject: [PATCH] Added getHostname to AsyncPlayerPreLoginEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
|
||||
|
||||
// Paper start
|
||||
PlayerProfile profile = CraftPlayerProfile.asBukkitMirror(ServerLoginPacketListenerImpl.this.gameProfile);
|
||||
- AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, rawAddress, uniqueId, profile);
|
||||
+ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, rawAddress, uniqueId, profile, ServerLoginPacketListenerImpl.this.hostname);
|
||||
server.getPluginManager().callEvent(asyncEvent);
|
||||
profile = asyncEvent.getPlayerProfile();
|
||||
profile.complete(true);
|
Loading…
Reference in a new issue