InventoryDragEvent

Discussion in 'Plugin Development' started by xELI7E_SNIPEZx, Mar 9, 2014.

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

    xELI7E_SNIPEZx

    I don't quite get the API for this event, so how would i cancel dragging an item out of their inventory into like a chest for example. I want them to be able to drag the item round their inventory just not into a chest. I've already sorted the drop events etc. It's just the DragEvent.
     
  2. Offline

    RawCode

    post code.
     
  3. Offline

    GameplayJDK

    You only can seperate between inventory, chast inventory, funace inventory, ...
    Try this:
    Code:java
    1.  
    2. // Doc: [url]http://jd.bukkit.org/rb/apidocs/org/bukkit/event/inventory/InventoryDragEvent.html[/url]
    3. // ! Untested code
    4. // Use an eventlistener
    5. @EventHandler
    6. public void onDrag(InventoryDragEvent event) {
    7. if (event.getInventory().geType() == InventoryType.CHEST) {
    8. event.setCanceled(true);
    9. }
    10. }
    11. // There are more way to do it, and ways of doing it better, I think you should read the doc on the 'result' of the InventoryDragEvent
    12.  
     
Thread Status:
Not open for further replies.

Share This Page