/** * Get the custom spawn location of a world. If none is set, it will return the default. * * @param world World to get spawn for * @return Custom spawn or default spawn if not set */ public static Location getWorldSpawn(World world) { ConfManager cm = ConfManager.getConfManager("spawns.yml"); String w = world.getName(); Location l = cm.getLocation("spawns." + w, world.getName()); if (l == null) l = world.getSpawnLocation(); return l; }
/** * Gets the group-specific spawn for a player and a world. * * @param p Player to get spawn for * @param world World to get spawn for * @return null if no group-specific spawn or Location if existent */ private static Location getGroupSpawn(Player p, World world) { ConfManager cm = ConfManager.getConfManager("spawns.yml"); String group; try { if (!RoyalCommands.instance.vh.usingVault()) throw new UnsupportedOperationException(); group = RoyalCommands.instance.vh.getPermission().getPrimaryGroup(p); } catch (UnsupportedOperationException e) { group = null; } catch (NullPointerException e) { group = null; } if (group == null || group.isEmpty()) return null; group = "." + group.toLowerCase(); return cm.getLocation("spawns." + world.getName() + group, world.getName()); }