From d4e194fbf7148007c20c81267809c2af29ffd8e4 Mon Sep 17 00:00:00 2001 From: triagonal <10545540+triagonal@users.noreply.github.com> Date: Sun, 20 Jun 2021 02:23:00 +1000 Subject: [PATCH] Fix NPE when RTP center isn't set (#4251) --- .../main/java/com/earth2me/essentials/RandomTeleport.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Essentials/src/main/java/com/earth2me/essentials/RandomTeleport.java b/Essentials/src/main/java/com/earth2me/essentials/RandomTeleport.java index 8c2533860..f48eafd3f 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/RandomTeleport.java +++ b/Essentials/src/main/java/com/earth2me/essentials/RandomTeleport.java @@ -1,6 +1,7 @@ package com.earth2me.essentials; import com.earth2me.essentials.config.EssentialsConfiguration; +import com.earth2me.essentials.config.entities.LazyLocation; import com.earth2me.essentials.utils.LocationUtil; import com.earth2me.essentials.utils.VersionUtil; import io.papermc.lib.PaperLib; @@ -40,9 +41,9 @@ public class RandomTeleport implements IConf { public Location getCenter() { try { - final Location center = config.getLocation("center").location(); - if (center != null) { - return center; + final LazyLocation center = config.getLocation("center"); + if (center != null && center.location() != null) { + return center.location(); } } catch (final InvalidWorldException ignored) { }