Reset tool durability to default

Hi there, pie_flavor

Unfortunately, I must be working with copies, because if I remove the line setting the item back into the hand, the item is not updated. I started using that line because of this forum post

Thank you for your advice about the text, string and optionals. I was unable to do the latter, despite looking at the docs, due to lack of experience and familiarity with both optionals and the Sponge api.

I was also unable to incorporate your last piece of advice about getting the default property of UseLimitProperty, as I was getting the error below in console, accompanied by “Error occurred while executing command: No Value Present” in the chat.

[15:40:06] [Server thread/ERROR] [Sponge]: Error occurred while executing command ‘repair’ for source EntityPlayerMP[‘SparkVGX’/38, l=‘world’, x=39.16, y=88.00, z=10.07]: No value present
java.util.NoSuchElementException: No value present
at java.util.Optional.get(Optional.java:135) ~[?:1.8.0_91]

This happened regardless of item it was used on. Please forgive me, but could provide an example of how I should be using

itemInHand.getItem().getDefaultProperty(UseLimitProperty.class).get().getValue()