mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Documented client packet parser, client state, client state querying runnable, client to server thread and replaced e.printStackTrace() with client log messages.
This commit is contained in:
@@ -12,6 +12,10 @@ public class ClientStateQueryingRunnable extends Observable implements Runnable
|
||||
|
||||
public ClientStateQueryingRunnable() {}
|
||||
|
||||
/**
|
||||
* Notifies observers "game started" if ClientState raceStarted flag is true and terminates itself.
|
||||
* Notifies observers "update players" if ClientState boatsUpdated flag is true and resets the flag to false;
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
while(!terminate) {
|
||||
@@ -29,14 +33,19 @@ public class ClientStateQueryingRunnable extends Observable implements Runnable
|
||||
terminate();
|
||||
}
|
||||
|
||||
if (ClientState.isDirtyState()) {
|
||||
if (ClientState.isBoatsUpdated()) {
|
||||
setChanged();
|
||||
notifyObservers("update players");
|
||||
ClientState.setDirtyState(false);
|
||||
ClientState.setBoatsUpdated(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to terminate the thread.
|
||||
*
|
||||
* Currently called by the main while loop when game started is detected.
|
||||
*/
|
||||
public void terminate() {
|
||||
terminate = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user