aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0380-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch
blob: e39c1d0ec7c0affc9bfadf3aae976faaaaa1bbc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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 fb6f5c43f2e06824b1e78404f422bee29ca40293..997f73e86d62b546e363382a3126bc43b4b17b7f 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2319,9 +2319,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
                     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());
             }