When working with lots of command blocks there are often times where I make a mistake and would really like an undo button. It would be nice if there was another command to cancel out another command

So is there a way for a command that has been run to be undone?


No, there is no way to undo commandblock/console/chat commands in vanilla MC. The game has no code to even remember what command was executed (except "command success / fail" message in CB and line in log - but server does not see it), or what it done so it could be reverted. It is all discarded just after the command is finished.

There were some third party monitoring plugins (like HawkEye and similar), that were monitoring what happens in the world, logging it and possibly reverting the change, however it was purely based on per-block data, so all it seen were block changes and causes of that (so it could seen that your /fill command changed blocks, and it seen what blocks were changed and how, but it did not seen the command itself or whatever). However the revert worked only on going back to last states of the block (it just remembered that this block was initially stone, then grass, then air, nothing more)

Also some plugins (like WorldEdit) have //undo, but it is just because it logs its last action completely and can do action opposite, so it looks like reverting. However it can log only its own actions.

If command kills entity, it is deleted forever and has to be resummoned. That is similar with all other changes, without third party plugins, that will store data about your world on some external place (like MySQL), you won't be able to revert any command. There is not a lot (if any) tools that would save all changes in MC world, that would be really server-wise and HDD-wise expensive and thus not reasonable... Using CommandBlocks is only for OP for reasons. You should know what you do, or don't do it.

Except...loading the backup.

| improve this answer | |

If you already messed up:

There's not much now you can do, just repair the damage yourself, find out why it happened and go on.

  • Sometimes, the damage is easy to repair. If you killed an entity, filled air with blocks, changed a scoreboard objective or did something like that, un-do it with a single command (summon the entity back, refill the area, etc.)

  • But in the most times, it's something that you can't just Ctrl + Z. Commands might help you repair, but you will have to do the most yourself usually. For example, a big TNT explosion, water got into your Redstone or you accidentally died and lost your items. There's not much you can do for this, except rebuild/redo it, or...

Prevent such situations! Making something that will likely get damaged?

(I know that's not exactly what you asked for, but it solves the problem of not having an undo button in Minecraft.)

  • Clone what you're building somewhere before testing

  • Make all your entities invulnerable

  • Test all your commands separately somewhere far away

  • Play in Peaceful or with mob spawning turned off so mobs don't make any damage

  • Make sure the last thing you place are the explosives

  • Type /gamerule keepInventory true (if you get killed while testing or accidentally killed yourself)

  • Never, never do the same mistake twice. Doing the same mistake again kills your motivation really badly. Plus, after some time, you'll run out of mistakes!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.