From a78fac1baf0601d8def9c697bb473d3f3dac821e Mon Sep 17 00:00:00 2001 From: Asecave <39377667+Asecave@users.noreply.github.com> Date: Fri, 25 Mar 2022 20:43:58 +0100 Subject: [PATCH] added info --- src/Game.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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(); }