Skip to content

Commit d00c386

Browse files
authored
Fixed a bug with not closing the window when changing the subserver (#3424)
1 parent 1d46161 commit d00c386

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/plugins/inventory.js

+7
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,13 @@ function inject (bot, { hideErrors }) {
691691
bot.currentWindow = null
692692
bot.emit('windowClose', oldWindow)
693693
})
694+
bot._client.on('login', () => {
695+
// close window when switch subserver
696+
const oldWindow = bot.currentWindow
697+
if (!oldWindow) return
698+
bot.currentWindow = null
699+
bot.emit('windowClose', oldWindow)
700+
})
694701
bot._client.on('set_slot', (packet) => {
695702
// set slot
696703
const window = packet.windowId === 0 ? bot.inventory : bot.currentWindow

0 commit comments

Comments
 (0)