Examples of LoginResponseMessage


Examples of de.creepsmash.common.messages.server.LoginResponseMessage

        this.getClient().send(resetResponse);
        return this;
      } else if (message instanceof LoginRequestMessage) {
        LoginRequestMessage loginRequestMessage = (LoginRequestMessage) message;
        String serverVersion = Server.getVersion();
        LoginResponseMessage loginResponseMessage = new LoginResponseMessage();
        String clientVersion = loginRequestMessage.getVersion();
        if (!serverVersion.equals(clientVersion)) {
          anonymousStateLogger.info("client " + this.getClient()
              + " has wrong version: " + clientVersion);
          loginResponseMessage
              .setResponseType(IConstants.ResponseType.version);
          this.sendMessage(loginResponseMessage);
          return this;
        }
        EntityManager entityManager = PersistenceManager.getInstance().getEntityManager();
        BlackList bl = null;
        try {
          bl  = entityManager.find(BlackList.class, this.getClient().getIPAddress() );
          if (bl == null) {
            bl  = entityManager.find(BlackList.class, loginRequestMessage.getMacaddress() );
          }
        }catch(PersistenceException e){
          anonymousStateLogger.info("Connection lost ?");
        }
        if (bl != null) {
          anonymousStateLogger.info("blocked user try to login: " + loginRequestMessage.getUsername() );
          loginResponseMessage
              .setResponseType(IConstants.ResponseType.failed);
          this.sendMessage(loginResponseMessage);
          return this;
        }
        Lobby lobby = this.getAuthenticationService().login(
            loginRequestMessage.getUsername(),
            loginRequestMessage.getPassword());
        if (lobby == null) {
          loginResponseMessage
              .setResponseType(IConstants.ResponseType.failed);
          this.sendMessage(loginResponseMessage);
          anonymousStateLogger.error("login failed");
        } else {
          loginResponseMessage
              .setResponseType(IConstants.ResponseType.ok);
          this.getClient().setUserName(
              loginRequestMessage.getUsername());
          this.getClient().setMACAddress(
              loginRequestMessage.getMacaddress());
View Full Code Here

Examples of de.creepsmash.common.messages.server.LoginResponseMessage

    } else if (JoinGameResponseMessage.PATTERN.matcher(messageString)
        .matches()) {
      messageObject = new JoinGameResponseMessage();
    } else if (LoginResponseMessage.PATTERN.matcher(messageString)
        .matches()) {
      messageObject = new LoginResponseMessage();
    } else if (MessageMessage.PATTERN.matcher(messageString).matches()) {
      messageObject = new MessageMessage();
    } else if (PlayerJoinedMessage.PATTERN.matcher(messageString)
        .matches()) {
      messageObject = new PlayerJoinedMessage();
View Full Code Here

Examples of de.creepsmash.common.messages.server.LoginResponseMessage

  /**
   * {@inheritDoc}
   */
  public void update(ServerMessage m) {
    if (m instanceof LoginResponseMessage) {
      LoginResponseMessage response = (LoginResponseMessage) m;
      if (response.getResponseType() == IConstants.ResponseType.ok) {
        getCore().pushScreen(new GameLobby());
      } else {
        errorDialog("Login failed");
        send.setEnabled(true);
      }
View Full Code Here

Examples of de.creepsmash.common.messages.server.LoginResponseMessage

  /**
   * {@inheritDoc}
   */
  public void update(ServerMessage m) {
    if (m instanceof LoginResponseMessage) {
      LoginResponseMessage response = (LoginResponseMessage) m;
      if (response.getResponseType() == IConstants.ResponseType.ok) {
        getCore().pushScreen(new GameLobby());
      } else if (response.getResponseType() == IConstants.ResponseType.version) {
        errorDialog("Wrong version \u2013 please download the latest version."
            + "\n\n"
            + "If that doesn't work, you may need to clear the Java WebStart cache.");
        login.setEnabled(true);
      } else {
View Full Code Here

Examples of org.glassfish.tyrus.sample.chat.chatdata.LoginResponseMessage

    }

    public void handleLoginRequest(LoginRequestMessage message, Session session) {
        String newUsername = this.registerNewUsername(message.getUsername(), session);
        logger.info("Signing " + newUsername + " into chat.");
        LoginResponseMessage lres = new LoginResponseMessage(newUsername);
        try {
            session.getBasicRemote().sendText(lres.asString());
        } catch (IOException ioe) {
            logger.warning("Error signing " + message.getUsername() + " into chat : " + ioe.getMessage());
        }

        this.addToTranscriptAndNotify(newUsername, " has just joined.");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.