YEP-item attachments make the attach disappear after removing

The title I think it's self explanatory.
I'm creating weapons that can be modded (like barrels, scopes etc..) but I would like to have the attachments disappear once they are removed...so that the player can't use the same barrel for all his weapons..
I think the lunatic mode could be the answer..but I'm not very good with the JS, so I don't know what codes to use....please help me

Original thread: https://forums.rpgmakerweb.com/threads/yep-item-attachments-make-the-attach-disappear-after-removing.78484/