Paper/patches/server/0409-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch
Shane Freeder 2f31569807
Updated Upstream (Bukkit/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

Bukkit Changes:
9115281f SPIGOT-6832: Improve Player#getPing docs

CraftBukkit Changes:
fd3478bc7 #967: Store last lava contact location for events

Spigot Changes:
dbf49382 Rebuild patches
58cb9d26 #113: Use simulationDistance for entity activation range base
2021-12-03 21:28:15 +00:00

28 lines
1.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: 2277 <38501234+2277@users.noreply.github.com>
Date: Tue, 31 Mar 2020 10:33:55 +0100
Subject: [PATCH] Move player to spawn point if spawn in unloaded world
The code following this has better support for null worlds to move
them back to the world spawn.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index fa4242cb9bd5b8b5a088585a6709d0b27835a261..12f00a6d3b4335aa8f60646ac129dd481082feec 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1998,9 +1998,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
bworld = server.getWorld(worldName);
}
- if (bworld == null) {
- bworld = ((org.bukkit.craftbukkit.CraftServer) server).getServer().getLevel(Level.OVERWORLD).getWorld();
- }
+ // Paper start - Move player to spawn point if spawn in unloaded world
+// if (bworld == null) {
+// bworld = ((org.bukkit.craftbukkit.CraftServer) server).getServer().getWorldServer(World.OVERWORLD).getWorld();
+// }
+ // Paper end - Move player to spawn point if spawn in unloaded world
((ServerPlayer) this).setLevel(bworld == null ? null : ((CraftWorld) bworld).getHandle());
}