diff --git a/src/Game.java b/src/Game.java index b42cf65..72799c1 100644 --- a/src/Game.java +++ b/src/Game.java @@ -217,6 +217,23 @@ public class Game { send("."); } else if (msg.length() == 6) { + String rawLine = msg.substring(5); + int line = -1; + try { + line = Integer.parseInt(rawLine) - 1; + } catch (NumberFormatException e) { + send("-ERR wrong argument."); + } + if (line >= 0 && line < 5) { + if (words[line] != null) { + send("+OK " + words[line] + " " + generateCode(words[line])); + } else { + send("-ERR game hasn't progressed to this line yet."); + } + } else { + send("-ERR couldn't parse line."); + } + } else { sendUniversalError(); }