Paper/patches/server/0182-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch
Jake Potrebic b3b04f2ca1
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#8515)
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:
9a4de097 SPIGOT-7171: Ability to get the IP/hostname players are requesting status of

CraftBukkit Changes:
f43634ae4 SPIGOT-7170: Cannot set slots in custom smithing inventory
48f3a2258 SPIGOT-7171: Ability to get the IP/hostname players are requesting status of
30e31b4d1 SPIGOT-7177: Certain blocks don't call BlockCanBuildEvent
982364797 SPIGOT-7174: Avoid adding air to CraftMetaBundle

Spigot Changes:
6198b5ae PR-122: Add missing parentheses to pumpkin and melon growth modifier
1aec3fc1 Rebuild patches
2022-10-30 19:44:25 -07:00

30 lines
2.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
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 07784c0e6eea2a4a91f1453e937e14a4a1faedf5..4627d2a785120c6e69fc3c82054bf0703fe5477b 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -368,8 +368,16 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se
java.util.UUID uniqueId = ServerLoginPacketListenerImpl.this.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);