Examples of PlayerListMessage


Examples of de.pokerth.protocol.ProtoBuf.PlayerListMessage

    PokerTHMessage msg;
    msg = receiveMessage();
    assertTrue(msg.hasPlayerListMessage());

    // This should be a "player list new" notification with correct player id.
    PlayerListMessage listMsg = msg.getPlayerListMessage();
    assertEquals(myId, listMsg.getPlayerId());
    assertEquals(PlayerListNotification.playerListNew, listMsg.getPlayerListNotification());

    Socket s[] = new Socket[9];
    long playerId[] = new long[9];
    for (int i = 0; i < 9; i++) {
      s[i] = new Socket("localhost", 7234);
      String username = "test" + (i+1);
      String password = username;
      playerId[i] = userInit(s[i], username, password);

      msg = receiveMessage();
      assertTrue(msg.hasPlayerListMessage());
      listMsg = msg.getPlayerListMessage();
      // Id should be different from first id.
      assertTrue(myId != playerId[i]);
      // This should be a "player list new" notification with correct player id.
      assertEquals(playerId[i], listMsg.getPlayerId());
      assertEquals(PlayerListNotification.playerListNew, listMsg.getPlayerListNotification());

      s[i].close();

      // After the connection is closed, a "player list left" notification should be received.
      msg = receiveMessage();
      assertTrue(msg.hasPlayerListMessage());
      listMsg = msg.getPlayerListMessage();
      assertEquals(playerId[i], listMsg.getPlayerId());
      assertEquals(PlayerListNotification.playerListLeft, listMsg.getPlayerListNotification());
    }
  }
View Full Code Here

Examples of org.spout.vanilla.protocol.msg.player.conn.PlayerListMessage

  }

  @EventHandler
  public void onPlayerUpdateUserList(ListPingEvent event) {
    String name = event.getPlayerDisplayName();
    event.getMessages().add(new PlayerListMessage(name, event.getOnline(), (short) event.getPingDelay()));
  }
View Full Code Here

Examples of org.spout.vanilla.protocol.msg.player.conn.PlayerListMessage

  @Override
  public PlayerListMessage decode(ByteBuf buffer) throws IOException {
    String name = VanillaByteBufUtils.readString(buffer);
    boolean addOrRemove = buffer.readByte() == 1;
    short ping = buffer.readShort();
    return new PlayerListMessage(name, addOrRemove, ping);
  }
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.