fix: add gamestate event to all responses

This commit is contained in:
punchready 2021-07-26 00:00:47 +02:00
parent 1d257b3c08
commit 9f67808139

View File

@ -219,10 +219,11 @@ public class Lobby {
if (!accepted.isEmpty()) { if (!accepted.isEmpty()) {
Logger.debug("Accepting requests from participant '{}', broadcasting events to all except source", Logger.debug("Accepting requests from participant '{}', broadcasting events to all except source",
source.id.getName()); source.id.getName());
accepted.add(game.getGameStateEvent());
connection.broadcastToAllExcept(source, accepted.toArray(new Event[0])); connection.broadcastToAllExcept(source, accepted.toArray(new Event[0]));
Logger.trace("Adding ack and sending back to originParticipant"); Logger.trace("Adding ack and sending back to originParticipant");
accepted.add(0, new EventBuilder(EventType.Ack).buildGameStateEvent()); accepted.add(0, new EventBuilder(EventType.Ack).buildGameEvent());
connection.sendEvents(source, accepted.toArray(new Event[0])); connection.sendEvents(source, accepted.toArray(new Event[0]));
} }
badRequests = 0; badRequests = 0;