1

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

  • do you by any chance have de ability to add photos from the commandblock setups and the commands itself – codermaster Dec 12 '14 at 21:32
3

Due to the fact that I was only testing this system in creative and that creative inventories work differently than survival inventories, this bug occured, in survival however, it doesn't. In a creative inventory, a player saying to the server that he has a certain item, gives the player that item.

So if the client thinks it has a certain item and clicks that item, it will tell the server that he has the item, thus creating the item. In a survival inventory though, the server won't accept the player just saying they have a certain item, so it just discards the ghost item. leaving the client only with the real item.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.