kiwec 4 месяцев назад
Родитель
Сommit
a5109f1649
2 измененных файлов с 5 добавлено и 1 удалено
  1. 3 1
      lobby.js
  2. 2 0
      ranked.js

+ 3 - 1
lobby.js

@@ -84,6 +84,7 @@ class BanchoLobby extends EventEmitter {
 
         if (message == 'Cleared match host') {
           this.host = null;
+          this.data.hostless = true;
           this.emit('host');
         } else if (message == 'The match has started!') {
           this.scores = [];
@@ -187,6 +188,7 @@ class BanchoLobby extends EventEmitter {
             player.is_host = player.irc_username == m[1];
             this.host = player;
           }
+          this.data.hostless = false;
           this.emit('host');
         } else if (m = joined_regex.exec(message)) {
           // player joined
@@ -232,7 +234,7 @@ class BanchoLobby extends EventEmitter {
           }
 
           if (!user_is_host && !user_is_creator) {
-            this.send(`${source}: You need to be the lobby creator to use this command.`);
+            this.send(`${source}: You need to be the host or the lobby creator to use this command.`);
             break;
           }
         }

+ 2 - 0
ranked.js

@@ -256,6 +256,8 @@ function generate_map_pool_table(lobby) {
 
 
 async function pick_new_host(lobby) {
+  if (lobby.data.hostless) return;
+
   let best_player = lobby.players[0];
   for (const player of lobby.players) {
     if (player.user_id == lobby.data.creator_id) {