Skip to content

Commit

Permalink
fixed minor bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
jing-xuan committed Nov 11, 2019
1 parent c90b063 commit 8407b8a
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 8407b8a

Please sign in to comment.