Fix NPE console spam

This commit is contained in:
Christian Koop 2021-05-28 08:40:49 +02:00
parent 15ad11a6cb
commit a748a41313
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3
2 changed files with 20 additions and 12 deletions

View File

@ -214,11 +214,15 @@ public class MoveListeners implements Listener {
} else {
if (!player.getGameMode().equals(GameMode.CREATIVE) && !player.getGameMode().equals(GameMode.SPECTATOR)) {
if (plugin.getConfiguration().getBoolean("Island.Teleport.SafetyCheck", true)) {
Location safeLoc = LocationUtil.getSafeLocation(island.getLocation(world, IslandEnvironment.Visitor));
Location isLoc = island.getLocation(world, IslandEnvironment.Visitor);
if (isLoc != null) {
Location safeLoc = LocationUtil.getSafeLocation(isLoc);
if (safeLoc != null) {
loc = safeLoc;
}
}
}
} else {
loc = island.getLocation(world, IslandEnvironment.Visitor);
}

View File

@ -75,11 +75,15 @@ public class PortalPermission extends ListeningPermission {
if (island.hasRole(IslandRole.Visitor, player.getUniqueId())) {
if (plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Teleport.SafetyCheck", true)) {
Location safeLoc = LocationUtil.getSafeLocation(island.getLocation(IslandWorld.Normal, IslandEnvironment.Visitor));
Location isLoc = island.getLocation(IslandWorld.Normal, IslandEnvironment.Visitor);
if (isLoc != null) {
Location safeLoc = LocationUtil.getSafeLocation(isLoc);
if (safeLoc != null) {
to = safeLoc;
}
}
}
if (to == null) {
to = LocationUtil.getSpawnLocation();
}