mirror of
https://github.com/Threnklyn/MinecraftChat.git
synced 2026-05-30 09:48:29 +02:00
Properly delete the bot on disconnect
This commit is contained in:
@@ -24,7 +24,8 @@ module.exports = function(socket) {
|
||||
socket.mcbot.on('error', function(error) {
|
||||
if (error.toString() === 'Error: write after end') return;
|
||||
socket.emit('buffer:error', error);
|
||||
socket.mcbot = null;
|
||||
if (socket.mcbot.entity) socket.mcbot.end();
|
||||
delete socket.mcbot;
|
||||
});
|
||||
|
||||
// bind bot events
|
||||
|
||||
Reference in New Issue
Block a user