From 0c9e730f9b0bdfe5d52d82e33bcdf8b54d683c58 Mon Sep 17 00:00:00 2001 From: Hri7566 Date: Fri, 17 Jun 2022 00:12:55 -0400 Subject: [PATCH] fix lobby settings resetting on join --- src/Channel.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Channel.js b/src/Channel.js index 572cd95..5d6a66b 100644 --- a/src/Channel.js +++ b/src/Channel.js @@ -62,8 +62,11 @@ class Channel extends EventEmitter { cl.user.id = participantId; cl.participantId = participantId; cl.initParticipantQuotas(); - - if (((this.connections.length == 0 && Array.from(this.ppl.values()).length == 0) && this.isLobby(this._id) == false) || this.crown && (this.crown.userId == cl.user._id)) { //user that created the room, give them the crown. + + // if there are no users or the user with the crown entered the room, crown the user + if (((this.connections.length == 0 && Array.from(this.ppl.values()).length == 0) && this.isLobby(this._id) == false) || this.crown && (this.crown.userId == cl.user._id)) { + // user owns the room + // we need to switch the crown to them //cl.quotas.a.setParams(Quota.PARAMS_A_CROWNED); this.crown = new Crown(cl.participantId, cl.user._id); @@ -72,7 +75,7 @@ class Channel extends EventEmitter { } else { //cl.quotas.a.setParams(Quota.PARAMS_A_NORMAL); - if (this.isLobby(this._id)) { + if (this.isLobby(this._id) && this.settings.lobby !== true) { this.settings = new RoomSettings(this.server.lobbySettings, 'user'); this.settings.visible = true; this.settings.crownsolo = false; @@ -336,7 +339,7 @@ class Channel extends EventEmitter { message.m = "a"; message.t = Date.now(); - message.a = msg.message; + message.a = msg.message.test; message.p = { color: "#ffffff",