From 7d091ee9701112f44b7e7d562456f83faeace06f Mon Sep 17 00:00:00 2001 From: elmital <54907162+elmital@users.noreply.github.com> Date: Sun, 2 Apr 2023 20:37:53 +0200 Subject: [PATCH] fix: null SpawnReason for new player (#9015) --- .../Don-t-move-existing-players-to-world-spawn.patch | 11 +++++------ patches/server/Entity-getEntitySpawnReason.patch | 12 ++++++++++++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/patches/server/Don-t-move-existing-players-to-world-spawn.patch b/patches/server/Don-t-move-existing-players-to-world-spawn.patch index fa94a3a2e9..ee3b0cd67f 100644 --- a/patches/server/Don-t-move-existing-players-to-world-spawn.patch +++ b/patches/server/Don-t-move-existing-players-to-world-spawn.patch @@ -39,11 +39,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { - worldserver1 = worldserver; + // Paper + if (nbttagcompound == null) { + player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login ++ player.fudgeSpawnLocation(worldserver1); // only move to spawn on first login, otherwise, stay where you are.... } - -+ if (nbttagcompound == null) player.fudgeSpawnLocation(worldserver1); // Paper - only move to spawn on first login, otherwise, stay where you are.... -+ + // Paper player.setLevel(worldserver1); - String s1 = "local"; - diff --git a/patches/server/Entity-getEntitySpawnReason.patch b/patches/server/Entity-getEntitySpawnReason.patch index 36d2f06af7..12e6da3e23 100644 --- a/patches/server/Entity-getEntitySpawnReason.patch +++ b/patches/server/Entity-getEntitySpawnReason.patch @@ -25,6 +25,18 @@ diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/ma index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -0,0 +0,0 @@ public abstract class PlayerList { + worldserver1 = worldserver; + } + ++ // Paper ++ if (nbttagcompound == null) { ++ player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login ++ } ++ // Paper + player.setLevel(worldserver1); + String s1 = "local"; + @@ -0,0 +0,0 @@ public abstract class PlayerList { // CraftBukkit start ServerLevel finalWorldServer = worldserver1;