示例#1
0
  @Override
  public void processPacket(Player p, int packetType, int packetSize) {
    int usedWithSlot = p.getInStream().readUnsignedWord();
    int itemUsedSlot = p.getInStream().readUShortA();
    int useWith = p.playerItems[usedWithSlot] - 1;
    int itemUsed = p.playerItems[itemUsedSlot] - 1;
    UseItem.ItemonItem(p, itemUsed, useWith);

    if (p.getRights().equals(Rights.DEVELOPER) && Configuration.SERVER_DEBUG) {
      p.sendMessage(
          "itemUsed: "
              + itemUsed
              + " useWith: "
              + useWith
              + " itemUsedSlot: "
              + itemUsedSlot
              + " usedWithSlot: "
              + usedWithSlot);
    }
  }
示例#2
0
  @Override
  public void processPacket(Player c, int packetType, int packetSize) {
    int tradeId = c.getInStream().readLEShort();
    c.getActionSender().resetFollow();

    if (c.isTrading) {
      return;
    }

    if (c.arenas()) {
      c.sendMessage("You can't trade inside the arena!");
      return;
    }

    if (c.getRights().equal(Rights.ADMINISTRATOR) && !Configuration.ADMIN_CAN_TRADE) {
      c.sendMessage("Trading as an admin has been disabled.");
      return;
    }

    if (tradeId < 1) return;

    if (tradeId != c.playerId) c.getTrade().requestTrade(tradeId);
  }