Merged new develop on

#story[1250]
This commit is contained in:
William Muir
2017-09-09 14:13:50 +12:00
parent 1f9e6154ae
commit 4a170f8179
2 changed files with 4 additions and 37 deletions
@@ -85,12 +85,12 @@ public class MainServerThread implements Runnable, ClientConnectionDelegate {
//FINISHED
else if (GameState.getCurrentStage() == GameStages.FINISHED) {
broadcastMessage(makeRaceStatusMessage());
broadcastMessage(MessageFactory.getRaceStatusMessage());
try {
Thread.sleep(1000); //Hackish fix to make sure all threads have sent closing RaceStatus
terminate();
} catch (InterruptedException ie) {
serverLog("Thread interrupted while waiting to terminate clients", 1);
logger.trace("Thread interrupted while waiting to terminate clients", 1);
}
}
}
@@ -104,13 +104,13 @@ public class MainServerThread implements Runnable, ClientConnectionDelegate {
}
}
public void sendBoatLocations() {
private void sendBoatLocations() {
for (ServerYacht serverYacht : GameState.getYachts().values()) {
broadcastMessage(MessageFactory.getBoatLocationMessage(serverYacht));
}
}
public void sendSetupMessages() {
private void sendSetupMessages() {
broadcastMessage(MessageFactory.getRaceXML());
broadcastMessage(MessageFactory.getRegattaXML());
broadcastMessage(MessageFactory.getBoatXML());
@@ -324,37 +324,4 @@ public class ServerToClientThread implements Runnable {
public void setAsHost() {
isHost = true;
}
private void checkChatterForCommands(ChatterMessage chatterMessage) {
// String chatterText = new String(
// Arrays.copyOfRange(chatterPayload, 3, 3 + chatterPayload.length)
// );
// String[] words = chatterText.split("\\s+");
// if (words.length > 2 && isHost) {
// switch (words[2].trim()) {
// case ">speed":
// try {
// GameState.setSpeedMultiplier(Double.valueOf(words[3]));
// GameState.broadcastChatter(new ChatterMessage(
// Byte.toUnsignedInt(chatterPayload[1]),
// "SERVER: Speed modifier set to x" + words[3]
// ));
// } catch (Exception e) {
// logger.error("cannot parse >speed value");
// }
// return;
// case ">finish":
// GameState.broadcastChatter(new ChatterMessage(
// chatterPayload[1],
// "SERVER: Game will now finish"
// ));
// GameState.endRace();
// return;
// }
// }
// GameState.broadcastChatter(
// ServerPacketParser.extractChatterText(chatterPayload)
// );
}
}