fix: resolve some more connection opening and closing issues
This commit is contained in:
parent
3be518f13b
commit
3ea1cc6cf5
@ -14,8 +14,6 @@ import uulm.teamname.marvelous.server.lobby.Lobby;
|
||||
import uulm.teamname.marvelous.server.netconnector.SUID;
|
||||
import uulm.teamname.marvelous.server.netconnector.UserManager;
|
||||
|
||||
import javax.management.MBeanParameterInfo;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
@ -54,6 +52,7 @@ public class LobbyConnection implements Runnable {
|
||||
public void addParticipant(Participant participant) {
|
||||
if(participant.type == ParticipantType.Spectator) {
|
||||
spectators.add(participant);
|
||||
return;
|
||||
}
|
||||
|
||||
if(participant.type == ParticipantType.PlayerOne) {
|
||||
@ -68,6 +67,7 @@ public class LobbyConnection implements Runnable {
|
||||
}
|
||||
|
||||
public void removeParticipant(Participant participant, String reason) {
|
||||
LobbyManager.getInstance().removeParticipant(participant);
|
||||
UserManager.getInstance().removeClient(participant.getClient(), reason);
|
||||
|
||||
if(participant.type == ParticipantType.Spectator) {
|
||||
|
@ -159,6 +159,10 @@ public class LobbyManager {
|
||||
}
|
||||
|
||||
|
||||
public void removeParticipant(Participant participant) {
|
||||
participants.remove(participant.id);
|
||||
}
|
||||
|
||||
private void addParticipant(Client client, String lobbyID, RoleEnum role) {
|
||||
if(!lobbies.containsKey(lobbyID)) {
|
||||
if(!LobbyRunner.getInstance().canAddLobby()) {
|
||||
|
@ -1,7 +1,6 @@
|
||||
package uulm.teamname.marvelous.server.netconnector;
|
||||
|
||||
import org.java_websocket.framing.CloseFrame;
|
||||
import org.tinylog.Logger;
|
||||
import uulm.teamname.marvelous.gamelibrary.json.JSON;
|
||||
import uulm.teamname.marvelous.gamelibrary.json.ValidationUtility;
|
||||
import uulm.teamname.marvelous.gamelibrary.messages.BasicMessage;
|
||||
|
Loading…
Reference in New Issue
Block a user