Clear a specific item Minecraft Command

I'm building a boss battle, where the boss is holding a button. When you kill the boss the button will drop.

But when a player die, I've done so, that the boss dies too. Sadly, the button drops, and now the player can just pick up the button and win.

Do you guys have any solution to my problem? I can probrably just tp the existing zombie into a lava pool, but is there an easier way?


i'm unsure about whether or not you're talking about clearing off the floor, or out of someone's inventory, so i'll going to give an example of both to be safe.

to clear out of someone's inventory, you would do /clear <entity/player> <item> <max amount>. for a very specific item, you'd need to add NBT tags to the <item> part-- for example, if i wanted to clear everyone of 5 sticks with sharpness 500, i would need to type /clear @a stick{Enchantments:[{id:"sharpness",lvl:500}]} 5. this also goes for named items, but if you want to use its name as the item then it'll involve the {display:{Name:}} method, which i myself don't know a lot of.

to kill the item entity, thus clearing the floor, you would use /kill @e[type=item], with other selectors on it other than type. for example, if i wanted to kill a dropped item named "Bopping Stick", i'd use /kill @e[type=item,name="Bopping Stick"]. if i wanted to kill a specific item, like having that Bopping Stick being an actual stick, however, i would need to add the "Item" NBT tag to it, /kill @e[type=item,nbt={Item:{id:"minecraft:stickh",Count:1b}},name="Bopping Stick"].

hope this helps!