Package de.creepsmash.common.messages.server

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


    if (this.clients.size() >= this.maxPlayers) {
      throw new RuntimeException(
          "max # of players reached--no more players can join");
    }
    newClient.send(
        new PlayerJoinedMessage(
          newClient.getUserName(), newClient.getClientID(), AuthenticationService.getPlayer(
              newClient.getUserName()).getElopoints() - 500));
    sendAll(
        new PlayerJoinedMessage(
          newClient.getUserName(), newClient.getClientID(), AuthenticationService.getPlayer(
              newClient.getUserName()).getElopoints() - 500));
    for (PlayerInGame p : this.clients) {
      Client c = p.getClient();
      newClient.send(
          new PlayerJoinedMessage(c.getUserName(), c.getClientID(), AuthenticationService.getPlayer(
              c.getUserName()).getElopoints() - 500));
    }
     
    this.clients.add(newClient);
    gamePlayersChanged();
View Full Code Here


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

   * @param m for ServerMessage
   */
  public void update(ServerMessage m) {
   
    if (m instanceof PlayerJoinedMessage) {
      PlayerJoinedMessage pjm = (PlayerJoinedMessage) m;
      DefaultListModel dl = (DefaultListModel) this.playerlist.getModel();
     
      dl.addElement(pjm.getPlayerName());
     
      logger.info("PJM received");

      if (!ownPlayerIdMessageReceived) {
       
        players.put(pjm.getPlayerId(), pjm.getPlayerName());
        this.getCore().setPlayerId(pjm.getPlayerId());
        this.getCore().setPlayerName(pjm.getPlayerName());
        ownPlayerIdMessageReceived = true;

      } else {
        players.put(pjm.getPlayerId(), pjm.getPlayerName());
      }
     
      if (managementSound != null) {
        managementSound.hornbeepSound();
      }
      this.chatdialog.sendChatText("System", pjm.getPlayerName() + "[" + pjm.getPlayerEloScore() + "]" + " has joined!", getCore());
     
      changeButton();
     
    }
   
View Full Code Here

TOP

Related Classes of de.creepsmash.common.messages.server.PlayerJoinedMessage

Copyright © 2018 www.massapicom. 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.