Update documentation for version:false option

This commit is contained in:
deathcap 2016-01-31 12:44:06 -08:00
parent 2e2a213076
commit 88e8374ad4
2 changed files with 4 additions and 12 deletions

View File

@ -73,11 +73,7 @@ Returns a `Client` instance and perform login.
* accessToken : generated if a password is given * accessToken : generated if a password is given
* keepAlive : send keep alive packets : default to true * keepAlive : send keep alive packets : default to true
* checkTimeoutInterval : default to `10*1000` (10s), check if keepalive received at that period, disconnect otherwise. * 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 * version : 1.8 or 1.9 or false (to auto-negotiate): default to 1.8
## mc.createClientAuto(options)
Pings the server and attempts to call `createClient(options)` with the appropriate protocol version.
## mc.Client(isServer,version) ## mc.Client(isServer,version)

View File

@ -31,8 +31,7 @@ module.exports = function(client) {
ping(pingOptions, function(err, response) { ping(pingOptions, function(err, response) {
if (err) throw err; // hmm if (err) throw err; // hmm
debug('ping response',response); debug('ping response',response);
// TODO: could also use ping pre-connect to save description, type, negotiate protocol etc. // TODO: could also use ping pre-connect to save description, type, max players, etc.
// ^ see https://github.com/PrismarineJS/node-minecraft-protocol/issues/327
var motd = response.description; var motd = response.description;
debug('Server description:',motd); // TODO: save 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. // even though it is in a format accepted by minecraft-data. Instead, translate the protocol.
var [minecraftVersion, majorVersion] = protocolVersion2MinecraftVersion(protocolVersion); var [minecraftVersion, majorVersion] = protocolVersion2MinecraftVersion(protocolVersion);
client.options.version = minecraftVersion; client.options.version = minecraftVersion;
// Use the exact same protocol version
// Requires https://github.com/PrismarineJS/node-minecraft-protocol/pull/330
client.options.protocolVersion = protocolVersion; 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.version = majorVersion;
client.state = states.HANDSHAKING; client.state = states.HANDSHAKING;
@ -65,7 +61,7 @@ module.exports = function(client) {
// TODO: modify client object to set forgeMods and enable forgeHandshake // TODO: modify client object to set forgeMods and enable forgeHandshake
throw new Error('FML/Forge not yet supported'); 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'); client.emit('connect_allowed');
}); });
return client; return client;