Proper tabbing, implementing other players

This commit is contained in:
mhsjlw 2015-08-25 11:00:33 -04:00
parent 703abc22e8
commit be576b7494

34
app.js
View file

@ -35,19 +35,19 @@ server.on('login', function(client) {
playersConnected.push(client); playersConnected.push(client);
playersConnected.forEach(function(entry) { playersConnected.forEach(function(entry) {
// if(entry != client) { if(entry != client) {
// client.write('named_entity_spawn', { client.write('named_entity_spawn', {
// entityId: entry.id, entityId: entry.id,
// playerUUID: entry.uuid, playerUUID: entry.uuid,
// x: 0, x: 6,
// y: 0, y: 53,
// z: 0, z: 6,
// yaw: 0, yaw: 0,
// pitch 0, pitch: 0,
// currentItem: currentItem: 0,
// metadata: metadata: []
// }); });
// } }
}); });
Object.keys(server.clients).forEach(function(clientKey) { Object.keys(server.clients).forEach(function(clientKey) {
@ -67,16 +67,16 @@ server.on('login', function(client) {
}); });
playersConnected.forEach(function(entry) { playersConnected.forEach(function(entry) {
entry.write('player_info', { client.write('player_info', {
action: 0, action: 0,
data: [{ data: [{
UUID: client.uuid.split("-").map(function(item) { return parseInt(item, 16); }), UUID: entry.uuid.split("-").map(function(item) { return parseInt(item, 16); }),
name: client.username, name: entry.username,
properties: [], properties: [],
gamemode: 0, gamemode: 0,
ping: 1, ping: 1,
hasDisplayName: true, hasDisplayName: true,
displayName: client.username displayName: entry.username
}] }]
}); });
}); });