Modified file to avoid an NPE.

This commit is contained in:
tastybento 2023-12-30 12:22:05 +09:00
parent b2c4a2d929
commit 8d9a2597a0

View File

@ -118,12 +118,10 @@ public class AdminTeleportCommand extends CompositeCommand {
private Location getSpot(World world) { private Location getSpot(World world) {
Island island = getIslands().getIsland(world, targetUUID); Island island = getIslands().getIsland(world, targetUUID);
if (island != null && island.getSpawnPoint(world.getEnvironment()) != null) { if (island == null) {
// Return the defined spawn point return null;
return island.getSpawnPoint(world.getEnvironment());
} }
// Return the default island protection center return island.getSpawnPoint(world.getEnvironment()) != null ? island.getSpawnPoint(world.getEnvironment()) : island.getProtectionCenter().toVector().toLocation(world);
return island.getProtectionCenter().toVector().toLocation(world);
} }
@Override @Override