private static boolean checkPool(SpawnGroup2 spawn) {
   if (spawn.getSpawnTemplates().size() < spawn.getPool()) {
     log.warn(
         "Pool size more then spots, npcId: "
             + spawn.getNpcId()
             + ", worldId: "
             + spawn.getWorldId());
     return false;
   }
   return true;
 }
  /**
   * @param worldId
   * @param instanceId
   */
  public static void spawnInstance(int worldId, int instanceId, byte difficultId, int ownerId) {
    List<SpawnGroup2> worldSpawns = DataManager.SPAWNS_DATA2.getSpawnsByWorldId(worldId);
    StaticDoorSpawnManager.spawnTemplate(worldId, instanceId);

    int spawnedCounter = 0;
    if (worldSpawns != null) {
      for (SpawnGroup2 spawn : worldSpawns) {
        int difficult = spawn.getDifficultId();
        if (difficult != 0 && difficult != difficultId) {
          continue;
        }
        if (spawn.isTemporarySpawn()) {
          TemporarySpawnEngine.addSpawnGroup(spawn);
        } else {
          if (spawn.getHandlerType() != null) {
            switch (spawn.getHandlerType()) {
              case RIFT:
                RiftManager.addRiftSpawnTemplate(spawn);
                break;
              case STATIC:
                StaticObjectSpawnManager.spawnTemplate(spawn, instanceId);
              default:
                break;
            }
          } else if (spawn.hasPool() && checkPool(spawn)) {
            for (int i = 0; i < spawn.getPool(); i++) {
              SpawnTemplate template = spawn.getRndTemplate();
              if (template == null) break;
              spawnObject(template, instanceId);
              spawnedCounter++;
            }
          } else {
            for (SpawnTemplate template : spawn.getSpawnTemplates()) {
              spawnObject(template, instanceId);
              spawnedCounter++;
            }
          }
        }
      }
      WalkerFormator.getInstance().organizeAndSpawn();
    }
    log.info("Spawned " + worldId + " [" + instanceId + "] : " + spawnedCounter);
    HousingService.getInstance().spawnHouses(worldId, instanceId, ownerId);
  }