Yatopia/patches/server/0018-EMC-Allow-changing-of-player-name-in-Prelogin.patch
2020-02-26 20:12:29 +01:00

30 lines
1.5 KiB
Diff

From a9ec46dca1402c4022dcda8e4c0b5178a4a88966 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 28 Jan 2015 01:01:17 -0500
Subject: [PATCH] EMC Allow changing of player name in Prelogin
This is so we can disable player renames and force them to use old name temporarily.
---
src/main/java/net/minecraft/server/LoginListener.java | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
index f1222fcb..99541fd3 100644
--- a/src/main/java/net/minecraft/server/LoginListener.java
+++ b/src/main/java/net/minecraft/server/LoginListener.java
@@ -316,6 +316,11 @@ public class LoginListener implements PacketLoginInListener {
uniqueId = i.getId();
// Paper end
+ // EMC start
+ GameProfile old = i;
+ i = new GameProfile(uniqueId, asyncEvent.getName());
+ i.getProperties().putAll(old.getProperties());
+ // EMC end
if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) {
final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId);
if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) {
--
2.25.1.windows.1