Example #1
0
 public static void removeSocketIOClient(String sessionId) {
   for (String userId : clientMap.keySet()) {
     Player player = clientMap.get(userId);
     if (player != null && !player.isFlashClient()) {
       for (IOClient socketIOClient : player.getSocketIOClients()) {
         if (socketIOClient.getSessionID().equals(sessionId)) {
           player.getSocketIOClients().remove(socketIOClient);
           if (player.getSocketIOClients().isEmpty()) {
             removePlayer(player.getUserId());
           }
         }
       }
     }
   }
 }
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();
  }