CraftItemEvent question

Discussion in 'Plugin Development' started by Eggspurt, Jun 25, 2015.

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

    Eggspurt

    How would I check the amount of items I made?

    What I tried was

    Code:
    
        @EventHandler
        public void onCraftItem(CraftItemEvent event) {
        Player player = (Player)event.getWhoClicked();
        player.sendMessage("You've created: "+event.getCurrentItem().getAmount(), player);
        }
         
    
    And that gives the quantity of the item itself, say if I make slabs it would give me "6" but if I made several slabs it would still print 6.
     
  2. Offline

    Twisted_Panda

    getResult() ????
     
  3. Offline

    Eggspurt

    All that does is print "ALLOW"

    Which is returning the result, it doesn't give any information like that.
     
  4. Offline

    Twisted_Panda

    getInventory().getResult().getAmount()
    Don't have eclipse or anything check if it works(Looked at docs)
     
  5. Offline

    Eggspurt

    That provided the same thing as above, it prints "1" even if I make 32 at a time.
     
  6. Offline

    Twisted_Panda

    Because it's a crafting event the default is 6 for making stone slabs.
    Try checking for left shift click and right shift click and add up the amount created
     
  7. Offline

    Eggspurt

    I wasn't making Stone slabs I am just using buttons, I was just providing an example in my original post.
     
  8. Offline

    Twisted_Panda

    Code:
      int amountCreated = event.getCursor().getAmount();
    It checks how much is in your mouse cursor, just add checks for left shift click & right shift click.
     
  9. Offline

    Eggspurt

    It returns zero when I use shift :/
     
Thread Status:
Not open for further replies.

Share This Page