Discussion in 'Plugin Development' started by qkr, Jul 3, 2021.
I want to make plugin like this: players who have a diamond click right clicking, It becomes 2
@qkr And the question is?
so how can I make it?
What have you tried?
If you want to make it so that when you click a diamond it doubles you need to make a "PlayerInteractEvent".
Then you check if the clicked item is Material.DIAMOND and if so set the amount two 2/double the previous amount.
Ok I understood almost but how to set the amount 2/double the previous amount?
Hi you're on online do you know how to set the amount 2/double the previous amount?
EDIT by Moderator: merged posts, please use the edit button instead of double posting.
This is a forum; he will answer when he has the time. Also, he has no obligation to help you.
Get the amount using ItemStack#getAmount().
Multiply the amount by 2.
Set the new amount using ItemStack#setAmount(int).
Note: You might want to max the amount by the material's maximum (usually 64, but it is 16 for ender pearls, for example).
Thank you so much. I dont know how to express my feeling!!!
You could express that feeling by setting the forum to "solved"
Edit: Thread, not forum
Separate names with a comma.