Drop item on floor if the inventory is full.

Discussion in 'Plugin Development' started by willeb96, Nov 16, 2012.

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

    willeb96

    I'm sure there's a really simple solution to this that I just can't think of.
    Any ideas?

    Thanks :)
     
  2. Offline

    YoshiGenius

    Code:
    if (player.getInventory().firstEmpty() == -1) {
        player.getWorld().dropItem(item, player.getLocation());
    }
    
    I hope that helped.
     
  3. Offline

    willeb96

    Thanks, but what if you have 1 dirt in each slot of your inventory and then someone gives you 1 dirt, then it wont be added to the inventory.
     
  4. Offline

    YoshiGenius

    Just do:

    player.getInventory().addItem(item);

    and get the HashMap returned by it of unfitting materials, so you know what didn't fit. Then drop them on the floor.
     
Thread Status:
Not open for further replies.

Share This Page