Minecraft wiki entry for Command_blocks_and_functions, associated text: One could also utilize the distance argument defining an area-of-effect /gamemode adventure @a[gamemode=!creative,distance=0..(X)] combined with a deactivating command block /gamemode survival @a[gamemode=!creative,distance=(X+2)..(X+12)]. Set both blocks to repeat and be self-powered and there should be a fairly "seamless" transition zone between normal and protected. The distance variables for the range of effect (specifically the reversion block) can vary, but a buffer between the X and X+2 variables should be there to accommodate the second block being at a different position than the protection block. The gap between the two variables in the reversion block need not be exactly 10 blocks, but a buffer helps for lag concerns in guaranteeing that once left, a player will revert back to survival mode.