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 AIPlayergetMyAIPlayer()Get the AI player using this handler.Messagehandle(Connection connection, Message message)Handle an incoming message.Messageread(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- ThePlayerto 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:
handlein interfaceMessageHandler- Parameters:
connection- TheConnectionthe message arrived on.message- TheMessageto 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:
readin interfaceMessageHandler- Parameters:
connection- TheConnectionto read from.- Returns:
- The
Messagefound, 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.
-
-