public class RoboRallyServer
extends java.lang.Object
Constructor and Description |
---|
RoboRallyServer(int serverPort)
Instantiates a new Robo Rally server
|
Modifier and Type | Method and Description |
---|---|
java.util.Map<com.esotericsoftware.kryonet.Connection,java.lang.String> |
getPlayerNames()
Gets a map between connections and their player name
|
java.util.Map<com.esotericsoftware.kryonet.Connection,RobotID> |
getRobotID()
Gets a map between connections and their robot id
|
void |
sendToAllClients(java.lang.Object object)
Sends an object to all clients
|
void |
sendToClient(com.esotericsoftware.kryonet.Connection connection,
java.lang.Object object)
Sends an object to a specific client
|
void |
setDeadPlayers(java.util.List<RobotID> deadRobotList)
Makes notice of players which are dead and as such should not be expected to send anything
|
void |
startGame()
Does necessary cleanup of dangling connections before game is started
|
public RoboRallyServer(int serverPort) throws java.io.IOException
serverPort
- The port the server should listen onjava.io.IOException
- If the server cannot be startedpublic void setDeadPlayers(java.util.List<RobotID> deadRobotList)
deadRobotList
- A list of robot ids of robots which are permanently deadpublic java.util.Map<com.esotericsoftware.kryonet.Connection,RobotID> getRobotID()
public java.util.Map<com.esotericsoftware.kryonet.Connection,java.lang.String> getPlayerNames()
public void sendToAllClients(java.lang.Object object)
object
- The object to sendpublic void startGame()
public void sendToClient(com.esotericsoftware.kryonet.Connection connection, java.lang.Object object)
connection
- The connection to send the object toobject
- The object to send