mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Wrote tests that are currently broken for sending server commands through text chat.
#tests
This commit is contained in:
@@ -61,6 +61,7 @@ public class MainServerThread implements Runnable, ClientConnectionDelegate {
|
||||
|
||||
//You should handle interrupts in some way, so that the thread won't keep on forever if you exit the app.
|
||||
while (!terminated) {
|
||||
System.out.println("CUNT GF" + GameState.getCurrentStage());
|
||||
try {
|
||||
Thread.sleep(1000 / CLIENT_UPDATES_PER_SECOND);
|
||||
} catch (InterruptedException e) {
|
||||
@@ -87,22 +88,21 @@ public class MainServerThread implements Runnable, ClientConnectionDelegate {
|
||||
//FINISHED
|
||||
else if (GameState.getCurrentStage() == GameStages.FINISHED) {
|
||||
broadcastMessage(makeRaceStatusMessage());
|
||||
System.out.println("BUT I WAS HERE CUNTFACE");
|
||||
try {
|
||||
Thread.sleep(1000); //Hackish fix to make sure all threads have broadcasted
|
||||
Thread.sleep(100); //Hackish fix to make sure all threads have broadcasted
|
||||
terminate();
|
||||
} catch (InterruptedException ie) {
|
||||
serverLog("Thread interrupted while waiting to terminate clients", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: 14/07/17 wmu16 - Send out disconnect packet to clients
|
||||
try {
|
||||
for (ServerToClientThread serverToClientThread : serverToClientThreads) {
|
||||
serverToClientThread.terminate();
|
||||
}
|
||||
serverSocket.close();
|
||||
return;
|
||||
System.out.println("closed");
|
||||
} catch (IOException e) {
|
||||
System.out.println("IO error in server thread handler upon closing socket");
|
||||
}
|
||||
@@ -245,6 +245,7 @@ public class MainServerThread implements Runnable, ClientConnectionDelegate {
|
||||
|
||||
for (Player player : GameState.getPlayers()) {
|
||||
ServerYacht y = player.getYacht();
|
||||
System.out.println(y.getBoatStatus());
|
||||
BoatSubMessage m = new BoatSubMessage(y.getSourceId(), y.getBoatStatus(),
|
||||
y.getLegNumber(),
|
||||
0, 0, 1234L,
|
||||
@@ -267,6 +268,7 @@ public class MainServerThread implements Runnable, ClientConnectionDelegate {
|
||||
raceStatus = RaceStatus.PREPARATORY;
|
||||
}
|
||||
} else if (GameState.getCurrentStage() == GameStages.FINISHED) {
|
||||
System.out.println("WHAT THE FUCKING FUCK");
|
||||
raceStatus = RaceStatus.TERMINATED;
|
||||
} else {
|
||||
raceStatus = RaceStatus.STARTED;
|
||||
@@ -279,6 +281,7 @@ public class MainServerThread implements Runnable, ClientConnectionDelegate {
|
||||
}
|
||||
|
||||
public void terminate() {
|
||||
System.out.println("done");
|
||||
terminated = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user