mirror of
https://github.com/Threnklyn/MinecraftChat.git
synced 2026-05-18 20:33:28 +02:00
Used browserify for clientside js
This commit is contained in:
Executable
+27
@@ -0,0 +1,27 @@
|
||||
var mineflayer = require('mineflayer');
|
||||
|
||||
|
||||
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;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user