Esempio n. 1
0
 @Override
 public void close() {
   this.unloadChunks();
   for (String index : new ArrayList<>(this.regions.keySet())) {
     RegionLoader region = this.regions.get(index);
     try {
       region.close();
     } catch (IOException e) {
       throw new RuntimeException(e);
     }
     this.regions.remove(index);
   }
   this.level = null;
 }
Esempio n. 2
0
 @Override
 public void doGarbageCollection() {
   int limit = (int) (System.currentTimeMillis() - 300);
   for (Map.Entry entry : this.regions.entrySet()) {
     String index = (String) entry.getKey();
     RegionLoader region = (RegionLoader) entry.getValue();
     if (region.lastUsed <= limit) {
       try {
         region.close();
       } catch (IOException e) {
         throw new RuntimeException(e);
       }
       this.regions.remove(index);
     }
   }
 }
Esempio n. 3
0
  private void outputRegions(BufferedWriter writer, Collection<Feature> regions)
      throws IOException {
    List<Feature> mergedRegions = RegionLoader.collapseRegions(regions, 0);

    for (Feature region : mergedRegions) {
      writer.write(region.getSeqname() + "\t" + region.getStart() + "\t" + region.getEnd() + "\n");
    }
  }
Esempio n. 4
0
 @Override
 public boolean isChunkGenerated(int chunkX, int chunkZ) {
   RegionLoader region = this.getRegion(chunkX >> 5, chunkZ >> 5);
   return region != null
       && region.chunkExists(chunkX - region.getX() * 32, chunkZ - region.getZ() * 32)
       && this.getChunk(chunkX - region.getX() * 32, chunkZ - region.getZ() * 32, true)
           .isGenerated();
 }