ES6 Stuff

This commit is contained in:
AlexKvazos
2015-05-19 20:05:53 -05:00
parent 8b0e87e986
commit 127e163f73
17 changed files with 45 additions and 46 deletions
+3 -3
View File
@@ -1,10 +1,10 @@
module.exports = (socket) => {
export default (socket) => {
function onChat(data) {
let onChat = (data) => {
if (socket.mcbot && socket.mcbot.entity) {
socket.mcbot.chat(data.message);
}
}
};
socket.on('chat', onChat);
+3 -3
View File
@@ -2,9 +2,9 @@ import mineflayer from 'mineflayer';
import moment from 'moment';
import events from '../../bot';
module.exports = (socket) => {
export default (socket) => {
function onConnection(data) {
let onConnection = (data) => {
let timestamp = moment().format('MMM D h:mm:ss a');
@@ -39,7 +39,7 @@ module.exports = (socket) => {
// bind bot events
events(socket);
}
};
socket.on('server:connect', onConnection);
+3 -3
View File
@@ -1,11 +1,11 @@
module.exports = (socket) => {
export default (socket) => {
function onDisconnection() {
let onDisconnection = () => {
if (socket.mcbot) {
socket.mcbot.end();
delete socket.mcbot;
}
}
};
socket.on('disconnect', onDisconnection);
+3 -3
View File
@@ -1,10 +1,10 @@
module.exports = (socket) => {
export default (socket) => {
function onPlayers() {
let onPlayers = () => {
if (socket.mcbot && socket.mcbot.players) {
socket.emit('bot:players', socket.mcbot.players);
}
}
};
socket.on('players', onPlayers);
+1 -1
View File
@@ -1,4 +1,4 @@
module.exports = (io) => {
export default (io) => {
io.on('connection', (socket) => {