Updated readme screenshot

This commit is contained in:
AlexKvazos
2015-04-30 18:33:15 -05:00
parent 810eb6fca6
commit 423beaf29c
16 changed files with 31 additions and 33 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ MinecraftChat
Web based Minecraft chat client for 1.8 servers. Web based Minecraft chat client for 1.8 servers.
![MinecraftChat Screenshot](http://puu.sh/huBzl/ec3c911abc.png) ![MinecraftChat Screenshot](http://puu.sh/hwR1L/9e88547904.png)
###Description ###Description
This is a very lightweight application... ~500kb without modules. It is built on Node and utilizes tools such as [mineflayer](https://github.com/andrewrk/mineflayer), [node-minecraft-protocol](https://github.com/PrismarineJS/node-minecraft-protocol#windows) and [socket.io](http://socket.io/). The whole purpose is that you can chat on Minecraft servers from your browser. This makes it easier to just jump in, say a few things, and leave without having to wait for your game to load. This is a very lightweight application... ~500kb without modules. It is built on Node and utilizes tools such as [mineflayer](https://github.com/andrewrk/mineflayer), [node-minecraft-protocol](https://github.com/PrismarineJS/node-minecraft-protocol#windows) and [socket.io](http://socket.io/). The whole purpose is that you can chat on Minecraft servers from your browser. This makes it easier to just jump in, say a few things, and leave without having to wait for your game to load.
+2 -2
View File
@@ -1,6 +1,6 @@
module.exports = function(socket) { module.exports = (socket) => {
socket.mcbot.on('end', function() { socket.mcbot.on('end', () => {
socket.emit('bot:disconnect'); socket.emit('bot:disconnect');
delete socket.mcbot; delete socket.mcbot;
}); });
+2 -2
View File
@@ -1,7 +1,7 @@
module.exports = function(socket) { module.exports = (socket) => {
// login event // login event
socket.mcbot.on('login', function() { socket.mcbot.on('login', () => {
socket.emit('buffer:success', 'Successfully logged in as ' + socket.mcbot.username + ' with entity id ' + socket.mcbot.entity.id); socket.emit('buffer:success', 'Successfully logged in as ' + socket.mcbot.username + ' with entity id ' + socket.mcbot.entity.id);
socket.emit('bot:connect', { socket.emit('bot:connect', {
host: socket.connectionParams.hostname, host: socket.connectionParams.hostname,
+3 -3
View File
@@ -4,10 +4,10 @@ var parseExtra = require('../../parsers/extra');
var escapeHtml = require('../../utils').escapeHtml; var escapeHtml = require('../../utils').escapeHtml;
module.exports = function(socket) { module.exports = (socket) => {
// message event // message event
socket.mcbot.on('message', function(message) { socket.mcbot.on('message', (message) => {
// empty buffer // empty buffer
var buffer = ''; var buffer = '';
@@ -40,7 +40,7 @@ module.exports = function(socket) {
buffer = escapeHtml(buffer); buffer = escapeHtml(buffer);
// format the buffer with the correct coloring // format the buffer with the correct coloring
buffer = buffer.replace(/§([0-9abcdef])([^§]*)/ig, function replace(regex, color, msg) { buffer = buffer.replace(/§([0-9abcdef])([^§]*)/ig, (regex, color, msg) => {
return '<span class="color-' + color + '">' + msg.replace(/ /g, '&nbsp;') + '</span>'; return '<span class="color-' + color + '">' + msg.replace(/ /g, '&nbsp;') + '</span>';
}); });
+2 -2
View File
@@ -1,7 +1,7 @@
module.exports = function(socket) { module.exports = (socket) => {
// spawn event // spawn event
socket.mcbot.on('spawn', function() { socket.mcbot.on('spawn', () => {
var pos = socket.mcbot.entity.position; var pos = socket.mcbot.entity.position;
socket.emit('buffer:info', 'Spawned at X:' + pos.x + ', Y:' + pos.y + ', Z:' + pos.z); socket.emit('buffer:info', 'Spawned at X:' + pos.x + ', Y:' + pos.y + ', Z:' + pos.z);
socket.emit('bot:players', socket.mcbot.players); socket.emit('bot:players', socket.mcbot.players);
+1 -1
View File
@@ -4,7 +4,7 @@
var message = require('./events/message'); var message = require('./events/message');
var end = require('./events/end'); var end = require('./events/end');
module.exports = function(socket) { module.exports = (socket) => {
login(socket); login(socket);
spawn(socket); spawn(socket);
+3 -5
View File
@@ -29,7 +29,7 @@ require('./sockets')(io);
// send homepage // send homepage
app.get('/', function(req, res) { app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, '../../public/templates/index.html')); res.sendFile(path.join(__dirname, '../../public/templates/index.html'));
}); });
@@ -44,12 +44,10 @@ app.set('port', process.env.PORT || 3000);
// initialize http and socket servers // initialize http and socket servers
server.listen(app.get('port'), function() { server.listen(app.get('port'), () => {
console.log('> Server running on port %s\n', app.get('port')); console.log('> Server running on port %s\n', app.get('port'));
}); });
// handle exceptions // handle exceptions
process.on('uncaughtException', function(ex) { process.on('uncaughtException', (ex) => console.error(ex.stack));
console.error(ex.stack);
});
+2 -2
View File
@@ -1,11 +1,11 @@
var stringToCode = require('../utils').stringToCode; var stringToCode = require('../utils').stringToCode;
module.exports = function(extra) { module.exports = (extra) => {
var string = ''; var string = '';
// for each piece of text // for each piece of text
extra.forEach(function(data) { extra.forEach((data) => {
// get the text out of the element // get the text out of the element
var text; var text;
+1 -1
View File
@@ -1,7 +1,7 @@
var stringToCode = require('../utils').stringToCode; var stringToCode = require('../utils').stringToCode;
var parseExtra = require('../parsers/extra'); var parseExtra = require('../parsers/extra');
module.exports = function(jsonMsg) { module.exports = (jsonMsg) => {
var username, msg, sender, broadcast, connected, max, current, pages, player, victim, killer, achievement; var username, msg, sender, broadcast, connected, max, current, pages, player, victim, killer, achievement;
var color = stringToCode(jsonMsg.color); var color = stringToCode(jsonMsg.color);
+2 -2
View File
@@ -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) { if (socket.mcbot && socket.mcbot.entity) {
socket.mcbot.chat(data.message); socket.mcbot.chat(data.message);
} }
+3 -3
View File
@@ -1,9 +1,9 @@
var mineflayer = require('mineflayer'); var mineflayer = require('mineflayer');
var events = require('../../bot'); 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) { if (socket.mcbot) {
socket.emit('buffer:error', 'Pleae disconnect before connecting again'); socket.emit('buffer:error', 'Pleae disconnect before connecting again');
@@ -22,7 +22,7 @@ module.exports = function(socket) {
socket.connectionParams = data; socket.connectionParams = data;
// prepare for errors // prepare for errors
socket.mcbot.on('error', function(error) { socket.mcbot.on('error', (error) => {
if (error.toString() === 'Error: write after end') return; if (error.toString() === 'Error: write after end') return;
socket.emit('buffer:error', error); socket.emit('buffer:error', error);
if (socket.mcbot.entity) socket.mcbot.end(); if (socket.mcbot.entity) socket.mcbot.end();
+3 -3
View File
@@ -1,7 +1,7 @@
module.exports = function(socket) { module.exports = (socket) => {
socket.on('disconnect', function() { socket.on('disconnect', () => {
if (socket.mcbot) { if (socket.mcbot) {
socket.mcbot.end(); socket.mcbot.end();
delete socket.mcbot; delete socket.mcbot;
@@ -9,7 +9,7 @@ module.exports = function(socket) {
}); });
socket.on('bot:disconnect', function() { socket.on('bot:disconnect', () => {
if (socket.mcbot) { if (socket.mcbot) {
socket.mcbot.end(); socket.mcbot.end();
delete socket.mcbot; delete socket.mcbot;
+2 -2
View File
@@ -1,6 +1,6 @@
module.exports = function(socket) { module.exports = (socket) => {
socket.on('players', function() { socket.on('players', () => {
if (socket.mcbot && socket.mcbot.players) { if (socket.mcbot && socket.mcbot.players) {
socket.emit('bot:players', socket.mcbot.players); socket.emit('bot:players', socket.mcbot.players);
} }
+2 -2
View File
@@ -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 // bind all listeners to the socket
require('./events/connection')(socket); require('./events/connection')(socket);
+1 -1
View File
@@ -1,4 +1,4 @@
module.exports = function escapeHtml(unsafe) { module.exports = (unsafe) => {
return unsafe return unsafe
.replace(/&/g, '&amp;') .replace(/&/g, '&amp;')
.replace(/</g, '&lt;') .replace(/</g, '&lt;')
+1 -1
View File
@@ -1,4 +1,4 @@
module.exports = function stringToCode(string) { module.exports = (string) => {
var dictionary = { var dictionary = {
'black': 0, 'black': 0,