Exemplo n.º 1
0
  @Override
  public void operate(Player player, IncomingPacket packet) {
    int clickY = packet.readLittleEndianShort();
    int clickIndex = packet.getBuffer().getShort();
    int clickX = packet.readLittleEndianShort();

    player.putAttribute("click-y", clickY);
    player.putAttribute("click-index", clickIndex);
    player.putAttribute("click-x", clickX);

    if (player.hasAttribute("banking")) {
      return;
    }

    if (!player.getInventoryContainer().canHoldItem(player.getAttributeAsInteger("click-index"))) {
      player.send(
          new ChatBoxMessagePacket(
              "You don't have the required inventory space to hold this item."));
      return;
    }

    PulseScheduler.getInstance()
        .register(new InteractionDistancePulse(player, InteractionType.RETREIVE_ITEM));
  }