mirror of
https://github.com/Threnklyn/MinecraftChat.git
synced 2026-05-28 00:38:30 +02:00
Updated readme screenshot
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
module.exports = function(socket) {
|
||||
module.exports = (socket) => {
|
||||
|
||||
socket.on('chat', function(data) {
|
||||
socket.on('chat', (data) => {
|
||||
if (socket.mcbot && socket.mcbot.entity) {
|
||||
socket.mcbot.chat(data.message);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
var mineflayer = require('mineflayer');
|
||||
var events = require('../../bot');
|
||||
|
||||
module.exports = function(socket) {
|
||||
module.exports = (socket) => {
|
||||
|
||||
socket.on('server:connect', function(data) {
|
||||
socket.on('server:connect', (data) => {
|
||||
|
||||
if (socket.mcbot) {
|
||||
socket.emit('buffer:error', 'Pleae disconnect before connecting again');
|
||||
@@ -22,7 +22,7 @@ module.exports = function(socket) {
|
||||
socket.connectionParams = data;
|
||||
|
||||
// prepare for errors
|
||||
socket.mcbot.on('error', function(error) {
|
||||
socket.mcbot.on('error', (error) => {
|
||||
if (error.toString() === 'Error: write after end') return;
|
||||
socket.emit('buffer:error', error);
|
||||
if (socket.mcbot.entity) socket.mcbot.end();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module.exports = function(socket) {
|
||||
module.exports = (socket) => {
|
||||
|
||||
|
||||
socket.on('disconnect', function() {
|
||||
socket.on('disconnect', () => {
|
||||
if (socket.mcbot) {
|
||||
socket.mcbot.end();
|
||||
delete socket.mcbot;
|
||||
@@ -9,7 +9,7 @@ module.exports = function(socket) {
|
||||
});
|
||||
|
||||
|
||||
socket.on('bot:disconnect', function() {
|
||||
socket.on('bot:disconnect', () => {
|
||||
if (socket.mcbot) {
|
||||
socket.mcbot.end();
|
||||
delete socket.mcbot;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module.exports = function(socket) {
|
||||
module.exports = (socket) => {
|
||||
|
||||
socket.on('players', function() {
|
||||
socket.on('players', () => {
|
||||
if (socket.mcbot && socket.mcbot.players) {
|
||||
socket.emit('bot:players', socket.mcbot.players);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module.exports = function(io) {
|
||||
module.exports = (io) => {
|
||||
|
||||
io.on('connection', function(socket) {
|
||||
io.on('connection', (socket) => {
|
||||
|
||||
// bind all listeners to the socket
|
||||
require('./events/connection')(socket);
|
||||
|
||||
Reference in New Issue
Block a user