Paper/Spigot-Server-Patches/0452-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch

28 lines
1.5 KiB
Diff
Raw Normal View History

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 896b4d016de78e98276d7cdf9328d8951572e3be..fbd473d39cd71510b5fe8b7a4d34d3b824301f73 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1809,9 +1809,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
bworld = server.getWorld(worldName);
}
- if (bworld == null) {
- bworld = ((org.bukkit.craftbukkit.CraftServer) server).getServer().getWorldServer(World.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
spawnIn(bworld == null ? null : ((CraftWorld) bworld).getHandle());
}