Example #1
0
 @Override
 public void dropItem(Player player, ItemInstance item, long count, Location loc) {
   if (item.isEquipped()) {
     player.getInventory().unEquipItem(item);
     player.sendUserInfo();
   }
   item = player.getInventory().removeItemByObjectId(item.getObjectId(), count);
   if (item == null) {
     player.sendActionFailed();
     return;
   }
   Log.LogItem(player, Log.Drop, item);
   item.dropToTheGround(player, loc);
   player.disableDrop(1000);
   player.sendChanges();
 }
  /** Method runImpl. */
  @Override
  protected void runImpl() {
    Player activeChar = getClient().getActiveChar();

    if (activeChar == null) {
      return;
    }

    if (activeChar.getNoChannel() != 0) {
      if ((activeChar.getNoChannelRemained() > 0) || (activeChar.getNoChannel() < 0)) {
        activeChar.sendPacket(
            new SystemMessage(
                SystemMessage
                    .CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_BECOME_EVEN_LONGER));
        return;
      }

      activeChar.updateNoChannel(0);
    }

    Player targetPlayer = World.getPlayer(_reciever);

    if (targetPlayer == null) {
      activeChar.sendPacket(new SystemMessage(SystemMessage.THAT_PLAYER_IS_NOT_ONLINE));
      return;
    }

    if (targetPlayer.isBlockAll()) {
      activeChar.sendPacket(
          new SystemMessage(SystemMessage.THE_PERSON_IS_IN_A_MESSAGE_REFUSAL_MODE));
      return;
    }

    if (!activeChar.getFriendList().getList().containsKey(targetPlayer.getObjectId())) {
      return;
    }

    Log.LogChat("FRIENDTELL", activeChar.getName(), _reciever, _message);
    L2FriendSay frm = new L2FriendSay(activeChar.getName(), _reciever, _message);
    targetPlayer.sendPacket(frm);
  }