Scissors/patches/server/0037-Prevent-player-banning-using-duplicate-UUIDs.patch
Telesphoreo 190be49a0e
Update Paper (#147)
* apply patches that i can

* add a few

* add rest of patches

* reorder patches

* reorder patches
2024-04-16 00:12:25 -05:00

26 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Luna <lunahatesgogle@gmail.com>
Date: Fri, 28 Apr 2023 16:44:50 -0300
Subject: [PATCH] Prevent player banning using duplicate UUIDs
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 502bdc726b7890b00ee36871d905dea44e8719e3..1fbc8b372271bb4cd4375ca6b6b1d7e7961094fb 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1667,7 +1667,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (entity != null) {
ServerLevel.LOGGER.warn("Force-added player with duplicate UUID {}", player.getUUID());
entity.unRide();
- this.removePlayerImmediately((ServerPlayer) entity, Entity.RemovalReason.DISCARDED);
+ // Scissors start - Prevent player banning using duplicate UUIDs
+ if (entity instanceof ServerPlayer serverPlayer) {
+ this.removePlayerImmediately(serverPlayer, Entity.RemovalReason.DISCARDED);
+ } else {
+ entity.discard(null);
+ }
+ // Scissors end
}
this.entityLookup.addNewEntity(player); // Paper - rewite chunk system