From d00c386cfe51cefc361c0ff4d30b100aee9f114a Mon Sep 17 00:00:00 2001 From: DenisKvak1 <59225772+DenisKvak1@users.noreply.github.com> Date: Tue, 20 Aug 2024 21:15:35 +0300 Subject: [PATCH] Fixed a bug with not closing the window when changing the subserver (#3424) --- lib/plugins/inventory.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/plugins/inventory.js b/lib/plugins/inventory.js index 497021841..0277f3fef 100644 --- a/lib/plugins/inventory.js +++ b/lib/plugins/inventory.js @@ -691,6 +691,13 @@ function inject (bot, { hideErrors }) { bot.currentWindow = null bot.emit('windowClose', oldWindow) }) + bot._client.on('login', () => { + // close window when switch subserver + const oldWindow = bot.currentWindow + if (!oldWindow) return + bot.currentWindow = null + bot.emit('windowClose', oldWindow) + }) bot._client.on('set_slot', (packet) => { // set slot const window = packet.windowId === 0 ? bot.inventory : bot.currentWindow