Skip to main content

Command Block query



  • Dani Noble
    Moderator Beacon of Knowledge Super Star

    Carl Fox

    The following will lock the world into survival mode: 

    1) Place six command blocks (row of three with another row of three on top). Arrows pointing up. 

    2) Bottom command blocks all set to "Repeat" and "Always on". 

    3) Top command blocks all set ot "Chain", "Conditional" and "Always On". 

    4) Set the following commands left to right on the bottom row:   

    /testfor @p[m=3]
    /testfor @p[m=0]
    /testfor @p[m=1]

    5) Block command block output, type: /gamerule commandBlockOutput false

    6) Set all of the command blocks on the top row to: /gamemode 2 @a

    Will lock the game in survival mode. Students will be unable to cheat. Make sure you make a unlocked copy of the world prior to setting this up, because it's extremely difficult to make changes after the fact. Hope this works for you. 

  • Danny Support
    Beacon of Knowledge Bug Zapper Support

    Hey there!

    Hmmm... you could make a command block do:

    When types "help" = Say:  "This game will remain in survival mode." 

    Would that work?

  • Aleece Landis
    Bug Zapper Beacon of Knowledge Super Star

    Dana Dana Noble would you not /testfor @a[m=0]  etc?  You can't guarantee @p will be the person who needs their gamemode changed back

    Also, it might be helpful if there is a secret tag that could be applied to the "teacher" so that the teacher could have the ability to edit the world.
    so the command would be like /testfor @a[m=0,tag=!teacher]  or something like that.

    other sometimes helpful trick, is make them all need redstone and place redstone blocks under them.  Make note of the location of those redstone blocks so that you can replace them with air if you need to shut the system off.

    Other option would be to add the education.json file to block access to commands within the world.  This is handy when the students would be running the world on their own machines and you want to make sure they can't access commands or are only allowed certain commands.  Often used in the coding worlds since you can differentiate between the player and the automation (agent).

  • Carl Fox

    Thank you all for your help. Fortunately I have come across a solution.  I have one command block set to repeat with the following command: /gamemode 0@a.  Then, nearby, I have another command block set to impulse with the command /gamerule sendcommandfeedback false.  Works perfectly.  As an added bonus, I have a command block both at World Spawn and the location of the above command blocks specifying the area as a Ticking Area, set to repeat so all slots are filled with this location, making them active at all times in all areas of the world.

  • Debbie Alexander
    Moderator Beacon of Knowledge Super Star

    Gratz! there is nothing quite like wresting a coding problem to the ground and beating it, eh? =D


Please sign in to leave a comment.