コード例 #1
0
 @Override
 public GlowWorld getWorld(UUID uid) {
   for (GlowWorld world : worlds.getWorlds()) {
     if (uid.equals(world.getUID())) {
       return world;
     }
   }
   return null;
 }
コード例 #2
0
 @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;
 }
コード例 #3
0
 @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;
 }