mirror of
https://github.com/Threnklyn/MinecraftChat.git
synced 2026-05-19 04:43:28 +02:00
Working connections with chat event listener
This commit is contained in:
@@ -5,22 +5,9 @@ module.exports = function(io) {
|
||||
|
||||
io.on('connection', function(socket) {
|
||||
|
||||
socket.on('server:connect', function(data, response) {
|
||||
socket.mcbot = mineflayer.createBot({
|
||||
host: data.hostname,
|
||||
port: data.port,
|
||||
username: data.username,
|
||||
password: data.password
|
||||
});
|
||||
socket.mcbot.on('error', function(error) {
|
||||
console.log(error);
|
||||
socket.emit('bot:error', error);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('disconnect', function() {
|
||||
socket.mcbot = null;
|
||||
});
|
||||
// bind all events to the socket
|
||||
require('./events/connection')(socket);
|
||||
require('./events/disconnection')(socket);
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user