A friend of mine has a public realm so we decided to have a spawn area with rules and information. Since bedrock edition has no spawn protection like java has by default we decided to use some command blocks. The idea was that if a player was in 75 blocks of spawn center they would automatically get put in adventure mode so they cannot break / place blocks. When they get into the area of 76 - 100 blocks out they get placed into survival mode. We used a youtube tutorial that showed how this is done.
Command block 1
gamemode a @a[r=75,m=s]
Set to = repeat and needs redstone with a lever flipped on. This was done so the command blocks can be switched off since you cannot change anything in them when they are set to always active w/o having to destroy the command block it's self.
Commandblock 2
gamemode s @a[r=100,m=a]
Set to = repeat and needs redstone with another lever flipped on. The origional tut required the command block to be set to impulse and chain. the reason for this change is because every tutorial i find about this subject is done using the java edition of minecraft and redstone / command blocks function differently in bedrock edition. So the 2nd command block would not function at all and we were needing to set player gamemode manually every time a new player enters the realm.
The problem that we still have is that 1. Players still may not be placed into survival. 2. Everyone at spawn gets spammed with your game mode has been changed messages to the point that chat at spawn is impossible.
Is there a way to fix the issues for the spam and get the game mode change to work 100%?
To take care of the spam you should be able to run :
/gamerule sendcommandfeedback false
and/or
/gamerule commandblockoutput false
Few questions of my own:
have you used /setworldspawn?
For your second command. Couldn't it be a chain command block set to always active on your first RCB?
***FINAL NOTE***
If you don't like this solution I literally just did one for another server that wants players to be in adventure while they are at the central hub but then want them to be in survival when they leave. Is this something you would want if the above doesn't help?
This is what’s i use. Think of it like a shield. You have to pass through the perimeter/edge for it to take effect. So teleporting and spawning in will not work.
Command block A : Set to adventure
Settings: Repeat, unconditional, always on
gamemode a @a[name=!yourName, rm=35, r=36]
Command block B: Set to survival
Settings: Repeat, unconditional, always on
gamemode s @a[name=!yourName, rm=36, r=37]
I recommend turning command block output off.
Name=!yourName is optional. This prevents the blocks from changing your game mode.
To get around new players spawning in on survival:
1. Set world spawn to somewhere isolated. Get cords
It’s 2020 and the vanilla Bedrock still doesn’t seem to have any ‘world-protection’ functionality ;-)
I was tinkering with the above examples on my server and it basically works, but...
Here is my hopefully improved approach...
Assuming the spawn is at 0 70 0
and you want to protect 50-ish blocks around it.
Command block A
/gamemode a @a[m=!a,x=0,y=70,z=0,r=50,name=!yourName]
Command block B
/gamemode s @a[m=!s,x=0,y=7,z=0,rm=51,name=!yourName]
The important bit is the m=!m and s=!s respectively, to ignore the players of which the gamemode is already set to the desired value. Prevents from repeatedly spamming their chat with ‘Your gamemode has been updated to ...’ when they are crossing the protected area.
notes:
Both blocks set similar as in the posts above posts to:’unconditional’; ‘repeat’; 'always on’ or ‘redstone' if u want to have e. g. an on/off lever on’em.
optionally:
Set the interval to some higher value, like 100 - 200 ticks, I think it might improve the server response in some cases especially with many players.
Set default gamemode to adventure
--
It would be nice to exclude the e. g. OPs, or users with certain rank, permissions (is it even a thing in Bedrock?) rather than using a yourName explicitly, but couldn’t figure it out yet.
I made a spawn area near bedrock and /setworldspawn in the middle with /gamerule spawnradius 1.
In the middle i put a command block that has /tp @p[r=5] to tp the player to my actual spawn.
In the actual spawn I have /scoreboard players set @p[r=3] Admin 0 running to set new player to a NOT admin status.
after all that then you can put two commandblocks one with execute @a[scores={Admin=!1},m=s,r=151] ~ ~ ~ gamemode a @p for the inside of spawn, and the other execute @a[scores={Admin=!1},m=a,rm=151,r=153] ~ ~ ~ gamemode s @p for the outside in the middle of your spawn.
yeah why spawnprotection isnt implemented i dont know. maybe because we are capable of makeing such a thing by ourselves just fine.
I do it like this:
SWITCH TO ADVENTURE MODE
Repeat-Unconditional-NeedsRedstone
execute @a[x=0,y=66,z=0,r=60] ~~~ gamemode a @s[m=s]
Chain-Conditional-AlwaysActive
execute @a[x=0,y=66,z=0,r=60] ~~~ title @s actionbar you are now in adventure mode
-----------
SWITCH TO SURVIVAL MODE
Repeat-Unconditional-NeedsRedstone
execute @a[x=0,y=66,z=0,rm=62] ~~~ gamemode s @s[m=a]
Chain-Conditional-AlwaysActive
execute @a[x=0,y=66,z=0,rm=62] ~~~ title @s actionbar you are now in survival mode
keep in mind testing this NOT in creative mode, this code aplies only to players who are in adventure mode or survival mode. This way you are unaffected when in creative mode.
A friend of mine has a public realm so we decided to have a spawn area with rules and information. Since bedrock edition has no spawn protection like java has by default we decided to use some command blocks. The idea was that if a player was in 75 blocks of spawn center they would automatically get put in adventure mode so they cannot break / place blocks. When they get into the area of 76 - 100 blocks out they get placed into survival mode. We used a youtube tutorial that showed how this is done.
Command block 1
gamemode a @a[r=75,m=s]
Set to = repeat and needs redstone with a lever flipped on. This was done so the command blocks can be switched off since you cannot change anything in them when they are set to always active w/o having to destroy the command block it's self.
Commandblock 2
gamemode s @a[r=100,m=a]
Set to = repeat and needs redstone with another lever flipped on. The origional tut required the command block to be set to impulse and chain. the reason for this change is because every tutorial i find about this subject is done using the java edition of minecraft and redstone / command blocks function differently in bedrock edition. So the 2nd command block would not function at all and we were needing to set player gamemode manually every time a new player enters the realm.
The problem that we still have is that 1. Players still may not be placed into survival. 2. Everyone at spawn gets spammed with your game mode has been changed messages to the point that chat at spawn is impossible.
Is there a way to fix the issues for the spam and get the game mode change to work 100%?
To take care of the spam you should be able to run :
/gamerule sendcommandfeedback false
and/or
/gamerule commandblockoutput false
Few questions of my own:
have you used /setworldspawn?
For your second command. Couldn't it be a chain command block set to always active on your first RCB?
***FINAL NOTE***
If you don't like this solution I literally just did one for another server that wants players to be in adventure while they are at the central hub but then want them to be in survival when they leave. Is this something you would want if the above doesn't help?
I decided to post my answer from the other thread anyways if you want it.
Put this all within a ticking area and this should do it.
TO ACTIVATE
/testfor @e[type=player,x=xmin,y=ymin,z=zmin,dx=xarea,dy=yarea,dz=zarea] (RCB Always Active)---
--->comparator------>redstone_wire------>repeater---
--->/gamemode adventure @e[type=player,x=xmin,y=ymin,z=zmin,dx=xarea,dy=yarea,dz=zarea](RCB Needs Redstone)
TO DEACTIVATE
redstone_wire------>redstone_torch(off the side)------>repeater---
--->/gamemode survival @e[type=player,x=xmin,y=ymin,z=zmin,dx=xarea,dy=yarea,dz=zarea](ICB Always Active)
This is what’s i use. Think of it like a shield. You have to pass through the perimeter/edge for it to take effect. So teleporting and spawning in will not work.
Command block A : Set to adventure
Settings: Repeat, unconditional, always on
gamemode a @a[name=!yourName, rm=35, r=36]
Command block B: Set to survival
Settings: Repeat, unconditional, always on
gamemode s @a[name=!yourName, rm=36, r=37]
I recommend turning command block output off.
Name=!yourName is optional. This prevents the blocks from changing your game mode.
To get around new players spawning in on survival:
1. Set world spawn to somewhere isolated. Get cords
2. Commandblockchain:
A. If player in world spawn, change spawn point
B. Set game mode to adventure
C. Teleport player to your real spawn area.
what do you mean by "ticking area" and what is ICB
"In the end, you know it's all just blocks."
<root@notch>: cd Notch
<root@notch>: ls
<root@notch>: Beans.txt virus.exe minecrafthacks.exe
/tickingarea allows you to turn chunks into areas that will be loaded whether you are around or not.
ICB is impulse command block
It’s 2020 and the vanilla Bedrock still doesn’t seem to have any ‘world-protection’ functionality ;-)
I was tinkering with the above examples on my server and it basically works, but...
Here is my hopefully improved approach...
Assuming the spawn is at 0 70 0
and you want to protect 50-ish blocks around it.
Command block A
/gamemode a @a[m=!a,x=0,y=70,z=0,r=50,name=!yourName]
Command block B
/gamemode s @a[m=!s,x=0,y=7,z=0,rm=51,name=!yourName]
The important bit is the m=!m and s=!s respectively, to ignore the players of which the gamemode is already set to the desired value. Prevents from repeatedly spamming their chat with ‘Your gamemode has been updated to ...’ when they are crossing the protected area.
notes:
Both blocks set similar as in the posts above posts to:’unconditional’; ‘repeat’; 'always on’ or ‘redstone' if u want to have e. g. an on/off lever on’em.
optionally:
Set the interval to some higher value, like 100 - 200 ticks, I think it might improve the server response in some cases especially with many players.
Set default gamemode to adventure
--
It would be nice to exclude the e. g. OPs, or users with certain rank, permissions (is it even a thing in Bedrock?) rather than using a yourName explicitly, but couldn’t figure it out yet.
So here's what I did.
I made a spawn area near bedrock and /setworldspawn in the middle with /gamerule spawnradius 1.
In the middle i put a command block that has /tp @p[r=5] to tp the player to my actual spawn.
In the actual spawn I have /scoreboard players set @p[r=3] Admin 0 running to set new player to a NOT admin status.
after all that then you can put two commandblocks one with execute @a[scores={Admin=!1},m=s,r=151] ~ ~ ~ gamemode a @p for the inside of spawn, and the other execute @a[scores={Admin=!1},m=a,rm=151,r=153] ~ ~ ~ gamemode s @p for the outside in the middle of your spawn.
yeah why spawnprotection isnt implemented i dont know. maybe because we are capable of makeing such a thing by ourselves just fine.
I do it like this:
SWITCH TO ADVENTURE MODE
Repeat-Unconditional-NeedsRedstone
execute @a[x=0,y=66,z=0,r=60] ~~~ gamemode a @s[m=s]
Chain-Conditional-AlwaysActive
execute @a[x=0,y=66,z=0,r=60] ~~~ title @s actionbar you are now in adventure mode
-----------
SWITCH TO SURVIVAL MODE
Repeat-Unconditional-NeedsRedstone
execute @a[x=0,y=66,z=0,rm=62] ~~~ gamemode s @s[m=a]
Chain-Conditional-AlwaysActive
execute @a[x=0,y=66,z=0,rm=62] ~~~ title @s actionbar you are now in survival mode
keep in mind testing this NOT in creative mode, this code aplies only to players who are in adventure mode or survival mode. This way you are unaffected when in creative mode.