If i remember correcty, the deleted part regarding the item storage in a temporary inventory slot is to refresh the visual information regarding the broken state, otherwise it gives a false impression to the player, that the item broken, but still provide the full stats. It meant to place back on the original slot the broken item. I will take a look on this when i have time, but the original code shall have no more overrite issue.
Please post your full configuration for debug purpose.
Side note, please do not post even a partial code of a paid plugin. In case of code suggestion, send a private message with the details.