diff --git a/doc/README.md b/doc/README.md index 68b54b7..f87a864 100644 --- a/doc/README.md +++ b/doc/README.md @@ -73,11 +73,7 @@ Returns a `Client` instance and perform login. * accessToken : generated if a password is given * keepAlive : send keep alive packets : default to true * checkTimeoutInterval : default to `10*1000` (10s), check if keepalive received at that period, disconnect otherwise. - * version : 1.8 or 1.9 : default to 1.8 - -## mc.createClientAuto(options) - -Pings the server and attempts to call `createClient(options)` with the appropriate protocol version. + * version : 1.8 or 1.9 or false (to auto-negotiate): default to 1.8 ## mc.Client(isServer,version) diff --git a/src/client/autoVersion.js b/src/client/autoVersion.js index 5a41b2b..6d58a87 100644 --- a/src/client/autoVersion.js +++ b/src/client/autoVersion.js @@ -31,8 +31,7 @@ module.exports = function(client) { ping(pingOptions, function(err, response) { if (err) throw err; // hmm debug('ping response',response); - // TODO: could also use ping pre-connect to save description, type, negotiate protocol etc. - // ^ see https://github.com/PrismarineJS/node-minecraft-protocol/issues/327 + // TODO: could also use ping pre-connect to save description, type, max players, etc. var motd = response.description; debug('Server description:',motd); // TODO: save @@ -47,12 +46,9 @@ module.exports = function(client) { // even though it is in a format accepted by minecraft-data. Instead, translate the protocol. var [minecraftVersion, majorVersion] = protocolVersion2MinecraftVersion(protocolVersion); client.options.version = minecraftVersion; - - // Use the exact same protocol version - // Requires https://github.com/PrismarineJS/node-minecraft-protocol/pull/330 client.options.protocolVersion = protocolVersion; - // reinitialize client object with new version TODO: move out of its constructor + // Reinitialize client object with new version TODO: move out of its constructor? client.version = majorVersion; client.state = states.HANDSHAKING; @@ -65,7 +61,7 @@ module.exports = function(client) { // TODO: modify client object to set forgeMods and enable forgeHandshake throw new Error('FML/Forge not yet supported'); } - // done configuring client object, let connection proceed + // Finished configuring client object, let connection proceed client.emit('connect_allowed'); }); return client;