Identify drop type?

Discussion in 'Plugin Development' started by zDubsCrazy, Feb 10, 2015.

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

    zDubsCrazy

    There are as identify whether the item was dropped using "Q" or if it was dropped by the mouse?

    @EDIT: or, some way to know which slot the item was, before being dropped.

    Thanks in advance.
     
    Last edited: Feb 10, 2015
  2. Offline

    Skionz

    @zDubsCrazy There isn't really a way to tell, but if is dropped by the mouse I would assume the InventoryClickEvent would be called.
     
    Konato_K likes this.
  3. Offline

    zDubsCrazy

    @Skionz
    Can you give me a example?
     
  4. @zDubsCrazy
    Code:
    public void onInventoryClick(InventoryClickEvent) {
    Player player = (Player) event.getWhoClicked();
    // Check if item is clicked
    // Check if item is in their inventory anymore
    // Do stuff
    }
     
  5. Offline

    zDubsCrazy

    @CodePlaysMinecraft
    That does not fit my case. I will try to express myself better:

    I want if the item is dropped, it does not get out of inventory, and return to the same slot that it was before.
     
  6. Offline

    TehHypnoz

    Can't you just cancel the item drop event? And before you are saying that if you drop it with your mouse it disappears, thats just a glitch. If you click in the empty slot the item will appear again.
     
  7. Offline

    WinX64

    Not the case, cancelling it will re-add the item on the first empty slot of your inventory, not the one it was before.
     
  8. Offline

    TehHypnoz

    If I cancel the ItemDropEvent it stays in the same slot.
     
  9. Offline

    WinX64

    Oops, i meant if the item is dropped using the second method, there's no way to the server know where the item was previously(This is where you're going to have to do some work, @zDubsCrazy), so, it is simply re-added on the first slot of your inventory.
     
  10. Offline

    zDubsCrazy

    @WinX64
    Yes, if the item is not on the hotbar has no way :/
     
Thread Status:
Not open for further replies.

Share This Page