Class ChatMessage


  • public class ChatMessage
    extends AttributeMessage
    The message that contains a chat string.
    • Constructor Detail

      • ChatMessage

        public ChatMessage​(Player player,
                           java.lang.String message,
                           boolean privateChat)
        Create a new ChatMessage with the supplied message.
        Parameters:
        player - The player that is sending the message.
        message - The text of the message to send.
        privateChat - Whether this message is private.
      • ChatMessage

        public ChatMessage​(Game game,
                           FreeColXMLReader xr)
                    throws javax.xml.stream.XMLStreamException
        Create a new ChatMessage from a stream.
        Parameters:
        game - The Game this message belongs to.
        xr - The FreeColXMLReader to read from.
        Throws:
        javax.xml.stream.XMLStreamException - if the stream is corrupt.
    • Method Detail

      • aiHandler

        public void aiHandler​(FreeColServer freeColServer,
                              AIPlayer aiPlayer)
        AI-side handler for this message. AI handlers always return null. FIXME: One day the FreeColServer should devolve to AIMain.
        Overrides:
        aiHandler in class TrivialMessage
        Parameters:
        freeColServer - The FreeColServer handling the request.
        aiPlayer - The AIPlayer the message was sent to.
      • clientHandler

        public void clientHandler​(FreeColClient freeColClient)
        Client-side handler for this message. Client handlers always return null.
        Overrides:
        clientHandler in class TrivialMessage
        Parameters:
        freeColClient - The FreeColClient to handle this message.
      • serverHandler

        public ChangeSet serverHandler​(FreeColServer freeColServer,
                                       ServerPlayer serverPlayer)
        Server-side handler for this message.
        Overrides:
        serverHandler in class TrivialMessage
        Parameters:
        freeColServer - The FreeColServer handling the request.
        serverPlayer - The ServerPlayer that sent the request.
        Returns:
        A ChangeSet defining the response.
      • getColor

        public java.awt.Color getColor()
        Get the color.
        Returns:
        The new Color.
      • getMessage

        public java.lang.String getMessage()
        What is the text of this ChatMessage?
        Returns:
        The text of this ChatMessage.
      • isPrivate

        public boolean isPrivate()
        Is this ChatMessage private?
        Returns:
        True if this ChatMessage is private.
      • getSender

        public java.lang.String getSender()
        Who sent this ChatMessage?
        Returns:
        The sender tag for this ChatMessage.