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 //FINISHED
else if (GameState.getCurrentStage() == GameStages.FINISHED) { else if (GameState.getCurrentStage() == GameStages.FINISHED) {
broadcastMessage(makeRaceStatusMessage()); broadcastMessage(MessageFactory.getRaceStatusMessage());
try { try {
Thread.sleep(1000); //Hackish fix to make sure all threads have sent closing RaceStatus Thread.sleep(1000); //Hackish fix to make sure all threads have sent closing RaceStatus
terminate(); terminate();
} catch (InterruptedException ie) { } 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()) { for (ServerYacht serverYacht : GameState.getYachts().values()) {
broadcastMessage(MessageFactory.getBoatLocationMessage(serverYacht)); broadcastMessage(MessageFactory.getBoatLocationMessage(serverYacht));
} }
} }
public void sendSetupMessages() { private void sendSetupMessages() {
broadcastMessage(MessageFactory.getRaceXML()); broadcastMessage(MessageFactory.getRaceXML());
broadcastMessage(MessageFactory.getRegattaXML()); broadcastMessage(MessageFactory.getRegattaXML());
broadcastMessage(MessageFactory.getBoatXML()); broadcastMessage(MessageFactory.getBoatXML());
@@ -324,37 +324,4 @@ public class ServerToClientThread implements Runnable {
public void setAsHost() { public void setAsHost() {
isHost = true; 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)
// );
}
} }