keeping banner on someone's head
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
Pictures about "keeping banner on someone's head"



What is the command to put a banner on your head?
This is just a small fun little addition to the game, you can now wear banners by placing them in your head slot. It does not provide protection or any bonuses except looking different. This idea came from the Illager Captain wearing a banner. It would look just like that except with the banner of your choice.How do you put Illager banner on head?
An Illager banner (also known as an Ominous Banner in Java Edition) is a special banner type that can be carried by Illager captains. Killing an Illager captain that is not on a raid will give the player the Bad Omen effect.BANNERS - Someone To You
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: cottonbro, Mustafa ezz, Pixabay, Gabriel Crişan
