Package net.sf.freecol.server.ai
Class AIInGameInputHandler
- java.lang.Object
-
- net.sf.freecol.server.control.FreeColServerHolder
-
- net.sf.freecol.server.ai.AIInGameInputHandler
-
- All Implemented Interfaces:
MessageHandler
public final class AIInGameInputHandler extends FreeColServerHolder implements MessageHandler
Handles the network messages that arrives while in the game.
-
-
Constructor Summary
Constructors Constructor Description AIInGameInputHandler(FreeColServer freeColServer, Player player, AIMain aiMain)
The constructor to use.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private AIPlayer
getMyAIPlayer()
Get the AI player using this handler.Message
handle(Connection connection, Message message)
Handle an incoming message.Message
read(Connection connection)
Read an incoming Message.-
Methods inherited from class net.sf.freecol.server.control.FreeColServerHolder
getFreeColServer, getGame
-
-
-
-
Constructor Detail
-
AIInGameInputHandler
public AIInGameInputHandler(FreeColServer freeColServer, Player player, AIMain aiMain)
The constructor to use.- Parameters:
freeColServer
- The main server.player
- ThePlayer
to manage.aiMain
- The main AI-object.
-
-
Method Detail
-
getMyAIPlayer
private AIPlayer getMyAIPlayer()
Get the AI player using this handler.- Returns:
- The
AIPlayer
.
-
handle
public Message handle(Connection connection, Message message) throws FreeColException
Handle an incoming message.- Specified by:
handle
in interfaceMessageHandler
- Parameters:
connection
- TheConnection
the message arrived on.message
- TheMessage
to handle.- Returns:
- A reply message, if any.
- Throws:
FreeColException
- if the message is malformed.
-
read
public Message read(Connection connection) throws FreeColException, javax.xml.stream.XMLStreamException
Read an incoming Message.- Specified by:
read
in interfaceMessageHandler
- Parameters:
connection
- TheConnection
to read from.- Returns:
- The
Message
found, or null if none. - Throws:
FreeColException
- if the message can not be instantiated.javax.xml.stream.XMLStreamException
- if there is a problem reading the message.
-
-