mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 15:49:00 +01:00
Fix NPE when no valid world is found on legacy Players (#9885)
This commit is contained in:
parent
5df63ec242
commit
374f24c159
1 changed files with 22 additions and 0 deletions
|
@ -0,0 +1,22 @@
|
||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||||
|
Date: Sat, 28 Oct 2023 23:21:49 -0700
|
||||||
|
Subject: [PATCH] Fix NPE when no valid world is found on legacy Players
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
|
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 {
|
||||||
|
Logger logger = PlayerList.LOGGER;
|
||||||
|
|
||||||
|
Objects.requireNonNull(logger);
|
||||||
|
- resourcekey = (ResourceKey) dataresult.resultOrPartial(logger::error).orElse(player.serverLevel().dimension()); // CraftBukkit - SPIGOT-7507: If no dimension, fall back to existing dimension loaded from "WorldUUID", which in turn defaults to World.OVERWORLD
|
||||||
|
+ resourcekey = (ResourceKey) dataresult.resultOrPartial(logger::error).orElse(player.serverLevel() != null ? player.serverLevel().dimension() : Level.OVERWORLD); // CraftBukkit - SPIGOT-7507: If no dimension, fall back to existing dimension loaded from "WorldUUID", which in turn defaults to World.OVERWORLD // Paper - account for null level
|
||||||
|
} else {
|
||||||
|
- resourcekey = player.serverLevel().dimension(); // CraftBukkit - SPIGOT-7507: If no dimension, fall back to existing dimension loaded from "WorldUUID", which in turn defaults to World.OVERWORLD
|
||||||
|
+ resourcekey = player.serverLevel() != null ? player.serverLevel().dimension() : Level.OVERWORLD; // CraftBukkit - SPIGOT-7507: If no dimension, fall back to existing dimension loaded from "WorldUUID", which in turn defaults to World.OVERWORLD // Paper - account for null level
|
||||||
|
}
|
||||||
|
|
||||||
|
ResourceKey<Level> resourcekey1 = resourcekey;
|
Loading…
Reference in a new issue