Minecraft experts in here please

Soldato
Joined
16 May 2004
Posts
6,844
Location
Derby
So, my 2 lads, the wife and myself are looking to play all together in a new world, Survival but on peaceful mode due to my eldest being super scared of being killed (he has ADHD and ASD). The youngest is fed up of his older brother breaking his buildings and messing around with his 'plot' of land.

I did some looking into this last night and learnt how to give Command blocks but thats about it. I know I can type in a code so players become in Adventure mode when within a certain radius of the command block but I don't now how to enter it or what type of command block to use. Total newb here, sorry
All I want is to place 4 command blocks, one for each of us a little distance away from each so enough room to build a house and some farms/pens etc.

How do I do this, so each block is assigned to 1 player to allow them to break, place block in that radius but not allow other players to do so? I have seen the code but I am getting different version of it online. If someone can do a step by step for me, I'll give you a internet coookie.

Really appreciate the help on this, as it will stop them two from arguing. We use the xbox game pass version. My two lads play split screen on xbox one, the wife will either be on the switch or xbox X downstairs and I will be on my pc xbox gamepass for windows, signed in as username(2) as my lad uses my log in so we can all share games under my single Ultimate account.
 
This should be pretty simple and will use 2 command blocks per plot. You said you figured some of it out but I'll go through it all;

First put yourself in Creative mode typing the command "/Gamemode Creative" - I think Bedrock is the same as Java that you need to be in Creative to edit command blocks
Then type in "/Give Yourname command_block" - this should give you an orange command block. You'll also need a lever so use the give command "/Give Yourname Lever" or grab it from the creative inventory

I'd also suggest putting the command blocks where players can't get to them. When I've done similar in the past, I've teleported to the bottom of the world and put the commands under the bedrock. It's not foolproof as you can glitch break bedrock but, given the commands you're using, the only player that could break the bedrock would be the players left in survival so probably won't be disabling their building protection.

For the first command block, place it down and right click it;

On the left hand side;
Hover name - this is the name that will appear hovering when you look at the command block. It is also the name that will come up in chat saying it changed a players game setting.
Block Type: Set to Repeat
Condition Unconditional
Redstone: Needs Redstone
Execute on first tick on
Delay 0

Then on top right under Command Input type
/gamemode a @a [r=25,m=s,name=!"playername"]

When exiting the command block, it should now be a purple colour.

This rule works on setting the gamemode to Adventure ("a") for all players ("@a") in a radius of 25 blocks (r=25), whose gamemode was survival ("m=s") except for the named player (name=!"playername")

It's worth making this a little bigger than necessary as a player can reach several blocks so you could break blocks inside the 'adventure' radius while standing outside of it. Lastly the "m=s" is a check that mode=survival - so it won't re-run if someone for some reason is already in adventure mode and also means, as you're building it in creative, it shouldn't keep switching your game mode either. Though I've included the levers (below) so you can easily turn the commands off for everyone too if you want to in the future.

For the second command block, place it on top of the first with the left hand side being the same as above. In the command type /gamemode s @a[rm=26,m=a]

This is basically the reverse of the first command block, setting the gamemode to survival (s) for all players (@a) who go outside the radius (rm) and who are in adventure mode (m=a). I set the radius back to survival as 1 block higher than the first command block but you can set it to whatever number.

Finally put a lever on both command blocks and flick them on.

With that done, it should work that as a players walks in to the radius a chat message will pop up saying "Command block 1 hover name: Set playername game mode to Adventure" and the same but to Survival on leaving the radius of the second command block.

I hope this makes sense but happy to jump on discord or in a world to show you :)

Edit: formatting
 
Last edited:
@Greboth

I followed your instructions on setting up the command blocks and it seems to work. I set up 4 lots a bit away from each other, named them after kids and myself and wife. I logged in with my wifes profile and couldn't destroy my kids or my own blocks within that radius. So it all seems to work fine. You mention to put them away so they cant be found/hidden or whatever, i will assume no matter how low or high they are it always effect the outward radius, not the up an down. or does it act like a tall cylinder?

Also, how would I make a spawn point for each player so they spawn at their respective plots of land?
 
i will assume no matter how low or high they are it always effect the outward radius, not the up an down. or does it act like a tall cylinder

I didn't actually think about y height when I was thinking about how to set the radius. The radius will be exactly that, so it would be a sphere around where you set the command blocks.

The easiest solution would be to not bury the command blocks and change the Redstone setting to "always active". This would mean you don't need the lever (so the command block couldn't be switched off) though this comes with the downside that the command block will be wherever you place it and, to keep the build in the radius, can't really be moved. The other option along this path would be set the radius to be something pretty large though it depends how much of the world you want to stop other players being able to access.

The full in depth solution would be to use x, y, z co-ordinates with offset. This makes a box, rather than sphere and you can control each direction separately. So taking the first command block, you could set it to;

/gamemode a @a [x=1,y=1,z-1,dx=2,dx=5,dz=9,m=s,name=!"playername"]

This would define a box starting at the x, y, z co-ordinates of 1, 1, 1 and expanding in the dx, dy, dz directions but the defined amounts. So this box would cover x1 to x3, y1 to y 6 and z 1 to z10.

This does have the advantage of meaning the area "protected" is separate from where the command block is. Though command blocks need to be loaded to run so they either need to be at the base (so a player loads them when they get close) or in the spawn chunks as they're always loaded. If you go this route I'd suggest setting the y value to cover the maximum build height to stop another player building over the top of someone elses base. Also for ease, I'd start with the co-ordinates in the NW corner of a plot as it means the dx, dz number will be positive in the SE direction. Rather than faff around mixing positive / negative numbers.

Also, how would I make a spawn point for each player so they spawn at their respective plots of land?

That I don't know sadly and quick google suggests it isn't possible. About the only solution I can think of would be set command blocks at spawn set to TP to co-ordinates at each base with a sign saying whose base it takes them too. The adventure / survival command blocks should still work if a player is tp'ed in to the box so only the player it belongs to could start building. Though if you go this route, you'd have to remove the command blocks else you'll probably end up with players being suffocated if they tp after a base has been built.
 
Back
Top Bottom