diff --git a/build-data/spigot-server-patches/re-add-asm-dependency.patch b/build-data/spigot-server-patches/re-add-asm-dependency.patch index 48858e55f6..2039b4f7c6 100644 --- a/build-data/spigot-server-patches/re-add-asm-dependency.patch +++ b/build-data/spigot-server-patches/re-add-asm-dependency.patch @@ -24,6 +24,6 @@ + + org.ow2.asm + asm-commons -+-- ++-- +2.43.0 + diff --git a/patches/api/Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch b/patches/api/Add-more-fields-to-AsyncPreLoginEvent.patch similarity index 67% rename from patches/api/Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch rename to patches/api/Add-more-fields-to-AsyncPreLoginEvent.patch index b399ef8c8b..5324dde1a5 100644 --- a/patches/api/Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch +++ b/patches/api/Add-more-fields-to-AsyncPreLoginEvent.patch @@ -1,9 +1,8 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 18 Mar 2018 11:43:30 -0400 -Subject: [PATCH] Ability to change PlayerProfile in AsyncPreLoginEvent +Subject: [PATCH] Add more fields to AsyncPreLoginEvent -This will allow you to change the players name or skin on login. 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 @@ -24,10 +23,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private Result result; private net.kyori.adventure.text.Component message; // Paper - private final String name; -+ //private String name; // Paper - Not used anymore private final InetAddress ipAddress; - private final UUID uniqueId; -+ //private UUID uniqueId; // Paper - Not used anymore ++ private PlayerProfile profile; // Paper ++ private final InetAddress rawAddress; // Paper ++ private final String hostname; // Paper @Deprecated public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress) { @@ -38,36 +38,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start + this(name, ipAddress, uniqueId, Bukkit.createProfile(uniqueId, name)); + } -+ private PlayerProfile profile; -+ -+ /** -+ * Gets the PlayerProfile of the player logging in -+ * @return The Profile -+ */ -+ @NotNull -+ public PlayerProfile getPlayerProfile() { -+ return profile; -+ } -+ -+ /** -+ * Changes the PlayerProfile the player will login as -+ * @param profile The profile to use -+ */ -+ public void setPlayerProfile(@NotNull PlayerProfile profile) { -+ this.profile = profile; -+ } + ++ @Deprecated(forRemoval = true) + public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final UUID uniqueId, @NotNull PlayerProfile profile) { ++ this(name, ipAddress, ipAddress, uniqueId, profile); ++ } ++ ++ @Deprecated(forRemoval = true) ++ public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final InetAddress rawAddress, @NotNull final UUID uniqueId, @NotNull PlayerProfile profile) { ++ 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) { super(true); -+ this.profile = profile; -+ // Paper end this.result = Result.ALLOWED; this.message = net.kyori.adventure.text.Component.empty(); // Paper - this.name = name; -+ //this.name = name; // Paper - Not used anymore ++ this.profile = profile; this.ipAddress = ipAddress; - this.uniqueId = uniqueId; -+ //this.uniqueId = uniqueId; // Paper - Not used anymore ++ this.rawAddress = rawAddress; ++ this.hostname = hostname; ++ // Paper end } /** @@ -88,4 +80,45 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return profile.getId(); // Paper } ++ // Paper start ++ /** ++ * Gets the PlayerProfile of the player logging in ++ * @return The Profile ++ */ ++ @NotNull ++ public PlayerProfile getPlayerProfile() { ++ return profile; ++ } ++ ++ /** ++ * Changes the PlayerProfile the player will login as ++ * @param profile The profile to use ++ */ ++ public void setPlayerProfile(@NotNull PlayerProfile profile) { ++ this.profile = profile; ++ } ++ ++ /** ++ * Gets the raw address of the player logging in ++ * @return The address ++ */ ++ @NotNull ++ public InetAddress getRawAddress() { ++ return rawAddress; ++ } ++ ++ /** ++ * 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() { diff --git a/patches/api/Add-raw-address-to-AsyncPlayerPreLoginEvent.patch b/patches/api/Add-raw-address-to-AsyncPlayerPreLoginEvent.patch deleted file mode 100644 index 1adac4b3de..0000000000 --- a/patches/api/Add-raw-address-to-AsyncPlayerPreLoginEvent.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Connor Linfoot -Date: Wed, 12 May 2021 08:09:19 +0100 -Subject: [PATCH] Add raw address 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 net.kyori.adventure.text.Component message; // Paper - //private String name; // Paper - Not used anymore - private final InetAddress ipAddress; -+ private final InetAddress rawAddress; // Paper - //private UUID uniqueId; // Paper - Not used anymore - - @Deprecated -@@ -0,0 +0,0 @@ public class AsyncPlayerPreLoginEvent extends Event { - this.profile = profile; - } - -+ // Paper Start -+ /** -+ * Gets the raw address of the player logging in -+ * @return The address -+ */ -+ @NotNull -+ public InetAddress getRawAddress() { -+ return rawAddress; -+ } -+ // Paper end -+ -+ @Deprecated - public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final UUID uniqueId, @NotNull PlayerProfile profile) { -+ this(name, ipAddress, ipAddress, uniqueId, profile); -+ } -+ -+ public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final InetAddress rawAddress, @NotNull final UUID uniqueId, @NotNull PlayerProfile profile) { - super(true); - this.profile = profile; - // Paper end -@@ -0,0 +0,0 @@ public class AsyncPlayerPreLoginEvent extends Event { - this.message = net.kyori.adventure.text.Component.empty(); // Paper - //this.name = name; // Paper - Not used anymore - this.ipAddress = ipAddress; -+ this.rawAddress = rawAddress; // Paper - //this.uniqueId = uniqueId; // Paper - Not used anymore - } - diff --git a/patches/api/Added-getHostname-to-AsyncPlayerPreLoginEvent.patch b/patches/api/Added-getHostname-to-AsyncPlayerPreLoginEvent.patch deleted file mode 100644 index ef3e9dcd6e..0000000000 --- a/patches/api/Added-getHostname-to-AsyncPlayerPreLoginEvent.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MCMDEV -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() { diff --git a/patches/server/Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch b/patches/server/Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch deleted file mode 100644 index accf277ca4..0000000000 --- a/patches/server/Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 18 Mar 2018 11:45:57 -0400 -Subject: [PATCH] Ability to change PlayerProfile in AsyncPreLoginEvent - -This will allow you to change the players name or skin on login. - -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, - java.util.UUID uniqueId = gameprofile.getId(); - final org.bukkit.craftbukkit.CraftServer server = ServerLoginPacketListenerImpl.this.server.server; - -- AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId); -+ // Paper start -+ com.destroystokyo.paper.profile.PlayerProfile profile = org.bukkit.Bukkit.createProfile(uniqueId, playerName); -+ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId, profile); - server.getPluginManager().callEvent(asyncEvent); -+ profile = asyncEvent.getPlayerProfile(); -+ profile.complete(); -+ gameprofile = com.destroystokyo.paper.profile.CraftPlayerProfile.asAuthlibCopy(profile); -+ playerName = gameprofile.getName(); -+ uniqueId = gameprofile.getId(); -+ // Paper end - - if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) { - final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId); diff --git a/patches/server/Add-Velocity-IP-Forwarding-Support.patch b/patches/server/Add-Velocity-IP-Forwarding-Support.patch index 1a2e200bba..f719acf4c1 100644 --- a/patches/server/Add-Velocity-IP-Forwarding-Support.patch +++ b/patches/server/Add-Velocity-IP-Forwarding-Support.patch @@ -154,16 +154,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, // CraftBukkit start - private void callPlayerPreLoginEvents(GameProfile gameprofile) throws Exception { + private GameProfile callPlayerPreLoginEvents(GameProfile gameprofile) throws Exception { // Paper - Add more fields to AsyncPlayerPreLoginEvent + // Paper start - Velocity support + if (ServerLoginPacketListenerImpl.this.velocityLoginMessageId == -1 && io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) { + disconnect("This server requires you to connect with Velocity."); -+ return; ++ return gameprofile; + } -+ // Paper end ++ // Paper end - Velocity support String playerName = gameprofile.getName(); java.net.InetAddress address = ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getAddress(); - java.net.InetAddress rawAddress = ((java.net.InetSocketAddress) this.connection.channel.remoteAddress()).getAddress(); // Paper + java.util.UUID uniqueId = gameprofile.getId(); @@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, @Override @@ -202,7 +202,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Proceed with login + authenticatorPool.execute(() -> { + try { -+ this.callPlayerPreLoginEvents(this.authenticatedProfile); ++ final GameProfile gameprofile = this.callPlayerPreLoginEvents(this.authenticatedProfile); ++ ServerLoginPacketListenerImpl.LOGGER.info("UUID of player {} is {}", gameprofile.getName(), gameprofile.getId()); ++ ServerLoginPacketListenerImpl.this.startClientVerification(gameprofile); + } catch (Exception ex) { + disconnect("Failed to verify username!"); + server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + this.authenticatedProfile.getName(), ex); diff --git a/patches/server/Add-more-fields-to-AsyncPreLoginEvent.patch b/patches/server/Add-more-fields-to-AsyncPreLoginEvent.patch new file mode 100644 index 0000000000..1ac6a195de --- /dev/null +++ b/patches/server/Add-more-fields-to-AsyncPreLoginEvent.patch @@ -0,0 +1,72 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sun, 18 Mar 2018 11:45:57 -0400 +Subject: [PATCH] Add more fields to AsyncPreLoginEvent + +Co-authored-by: Connor Linfoot +Co-authored-by: MCMDEV + +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, + try { + GameProfile gameprofile = ServerLoginPacketListenerImpl.this.createOfflineProfile(ServerLoginPacketListenerImpl.this.requestedUsername); // Spigot + +- ServerLoginPacketListenerImpl.this.callPlayerPreLoginEvents(gameprofile); ++ gameprofile = ServerLoginPacketListenerImpl.this.callPlayerPreLoginEvents(gameprofile); // Paper - Add more fields to AsyncPlayerPreLoginEvent + ServerLoginPacketListenerImpl.LOGGER.info("UUID of player {} is {}", gameprofile.getName(), gameprofile.getId()); + ServerLoginPacketListenerImpl.this.startClientVerification(gameprofile); + } catch (Exception ex) { +@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, + if (!ServerLoginPacketListenerImpl.this.connection.isConnected()) { + return; + } +- ServerLoginPacketListenerImpl.this.callPlayerPreLoginEvents(gameprofile); ++ gameprofile = ServerLoginPacketListenerImpl.this.callPlayerPreLoginEvents(gameprofile); // Paper - Add more fields to AsyncPlayerPreLoginEvent + // CraftBukkit end + ServerLoginPacketListenerImpl.LOGGER.info("UUID of player {} is {}", gameprofile.getName(), gameprofile.getId()); + ServerLoginPacketListenerImpl.this.startClientVerification(gameprofile); +@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, + } + + // CraftBukkit start +- private void callPlayerPreLoginEvents(GameProfile gameprofile) throws Exception { ++ private GameProfile callPlayerPreLoginEvents(GameProfile gameprofile) throws Exception { // Paper - Add more fields to AsyncPlayerPreLoginEvent + String playerName = gameprofile.getName(); + java.net.InetAddress address = ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getAddress(); + java.util.UUID uniqueId = gameprofile.getId(); + final org.bukkit.craftbukkit.CraftServer server = ServerLoginPacketListenerImpl.this.server.server; + +- AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId); ++ // Paper start - Add more fields to AsyncPlayerPreLoginEvent ++ final java.net.InetAddress rawAddress = ((java.net.InetSocketAddress) this.connection.channel.remoteAddress()).getAddress(); ++ com.destroystokyo.paper.profile.PlayerProfile profile = org.bukkit.Bukkit.createProfile(uniqueId, playerName); ++ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, rawAddress, uniqueId, profile, this.connection.hostname); + server.getPluginManager().callEvent(asyncEvent); ++ profile = asyncEvent.getPlayerProfile(); ++ profile.complete(); ++ gameprofile = com.destroystokyo.paper.profile.CraftPlayerProfile.asAuthlibCopy(profile); ++ playerName = gameprofile.getName(); ++ uniqueId = gameprofile.getId(); ++ // Paper end - Add more fields to AsyncPlayerPreLoginEvent + + if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) { + final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId); +@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, + ServerLoginPacketListenerImpl.this.server.processQueue.add(waitable); + if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) { + this.disconnect(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.kickMessage())); // Paper - Adventure +- return; + } + } else { + if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) { + this.disconnect(io.papermc.paper.adventure.PaperAdventure.asVanilla(asyncEvent.kickMessage())); // Paper - Adventure +- return; + } + } ++ return gameprofile; // Paper - Add more fields to AsyncPlayerPreLoginEvent + } + // CraftBukkit end + diff --git a/patches/server/Add-raw-address-to-AsyncPlayerPreLoginEvent.patch b/patches/server/Add-raw-address-to-AsyncPlayerPreLoginEvent.patch deleted file mode 100644 index fc510095e6..0000000000 --- a/patches/server/Add-raw-address-to-AsyncPlayerPreLoginEvent.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Connor Linfoot -Date: Wed, 12 May 2021 08:09:19 +0100 -Subject: [PATCH] Add raw address 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, - private void callPlayerPreLoginEvents(GameProfile gameprofile) throws Exception { - String playerName = gameprofile.getName(); - java.net.InetAddress address = ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getAddress(); -+ java.net.InetAddress rawAddress = ((java.net.InetSocketAddress) this.connection.channel.remoteAddress()).getAddress(); // Paper - java.util.UUID uniqueId = gameprofile.getId(); - final org.bukkit.craftbukkit.CraftServer server = ServerLoginPacketListenerImpl.this.server.server; - - // Paper start - com.destroystokyo.paper.profile.PlayerProfile profile = com.destroystokyo.paper.profile.CraftPlayerProfile.asBukkitMirror(gameprofile); -- AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId, profile); -+ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, rawAddress, uniqueId, profile); // Paper - add rawAddress - server.getPluginManager().callEvent(asyncEvent); - profile = asyncEvent.getPlayerProfile(); - profile.complete(true); // Paper - setPlayerProfileAPI diff --git a/patches/server/Added-getHostname-to-AsyncPlayerPreLoginEvent.patch b/patches/server/Added-getHostname-to-AsyncPlayerPreLoginEvent.patch deleted file mode 100644 index aa793bf469..0000000000 --- a/patches/server/Added-getHostname-to-AsyncPlayerPreLoginEvent.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MCMDEV -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 - com.destroystokyo.paper.profile.PlayerProfile profile = com.destroystokyo.paper.profile.CraftPlayerProfile.asBukkitMirror(gameprofile); -- AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, rawAddress, uniqueId, profile); // Paper - add rawAddress -+ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, rawAddress, uniqueId, profile, ServerLoginPacketListenerImpl.this.connection.hostname); // Paper - add rawAddress & hostname - server.getPluginManager().callEvent(asyncEvent); - profile = asyncEvent.getPlayerProfile(); - profile.complete(true); // Paper - setPlayerProfileAPI diff --git a/patches/server/Player.setPlayerProfile-API.patch b/patches/server/Player.setPlayerProfile-API.patch index 82ef6ac90a..254d4c35cc 100644 --- a/patches/server/Player.setPlayerProfile-API.patch +++ b/patches/server/Player.setPlayerProfile-API.patch @@ -26,12 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- 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, - final org.bukkit.craftbukkit.CraftServer server = ServerLoginPacketListenerImpl.this.server.server; - - // Paper start -- com.destroystokyo.paper.profile.PlayerProfile profile = org.bukkit.Bukkit.createProfile(uniqueId, playerName); -+ com.destroystokyo.paper.profile.PlayerProfile profile = com.destroystokyo.paper.profile.CraftPlayerProfile.asBukkitMirror(gameprofile); - AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId, profile); + AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, rawAddress, uniqueId, profile, this.connection.hostname); server.getPluginManager().callEvent(asyncEvent); profile = asyncEvent.getPlayerProfile(); - profile.complete();