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) {
Island island = getIslands().getIsland(world, targetUUID);
if (island != null && island.getSpawnPoint(world.getEnvironment()) != null) {
// Return the defined spawn point
return island.getSpawnPoint(world.getEnvironment());
if (island == null) {
return null;
}
// Return the default island protection center
return island.getProtectionCenter().toVector().toLocation(world);
return island.getSpawnPoint(world.getEnvironment()) != null ? island.getSpawnPoint(world.getEnvironment()) : island.getProtectionCenter().toVector().toLocation(world);
}
@Override