Example #1
0
  /**
   * Create all default world map instances according to template<br>
   * For non-instances with undefined twin count - default to one channel<br>
   * <br>
   * Note that worldMap object should already be in {@code world} mapping
   *
   * @param template
   */
  private void initializeWorldMap(WorldMapTemplate template) {

    // dont initialize instance-type maps
    if (template.isInstance()) return;

    int twinCount = template.getTwinCount();
    // for non-instances with not defined twin count - default to 1 channel
    if (twinCount == 0 && !template.isInstance()) twinCount = 1;
    for (int i = 0; i < twinCount; i++) {
      worldInstanceService.createNewInstance(template.getTemplateId());
    }

    WorldMap worldMap = world.getWorldMap(template.getTemplateId());
    if (worldMap.size() > 0)
      log.info(
          "Initialized {} world map with {} channel(s)", template.getTemplateId(), worldMap.size());
  }
Example #2
0
 @Override
 public boolean isInstance(int mapId) {
   WorldMap worldMap = world.getWorldMap(mapId);
   return worldMap != null ? worldMap.getWorldMapTemplate().isInstance() : false;
 }