Пример #1
0
  public void revalidateInZone(L2Character character) {
    // If the character can't be affected by this zone return
    if (_checkAffected) {
      if (!isAffected(character)) {
        return;
      }
    }

    // If the object is inside the zone...
    if (isInsideZone(character)) {
      // Was the character not yet inside this zone?
      if (!_characterList.containsKey(character.getObjectId())) {
        // Notify to scripts.
        EventDispatcher.getInstance()
            .notifyEventAsync(new OnCreatureZoneEnter(character, this), this);

        // Register player.
        _characterList.put(character.getObjectId(), character);

        // Notify Zone implementation.
        onEnter(character);
      }
    } else {
      removeCharacter(character);
    }
  }
Пример #2
0
  /**
   * Force fully removes a character from the zone Should use during teleport / logoff
   *
   * @param character
   */
  public void removeCharacter(L2Character character) {
    // Was the character inside this zone?
    if (_characterList.containsKey(character.getObjectId())) {
      // Notify to scripts.
      EventDispatcher.getInstance().notifyEventAsync(new OnCreatureZoneExit(character, this), this);

      // Unregister player.
      _characterList.remove(character.getObjectId());

      // Notify Zone implementation.
      onExit(character);
    }
  }
  @Override
  protected void runImpl() {
    final L2PcInstance player = getClient().getActiveChar();
    if (player == null) {
      return;
    }

    if (_change) {
      EventDispatcher.getInstance()
          .notifyEventAsync(new OnPlayerChangeToAwakenedClass(player), player);
    } else {
      player.sendPacket(ActionFailed.STATIC_PACKET);
    }
  }