Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
30 Zeilen
2.1 KiB
Diff
30 Zeilen
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 145f3eae6622453d47769e10fb30ce8d31d5f847..53e8804b8ee35acdc2c4b3cbe2bc409242840726 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
@@ -393,8 +393,16 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
|
|
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);
|