Solved Selecting new inventory slots

Discussion in 'Plugin Development' started by wydgabriel, May 11, 2016.

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

    wydgabriel

    Hello guys. I'm trying to get the slot int of a new inventory (Bukkit.createInventory())
    But, if I select slot 1, it selects player's inventory slot 1 too..
    Someone know how to only make a function above the new inventory slot?
    http://prntscr.com/b2y6xq
     
  2. Offline

    Zombie_Striker

    @wydgabriel

    Make sure the 'inventoryview' is either the top or bottom. Use the following:
    Code:
    Inventory.getTopInventory().getSlot()
     
  3. Offline

    wydgabriel

    this getTopInventory().getSlot() doesnt exists :/
     
  4. Offline

    mcdorli

    Because you need to get it from the inventory, not from this
     
  5. Offline

    wydgabriel

    So, I made another method, that seems make sense but it actually dont work..


    if (e.getInventory() == e.getView().getTopInventory()){
    if (e.getSlot() < 8) {


    How do I do that?
     
  6. Offline

    mcdorli

  7. Offline

    wydgabriel

    Even with equals, it dont work

    Solved.
    if (e.getClickedInventory().equals(e.getView().getTopInventory())){
    if (e.getSlot() == 0) {

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
Thread Status:
Not open for further replies.

Share This Page