@Override public GlowWorld getWorld(UUID uid) { for (GlowWorld world : worlds.getWorlds()) { if (uid.equals(world.getUID())) { return world; } } return null; }
@Override public Collection<GlowPlayer> getOnlinePlayers() { // todo: provide a view instead of reassembling the list each time ArrayList<GlowPlayer> result = new ArrayList<>(); for (GlowWorld world : worlds.getWorlds()) { for (GlowPlayer player : world.getRawPlayers()) { result.add(player); } } return result; }
@Override public boolean unloadWorld(World bWorld, boolean save) { if (!(bWorld instanceof GlowWorld)) { return false; } GlowWorld world = (GlowWorld) bWorld; if (save) { world.setAutoSave(false); world.save(false); } if (worlds.removeWorld(world)) { world.unload(); return true; } return false; }