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

26 lines
1.3 KiB
Diff
Raw Permalink Normal View History

2023-12-29 19:48:29 +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-01-02 23:08:05 +00:00
index ca309311928654ca7e971e98114d7c16d8341a55..4d3faab706e04c1ad495a59e6523524730a48f70 100644
2023-12-29 19:48:29 +00:00
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
2024-01-02 23:08:05 +00:00
@@ -1693,7 +1693,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
2023-12-29 19:48:29 +00:00
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();
+ }
+ // Scissors end
}
this.entityLookup.addNewEntity(player); // Paper - rewite chunk system