/** Instance will be destroyed All players moved to bind location All objects - deleted */
  private static void destroyInstance(WorldMapInstance instance) {
    instance.getEmptyInstanceTask().cancel(false);

    int worldId = instance.getMapId();
    int instanceId = instance.getInstanceId();

    WorldMap map = World.getInstance().getWorldMap(worldId);
    map.removeWorldMapInstance(instanceId);

    log.info("Destroying instance:" + worldId + " " + instanceId);

    Iterator<VisibleObject> it = instance.objectIterator();
    while (it.hasNext()) {
      VisibleObject obj = it.next();
      if (obj instanceof Player) {
        Player player = (Player) obj;
        PortalTemplate portal =
            DataManager.PORTAL_DATA.getInstancePortalTemplate(
                worldId, player.getCommonData().getRace());
        moveToEntryPoint((Player) obj, portal, true);
      } else {
        obj.getController().delete();
      }
    }
  }
Пример #2
0
 public void delVisualObject(VisibleObject object, boolean isOutOfRange) {
   if (visualObjects.remove(object.getObjectId()) != null) {
     if (visualPlayers != null) {
       visualPlayers.remove(object.getObjectId());
     }
     owner.getController().notSee(object, isOutOfRange);
   }
 }
Пример #3
0
  public void addVisualObject(VisibleObject object) {
    if (object instanceof Creature) {
      if (SecurityConfig.INVIS && object instanceof Player) {
        if (!owner.canSee((Player) object)) {
          return;
        }
      }

      if (visualObjects.put(object.getObjectId(), object) == null) {
        if (object instanceof Player) {
          checkVisiblePlayersInitialized();
          visualPlayers.put(object.getObjectId(), (Player) object);
        }
        owner.getController().see(object);
      }
    } else if (visualObjects.put(object.getObjectId(), object) == null) {
      owner.getController().see(object);
    }
  }