Discussion in 'Spigot Plugin Development' started by Buby, May 11, 2016.

  1. Hey spigot, I made a custom enchants plugin that has a laser enchant that shoots an egg and breaks the block, how do I make it so it picks the items instantly and sends it to the player's inv. I also have a drill enchant, which I want the items to automatically send the items to the player's inv aswell. but how do I implement enchants to it. I have tried block.breakNaturally(item); but it seems to now work w/ fortune
  2. MiniDigger


    on block break remove the drops and add them to the players inv
  3. As far as I know that does work with fortune. Just pass the tool (with the fortune enchant) as the item. If it doesn't work it's most likely a Spigot bug, because it should work as far as I know.
  4. yes, I know the method, I just don't know a code to implement it
  5. Try remove the drop, use the getDrops, and add the drops to the player inventory.
  6. As I said earlier, I already know the method I just don't know the code eto implement it. if i do player.getInventory().addItem() you can only add one item
  7. That's why you loop through each item.
  8. You can actually add an ItemStack[] of items ;) Arrays are your friends.
  9. You can get the drops from the event and return an array of ItemStacks, then simply add them to the player's inventory.
    #10 ChefJava, May 12, 2016
    Last edited: May 12, 2016
  10. Make sure you handle the case when a players inventory is full (unless you want pissed off players ;)).
    • Agree Agree x 1