From 482089379228eb93b2a423dd42f97d8138eaf325 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Thu, 3 Oct 2024 18:02:01 -0400 Subject: [PATCH] Fix NPE with dimension handling in online mode This change should be fine since all dimensions are iterated through in the registry cache --- .../java/org/geysermc/geyser/session/GeyserSession.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java index bfdf84bca..6493e812e 100644 --- a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java +++ b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java @@ -716,9 +716,10 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource { * Send all necessary packets to load Bedrock into the server */ public void connect() { - int minY = this.dimensionType.minY(); - int maxY = this.dimensionType.maxY(); - for (JavaDimension javaDimension : this.getRegistryCache().dimensions().values()) { + // Note: this.dimensionType may be null here if the player is connecting from online mode + int minY = BedrockDimension.OVERWORLD.minY(); + int maxY = BedrockDimension.OVERWORLD.maxY(); + for (JavaDimension javaDimension : this.registryCache.dimensions().values()) { if (javaDimension.bedrockId() == BedrockDimension.OVERWORLD_ID) { minY = Math.min(minY, javaDimension.minY()); maxY = Math.max(maxY, javaDimension.maxY());