Solved Prevent Moving of Items in the Inventory

Discussion in 'Plugin Development' started by max12345, Jan 20, 2018.

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

    max12345

    Hi there,

    Whats the best way to prevent that items in the inventory can be moved? (Lobby - System, 1.12)

    Thanks!
     
  2. Offline

    Machine Maker

    InventoryMoveItemEvent is an event thats called when a player (or entity or block) changes something in an inventory. Listen for it and cancel it.
     
  3. Offline

    max12345

    I've tried it with this but that doesn't works:

    @EventHandler
    public void onMove(InventoryMoveItemEvent e) {
    e.setCancelled(true);
    }

    Items can still be moved
     
  4. Offline

    Machine Maker

    did you register the event?
     
  5. Offline

    max12345

    The class is registered...
     
  6. Offline

    Machine Maker

    Whoops sorry, you want to cancel inventory click event. That prevents the player from picking up an item in your inventory.
     
    max12345 likes this.
  7. Offline

    max12345

    SOLVED! Thanks!
     
Thread Status:
Not open for further replies.

Share This Page