code: public void undo() {
  
          // If there is at least one command left to undo
          if (this.commandStack.size() > 0) {
              // Here put the last command on the undone stack
              this.undoneStack.add(this.commandStack.get(this.commandStack.size() - 1));
              // here remove the last command of the command stack
              this.commandStack.remove(this.commandStack.get(this.commandStack.size() - 1));
              // Call Undo method
              this.undoneStack.get(this.undoneStack.size() - 1)
                              .run(WBuilder.wave().addDatas(WBuilder.waveData(UndoRedoWaves.UNDO_REDO, true)));
          } else {
              // begin of stack, do nothing
              LOGGER.info("No more command to undo, begin of stack");
          }
      }
docs: Undo the last command.