Example #1
0
 public static void sendSessionMsgToDarkstar(SimpleClient playerClient, String text) {
   try {
     if (!text.equals("ping")) System.out.println("Sent sess msg to DS server: " + text);
     ByteBuffer message = Util.encodeString(text);
     playerClient.send(message);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Example #2
0
  private static boolean loginDarkstar(String userId, String password) {
    String host = "tcg.dyndns.info";
    String port = "842";
    SimpleClient playerClient = null;
    try {
      Properties connectProps = new Properties();
      connectProps.put("host", host);
      connectProps.put("port", port);
      createPlayerClient(userId, password, false);
      playerClient = getPlayerClient(userId);
      playerClient.login(connectProps);
      Thread.sleep(5000);

      if (!playerClient.isConnected()) {
        PlayersController.removePlayer(userId);
      }

    } catch (Exception exception) {
      exception.printStackTrace();
      System.err.println(exception.getMessage());
    }
    return playerClient != null && playerClient.isConnected();
  }