Set amount of picking up item need help

Discussion in 'Spigot Plugin Development' started by maruf61, Jun 14, 2015.

  1. hey. i am working on an plugin i made some research but couldnt find anything :/

    Okey now my problem is i want to change amount of picking up item without cancel there anyway ?

    I tried this:

    Code (Text):

    ItemStack itemstack = event.getItem().getItemStack();
    itemstack.setAmount(10); //Just an example

    event.getItem().setItemStack(itemstack); //when ı debug this with "event.getItem().getItemStack()" it returns amount "10" but it still gives me all. like 64

    Thanks everyone who try to help.

    (english not my main language)
  2. That changes the item that is being picked up... after it was picked up.

    Apart from that, I don't think there is. You need to cancel the event and handle adding the item yourself.
  3. i see. i did that :) thanks.