Beispiel #1
0
 /**
  * Gets a list of loaded chunks.
  *
  * @return The currently loaded chunks.
  */
 public GlowChunk[] getLoadedChunks() {
   ArrayList<GlowChunk> result = new ArrayList<>();
   for (GlowChunk chunk : chunks.values()) {
     if (chunk.isLoaded()) {
       result.add(chunk);
     }
   }
   return result.toArray(new GlowChunk[result.size()]);
 }
Beispiel #2
0
 /**
  * Performs the save for the given chunk using the storage provider.
  *
  * @param chunk The chunk to save.
  */
 public boolean performSave(GlowChunk chunk) {
   if (chunk.isLoaded()) {
     try {
       service.write(chunk);
       return true;
     } catch (IOException ex) {
       GlowServer.logger.log(Level.SEVERE, "Error while saving " + chunk, ex);
       return false;
     }
   }
   return false;
 }