diff --git a/lib/plugins/inventory.js b/lib/plugins/inventory.js index b67d57f7e..0e1bf99fc 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