Skip to content

Commit

Permalink
Merge pull request #360 from jing-xuan/master
Browse files Browse the repository at this point in the history
fixed minor bugs
  • Loading branch information
jing-xuan authored Nov 11, 2019
2 parents 02fb5de + 8407b8a commit 90f739e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/main/java/logic/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,14 @@ private static Command parseTaskLog(String userInput) throws FarmioException {
return new CommandLog(pageNumber);
}
LOGGER.log(Level.INFO, "Detected invalid command for command: " + userInput);
throw new FarmioException("Invalid Log Page \nPlease enter log PAGE_NUMBER.");
try {
if (!userInput.substring(0, userInput.indexOf(" ")).equals("log")) {
throw new FarmioException("Invalid command!");
}
} catch (IndexOutOfBoundsException e) {
throw new FarmioException("Invalid command!");
}
throw new FarmioException("Invalid Log Page! Please enter log PAGE_NUMBER");
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/logic/usercode/actions/GotoMarketAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public GotoMarketAction() {
@Override
public void execute(Frontend frontend, Storage storage, Farmer farmer) throws FarmioFatalException {
if (farmer.getLocation().equals("Market")) {
frontend.simulate("GotoMarketSimulation", 12);
frontend.simulate("GotoMarketSimulation", 1);
frontend.typeWriter("You are already at the market", false);
} else {
farmer.changeLocation("Traveling");
Expand Down

0 comments on commit 90f739e

Please sign in to comment.