Fix NPE when RTP center isn't set (#4251)

This commit is contained in:
triagonal 2021-06-20 02:23:00 +10:00 committed by GitHub
parent 003d556f3d
commit d4e194fbf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) {
}