Fix stop spectating a game when user disconnects.

Previously, when users disconnected (either manually or automatically via ping timeout or whatever), they were only being removed from their game if they were a player, not a spectator. This is not consolidated inside the Game class for whatever reason, so add this call to the path that runs when a user is logging out. I've verified other code paths that remove players and all of the ones that need to remove a spectator already do so.

Fixes #124.
This commit is contained in:
Andy Janata 2018-03-06 19:01:42 -08:00
parent 24881d1d55
commit 204c6be94d
1 changed files with 4 additions and 3 deletions

View File

@ -33,14 +33,14 @@ import java.util.concurrent.PriorityBlockingQueue;
import javax.annotation.Nullable;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
import net.sf.uadetector.ReadableUserAgent;
import net.sf.uadetector.service.UADetectorServiceFactory;
import net.socialgamer.cah.CahModule.UniqueId;
import net.socialgamer.cah.Constants.Sigil;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
/**
* A user connected to the server.
@ -300,6 +300,7 @@ public class User {
public void noLongerValid() {
if (currentGame != null) {
currentGame.removePlayer(this);
currentGame.removeSpectator(this);
}
valid = false;
}