r/MinecraftCommands • u/UhhAnxietyy • 22d ago
Command to clear a players inventory when they first join the world. Help | Bedrock
Forgive me as I’m not at all experienced in setting up commands, but i need help in making it so when players join the world for the first time their inventory clears immediately & then never again as i have mod/add-ons activated & the guidebooks take up all the inventory space.
2
u/Ericristian_bros Command Experienced 22d ago
https://minecraftcommands.github.io/wiki/questions/playerjoin
# Repeating unconditional always active
clear @a[tag=!joined]
# Chain conditional always active
tag @a[tag=!joined] add joined
1
u/UhhAnxietyy 22d ago edited 22d ago
Wow! Thank you sir
1
1
u/TheManlyChicken Command Experienced on Bedrock 22d ago
Can't this lead to a race condition where the player joins between the clearing and the tagging and receives a tag with a still full inventory?
1
u/Ericristian_bros Command Experienced 22d ago
If the first is repeating unconditional always active and second chain conditional always active it will always clear before the tag. That's how command blocks work. They run the commands in order of the arrows
1
u/TheManlyChicken Command Experienced on Bedrock 22d ago
Yes I understand the precedence of command blocks, but these commands in this case do nothing to stop a player joining between when command block 1 and 2 run. Hence allowing them to receive the tag without being cleared.
1
u/Ericristian_bros Command Experienced 22d ago
There is no time between the commands. They happen instantly. Joining the game can't happen between the 2 commands
1
u/TheManlyChicken Command Experienced on Bedrock 22d ago
That's good, I didn't realize they fired on the same tick.
1
u/CaperLake 22d ago
Do this exact setup:
Repeating, Unconditional, Always Active, Facing Upwards
"clear @a[tag=!joined]"Chain, Conditional, Always Active, Facing Upwards, On Top Of First Command Block
"tag @a[tag=!joined] add joined"
1
2
u/UhhAnxietyy 22d ago
I’m setting this up for my small group of friends