2021-06-11 14:02:28 +02:00
|
|
|
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
|
2022-09-20 03:39:46 +02:00
|
|
|
index f97552c5e62124cab00301daee2fd41069fb802c..9a7fe61d7de80eaf044c202e1ed13d9e4b59622a 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
2022-09-17 23:58:51 +02:00
|
|
|
@@ -369,8 +369,16 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se
|
2021-06-12 18:56:13 +02:00
|
|
|
java.util.UUID uniqueId = ServerLoginPacketListenerImpl.this.gameProfile.getId();
|
2021-06-11 14:02:28 +02:00
|
|
|
final org.bukkit.craftbukkit.CraftServer server = ServerLoginPacketListenerImpl.this.server.server;
|
|
|
|
|
|
|
|
- AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
|
2022-03-01 06:43:03 +01:00
|
|
|
+ // Paper start
|
|
|
|
+ com.destroystokyo.paper.profile.PlayerProfile profile = org.bukkit.Bukkit.createProfile(uniqueId, playerName);
|
|
|
|
+ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId, profile);
|
2021-06-11 14:02:28 +02:00
|
|
|
server.getPluginManager().callEvent(asyncEvent);
|
2022-03-01 06:43:03 +01:00
|
|
|
+ profile = asyncEvent.getPlayerProfile();
|
|
|
|
+ profile.complete();
|
|
|
|
+ gameProfile = com.destroystokyo.paper.profile.CraftPlayerProfile.asAuthlibCopy(profile);
|
|
|
|
+ playerName = gameProfile.getName();
|
|
|
|
+ uniqueId = gameProfile.getId();
|
|
|
|
+ // Paper end
|
2021-06-11 14:02:28 +02:00
|
|
|
|
|
|
|
if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) {
|
|
|
|
final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId);
|