a few small changes to make the code better

This commit is contained in:
Romain Beaumont 2015-11-30 22:19:56 +01:00
parent f3a653ef1c
commit b2b53c9343
14 changed files with 40 additions and 47 deletions
examples
client_chat
proxy
server
server_helloworld

View file

@ -55,7 +55,7 @@ if(process.argv.length < 5) {
process.exit(1);
}
process.argv.forEach(function(val, index, array) {
process.argv.forEach(function(val) {
if(val == "-h") {
print_help();
process.exit(0);
@ -167,9 +167,9 @@ function parseChat(chatObj, parentState) {
chat += color(util.format.apply(this, args), getColorize(parentState));
}
for(var i in chatObj.extra) {
chatObj.extra.forEach(function(i) {
chat += parseChat(chatObj.extra[i], parentState);
}
});
return chat;
}
}

View file

@ -26,7 +26,7 @@ if(process.argv.length < 4) {
printHelpAndExit(1);
}
process.argv.forEach(function(val, index, array) {
process.argv.forEach(function(val) {
if(val == "-h") {
printHelpAndExit(0);
}
@ -175,8 +175,8 @@ srv.on('login', function(client) {
function shouldDump(name, direction) {
if(matches(printNameBlacklist[name])) return false;
if(printAllNames) return true;
if(matches(printNameWhitelist[name])) return true;
return false;
return matches(printNameWhitelist[name]);
function matches(result) {
return result != null && result.indexOf(direction) !== -1;
}

View file

@ -1,11 +1,10 @@
var mc = require('minecraft-protocol');
var states = mc.states;
var options = {
motd: 'Vox Industries',
'max-players': 127,
port: 25565,
'online-mode': false,
'online-mode': false
};
var server = mc.createServer(options);

View file

@ -1,7 +1,7 @@
var mc = require('minecraft-protocol');
var options = {
'online-mode': true,
'online-mode': true
};
var server = mc.createServer(options);