Minecraft tools indestructible, plugin programming?

Ma
- in Plugins
12

I'm currently trying to write a plugin that makes tools indestructible. Spigot 1.8 I tried to cancel the PlayerItemDamageEvent and tried with e.getItem (). SetDurability (e.getItem (). GetType (). GetMaxDurability ()); to reset the shelf life. Neither works. How do I make the tools and armor not lose durability?

st

ItemStack is = event.getItem ();
ItemMeta i'm = is.getItemMeta ();
i'm.spigot (). SetUnbreakable (true);
is.setItemMeta (i'm);

And with every item

Ma

For me it doesn't look right (otherwise an idea?): See the question above.

Sh

What do you want exactly? Certainly make items feasible or all?

Ma

All

Sh

So actually the proposal from xJesus works. What's the problem?

Ma

The pick loses durability and the texture of the sword is forbidden after the first damage

an

So actually it should work.

Did you spell everything correctly?

Is there an error in the console?

Ma

Yes it is typed correctly and the console does not issue an error message.

Sh

Then something is wrong with your Minecraft. Also the plugin on it and reloaded?

Ma

Minecraft agrees I have two devices on which both the problem appears, plugin is reloaded and server restarted.

Sh

Which MC version?

Ma

Java 1.8 as written above.