Scissors/patches/server/0037-Prevent-player-banning-using-duplicate-UUIDs.patch

26 lines
1.3 KiB
Diff
Raw Normal View History

2023-04-28 19:50:48 +00:00
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
2024-02-24 22:32:31 +00:00
index 6907d1be36fbdf0856c0e11983218d2fd1f9cb46..298c8a9cd08425e9aa4f222b98d95d92b80951e6 100644
2023-04-28 19:50:48 +00:00
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
2024-01-24 22:30:21 +00:00
@@ -1667,7 +1667,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
2023-04-28 19:50:48 +00:00
if (entity != null) {
2023-09-24 22:01:28 +00:00
ServerLevel.LOGGER.warn("Force-added player with duplicate UUID {}", player.getUUID());
2023-04-28 19:50:48 +00:00
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 {
2024-02-24 22:32:31 +00:00
+ entity.discard(null);
2023-04-28 19:50:48 +00:00
+ }
+ // Scissors end
}
this.entityLookup.addNewEntity(player); // Paper - rewite chunk system