Files
3DChess/app/src/main/java/chess/controller/commands/UndoCommand.java
2025-04-12 11:12:36 +02:00

20 lines
472 B
Java

package chess.controller.commands;
import chess.controller.Command;
import chess.controller.PlayerCommand;
import chess.controller.event.GameListener;
import chess.model.Game;
public class UndoCommand extends Command{
@Override
public CommandResult execute(Game game, GameListener outputSystem) {
PlayerCommand lastAction = game.getLastAction();
if (lastAction == null)
return CommandResult.NotAllowed;
return lastAction.undo(game, outputSystem);
}
}