I'm currently working on a CTF system for a large project, and I have the main command blocks set up. The main problem is to make sure that the players do not take their flag off their head. I can detect if he has the flag in his inventory and whether or not it is on his head with 2 scoreboards.
The current system I have set up detects if he has the flag in his inventory, but not on his head, if so, it will clear the flag and replace it in the player's head slot. What is happening now is that the flag dissapears client-side, but the server and other players can still see it. Just the player who has the flag on his head can't see it.
Is there any easy way to fix this? as clearing and replacing the flag doesn't help either.
Screenshot of commandblocks: commands:
/scoreboard players set @a flagHolder 0
/scoreboard players set @a flagHolder -1 {Inventory:[{id:minecraft:banner}]}
/scoreboard players set @a flagHolder 1 {Inventory:[{Slot:103b,id:minecraft:banner}]}
/clear @a[score_flagHolder=-1] banner
/replaceitem entity @a[score_flagHolder=-1] slot.armor.head banner 1
scoreboard objective: flagHolder dummy