Solved Get a InventoryClickEvent and update another inventory

Discussion in 'Plugin Development' started by PunditPoe, Apr 5, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    PunditPoe

    Ok, I'm making a trade plugin.

    When the trade is accepted by the target player it opens a "top" inventory, like a chest inventory (also saw people calling it 'virtual inventory'), and it has a Emeral Block. The thing is, when the players place items to exchange they havo to click on the Emerald Block to "send" de confirmation that they accept to trade the item that he placed to the item that the other player placed.
    So, I can get the InventoryClickEvent from playerA on the Emerald Block, when that happens I want to appear a Emerald Block on playerB's "top" inventory. But I can't figure out how to "get" that inventory, to use:
    Code:
    setItem(slot, itemstack);
    If I use:
    Code:
    palyerB.getInventory();
    it doesn't return the top inventory, just the container, the normal one.

    So, how to do that?

    Resume: I get a InventoryClickEvent on playerA's top inventory and want to update playerB's top inventory.
     
  2. Offline

    xaanit

    You'll want to get playerB.getOpenInventory();

    Should fix your problems.
     
    PunditPoe likes this.
  3. Offline

    PunditPoe

    Code:
    playerB.getOpenInventory().getTopInventory();
    Worked. Thanks, dude!
     
Thread Status:
Not open for further replies.

Share This Page