示例#1
0
文件: Tui.java 项目: NichlasH/server
  public static void serverMenu() {
    boolean serverRunning = true;
    while (serverRunning) {

      Tui.miscOut("\n***Welcome to the Snake server***\n");
      Tui.miscOut("What do you want to do?");
      Tui.miscOut("1) Login as admin");
      Tui.miscOut("2) Stop server");

      switch (input.nextInt()) {
        case 1:
          login();
          break;
        case 2:
          serverRunning = false;

          break;
        default:
          Tui.miscOut("Unassigned key.");
      }
    }
  }
示例#2
0
文件: Main.java 项目: yttesen24/snake
 public static void main(String[] args) throws IOException {
   Config.init();
   HttpServer server =
       HttpServerFactory.create("http://localhost:" + Config.getServerPort() + "/");
   server.start();
   System.out.println("Server running");
   System.out.println("Visit: http://localhost:" + Config.getServerPort() + "/api");
   Tui.serverMenu();
   System.out.println("Hit return to confirm to stop...");
   System.in.read();
   System.out.println("Stopping server");
   server.stop(0);
   System.out.println("Server stopped");
 }