private void handle(String line) throws IOException {
        try {
            String[] args = line.substring(1).split(" ");
            // handle commands which do not use gamenetwork:
            if (args.length == 0) {
                LOG.warn("Illegal Command: " + line);
                return;
            }

            if (args[0].equalsIgnoreCase("join")) {
                checkAlreadyJoined();
                handleJoinCommand(args);
            } else if (args[0].equalsIgnoreCase("joinip")) {
                checkAlreadyJoined();
                handleJoinIPCommand(args);
            } else if (args[0].equalsIgnoreCase("exit")) {
                handleExit();
            } else if (networkcommands.contains(args[0].toLowerCase())) {
                handleNetworkCommand(args);
            } else {
                LOG.warn("Unknown command: " + line);
            }
        } catch (AlreadyJoined e) {
            UI.warn("You already joined a game!");
        }
    }