I would like to indestructible the item that comes out after crafting. Maybe someone can write me a small sample code.
Here is a part of the code:
Just catch up on all events where the item in question could be damaged, and then check the item name, for example. If the item name from the event then coincides with the item which is to be indestructible, you can enter there in the event e.g. Prevent the item from taking damage.
Unfortunately does not help me.
If you think that the Durability does not go down:
item.spigot () setUnbreakable (true).
or
meta.spigot () setUnbreakable (true).
if so meant as bedrock
@EventHandler
public void onBlockBreak (BlockBreakEvent e) {
// cancel here if item is
}
Many Thanks!
It's a pleasure
After a little 5-minute search, I found the following:
meta.spigot () setUnbreakable (true).