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:
parent
24881d1d55
commit
204c6be94d
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue