Class Protocol

java.lang.Object
VASSAL.chat.node.Protocol

public class Protocol extends Object
Utility method for encoding server-related commands into strings. Messages sent or interpreted by the server are encoded here. Messages sent from one client to another are simply forwarded as strings without being decoded.
  • Field Details

  • Constructor Details

    • Protocol

      public Protocol()
  • Method Details

    • encodeRegisterCommand

      public static String encodeRegisterCommand(String id, String initialPath, String info)
      Contains registration information sent when a client initially connects to the server
      Parameters:
      id -
      initialPath -
      info -
      Returns:
    • decodeRegisterCommand

      public static String[] decodeRegisterCommand(String cmd)
      Returns:
      senderId, newParentPath, senderInfo
      See Also:
    • encodeJoinCommand

      public static String encodeJoinCommand(String newParentPath)
      Sent when a player wishes to join a room
      Parameters:
      newParentPath -
      Returns:
    • encodeJoinCommand

      public static String encodeJoinCommand(String newParentPath, String password)
      Sent when a player is invited to join a locked room
      Parameters:
      newParentPath -
      password -
      Returns:
    • decodeJoinCommand

      public static String[] decodeJoinCommand(String cmd)
      Returns:
      newParentPath
      See Also:
    • encodeForwardCommand

      public static String encodeForwardCommand(String recipientPath, String message)
      Forward a message to other client nodes
      Parameters:
      recipientPath - a path name specifying the indented recipients of the message
      message -
      Returns:
    • decodeForwardCommand

      public static String[] decodeForwardCommand(String cmd)
      Returns:
      recipientPath, message
      See Also:
    • encodeStatsCommand

      public static String encodeStatsCommand(String info)
      Sent when a player updates his personal information
      Parameters:
      info - the encoded properties of the PlayerNode corresponding to the player
      Returns:
      See Also:
    • decodeStatsCommand

      public static String[] decodeStatsCommand(String cmd)
      Returns:
      path, playerProperties
      See Also:
    • encodeNodeInfoCommand

      public static String encodeNodeInfoCommand(Node n)
      Sent when the info for a particular (non-player) node is updated
      Parameters:
      n -
      Returns:
    • decodeNodeInfoCommand

      public static String[] decodeNodeInfoCommand(String cmd)
      Parameters:
      cmd -
      Returns:
      path, info
      See Also:
    • encodeRoomsInfo

      public static String encodeRoomsInfo(Node[] rooms)
      Sent when a room's info changes, or to update all rooms' info at once
      Parameters:
      rooms -
      Returns:
    • decodeRoomsInfo

      public static Properties decodeRoomsInfo(String cmd)
    • encodeListCommand

      public static String encodeListCommand(Node[] nodes)
      A dump of the current connections to the server. Includes a path name and info for each player node
      Parameters:
      nodes -
      Returns:
    • decodeListCommand

      public static Node decodeListCommand(String cmd)
      Parameters:
      cmd -
      Returns:
      See Also:
    • decodeRegisterRequest

      public static boolean decodeRegisterRequest(String cmd)
    • encodeRegisterRequest

      public static String encodeRegisterRequest()
    • encodeLoginCommand

      public static String encodeLoginCommand(String username)
      Sent when associating a connection with a given username
      Parameters:
      username -
      See Also:
    • decodeLoginCommand

      public static String decodeLoginCommand(String cmd)
    • encodeKickCommand

      public static String encodeKickCommand(String kickeeId)
      Sent by the owner of a room to kick another player back to the Main Room
      Parameters:
      kickeeId -
      Returns:
      player
    • decodeKickCommand

      public static String[] decodeKickCommand(String cmd)