Paper/patches/server/0435-Spawn-player-in-correct-world-on-login.patch
Spottedleaf c1def9d852 Updated Upstream (CraftBukkit/Spigot)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
fd92f1e65 SPIGOT-7378: Add BlockDropItemEvent for Suspicious Sand & Gravel drops
cb1b69d13 SPIGOT-7377: Server sends player list twice

Spigot Changes:
16cfc987 Rebuild patches
2023-06-08 16:47:58 -07:00

31 lines
1.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Wyatt Childers <wchilders@nearce.com>
Date: Fri, 3 Jul 2020 14:57:05 -0400
Subject: [PATCH] Spawn player in correct world on login
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 3c98a55a1b9eee854d8c48af449b876d3a46501f..0cd93062ffc2bf824e99f8776254a5269e9117c3 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -212,7 +212,18 @@ public abstract class PlayerList {
}
// CraftBukkit end
- if (nbttagcompound != null) {
+ // Paper start - move logic in Entity to here, to use bukkit supplied world UUID.
+ if (nbttagcompound != null && nbttagcompound.contains("WorldUUIDMost") && nbttagcompound.contains("WorldUUIDLeast")) {
+ UUID uid = new UUID(nbttagcompound.getLong("WorldUUIDMost"), nbttagcompound.getLong("WorldUUIDLeast"));
+ org.bukkit.World bWorld = org.bukkit.Bukkit.getServer().getWorld(uid);
+ if (bWorld != null) {
+ resourcekey = ((CraftWorld) bWorld).getHandle().dimension();
+ } else {
+ resourcekey = Level.OVERWORLD;
+ }
+ } else if (nbttagcompound != null) {
+ // Vanilla migration support
+ // Paper end
DataResult<ResourceKey<Level>> dataresult = DimensionType.parseLegacy(new Dynamic(NbtOps.INSTANCE, nbttagcompound.get("Dimension"))); // CraftBukkit - decompile error
Logger logger = PlayerList.LOGGER;