Пример #1
0
  @Override
  public synchronized void loadChunk(int cx, int cz, World world) {
    if (world == null) return;

    if (store.containsKey(world.getName() + "," + cx + "," + cz)) return;

    ChunkStore in = null;

    UUID key = world.getUID();
    if (!this.oldData.containsKey(key))
      this.oldData.put(key, (new File(world.getWorldFolder(), "mcmmo_data")).exists());

    if (this.oldData.containsKey(key) && oldData.get(key))
      convertChunk(new File(world.getWorldFolder(), "mcmmo_data"), cx, cz, world, true);

    try {
      in = readChunkStore(world, cx, cz);
    } catch (Exception e) {
    }

    if (in != null) {
      store.put(world.getName() + "," + cx + "," + cz, in);

      List<UUID> mobs = in.getSpawnedMobs();
      List<UUID> pets = in.getSpawnedPets();

      if (mobs.isEmpty() && pets.isEmpty()) return;

      for (LivingEntity entity : world.getLivingEntities()) {
        if (mobs.contains(entity.getUniqueId())) addSpawnedMob(entity);

        if (pets.contains(entity.getUniqueId())) addSpawnedPet(entity);
      }

      in.clearSpawnedMobs();
      in.clearSpawnedPets();
    }
  }