#Is there a way to automatically alter an items nbt data if it's in a players inventory?
7 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
Short story;
Yes
Long story;
I'll have a look when I'm home
do u have an example of the item with nbt tag?
onEvent('player.inventory.changed', event => {
const {item} = event
const itemsToCheck = ['minecraft:stick', 'minecraft:potion', 'minecraft:enchanted_book']
if (!itemsToCheck.toString().includes(item.id)) return
if(item.nbt == {}) return
if(item.nbt?.StoredEnchantments.toString() == '[{id:"minecraft:protection",lvl:2s}]') item.nbt = {}
})```
that should work
That does work, thank you very much :)