public static Location getEvacuation(Player player) { World world = player.getWorld(); String[] portalnames; if (Permission.has(player, "world.spawn") || Permission.has(player, "tpp")) { for (Position pos : getSpawnPoints()) { Location loc = pos.toLocation(); if (loc.getWorld() == null) continue; if (Permission.canEnter(player, loc.getWorld())) { return loc; } } portalnames = Portal.getPortals(); } else { portalnames = Portal.getPortals(world); } for (String name : portalnames) { if (Permission.canEnterPortal(player, name)) { Location loc = Portal.getPortalLocation(name, player.getWorld().getName(), true); if (loc == null) continue; if (loc.getWorld() == null) continue; if (Permission.canEnter(player, loc.getWorld())) { return loc; } } } return null; }
public static Location getRespawnLocation(String ofWorld) { Position pos = getRespawn(ofWorld); if (pos != null) { Location loc = pos.toLocation(); if (loc.getWorld() != null) { return loc; } } return null; }