blob: b2322ed8d8ade637c7cb133425230e5ef74e9733 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
package esieequest.controller.commands;
import esieequest.model.Game;
import esieequest.model.Text;
import esieequest.view.Viewable;
/**
* Allows the user to go back on his steps and go to his previous location.
*
* @author Pacien TRAN-GIRARD
*/
public class BackCommand implements Executable {
@Override
public void execute(final String argument, final Game game, final Viewable view) {
if (!argument.isEmpty()) {
view.echo(Text.TOO_MANY_ARGUMENTS.toString());
return;
}
game.getPlayer().goToPreviousRoom();
view.updateLocation(game.getPlayer().getCurrentRoom(), game.getPlayer()
.getCurrentDirection(), game.getPlayer().getCurrentSide(), game.getPlayer()
.canGoBack());
}
}
|