Ticking effect command while holding item help

Discussion in 'Server & Community Management' started by crdtrd, Mar 9, 2020.

  1. I have a ticking /effect command in a data pack function that makes whoever is holding a special axe gets night vision for 15 seconds. Every tick the player is holding the axe, the effect should be applied to them, and when they aren't the night vision will wear out. I tested this in a single player world, and it works as it should. Then I tested this on my server, (I'm running 1.15.2 RO1, the latest version), and it worked as intended until I opened my inventory, then it stopped working flat out. After leaving my inventory, it still wouldn't work, unless I gave myself a new item. I am wondering if this behavior is due to a bug or a configuration that I can edit to make it work. Here are the commands so you all can test it yourself:

    Put this in a ticking command block: effect give @a[nbt={SelectedItem:{id:"minecraft:iron_axe",Count:1b,tag:{display:{Name:'{"text":"Guinea Pig","color":"yellow","bold":true,"italic":true}',Lore:['{"text":"For use by","color":"light_purple"}','{"text":"test dummies.","color":"light_purple"}']},Unbreakable:1b,Enchantments:[{id:"minecraft:knockback",lvl:3s},{id:"minecraft:fire_aspect",lvl:3s}]}}}] minecraft:night_vision 15 255 false

    Here is the give command for the item: give @p minecraft:iron_axe{display:{Name:'{"text":"Guinea Pig","color":"yellow","bold":true,"italic":true}',Lore:['{"text":"For use by","color":"light_purple"}','{"text":"test dummies.","color":"light_purple"}']},Unbreakable:1b,Enchantments:[{id:"minecraft:knockback",lvl:3s},{id:"minecraft:fire_aspect",lvl:3s}]} 1