mirror of
https://github.com/unmojang/node-minecraft-protocol.git
synced 2025-09-29 14:13:45 -04:00
Move keepAlive/checkTimeoutInterval to client/keepalive
This commit is contained in:
parent
20e076ebcf
commit
8c4406b4a2
@ -1,4 +1,9 @@
|
||||
module.exports = function(client) {
|
||||
module.exports = function(client, options) {
|
||||
var keepAlive = options.keepAlive == null ? true : options.keepAlive;
|
||||
if (!keepAlive) return;
|
||||
|
||||
var checkTimeoutInterval = options.checkTimeoutInterval || 10 * 1000;
|
||||
|
||||
client.on('keep_alive', onKeepAlive);
|
||||
|
||||
var timeout = null;
|
||||
|
@ -37,8 +37,6 @@ function createClient(options) {
|
||||
|
||||
assert.ok(options.username, "username is required");
|
||||
var haveCredentials = options.password != null || (clientToken != null && options.session != null);
|
||||
var keepAlive = options.keepAlive == null ? true : options.keepAlive;
|
||||
var checkTimeoutInterval = options.checkTimeoutInterval || 10 * 1000;
|
||||
|
||||
var optVersion = options.version || require("./version").defaultVersion;
|
||||
var mcData=require("minecraft-data")(optVersion);
|
||||
@ -47,7 +45,7 @@ function createClient(options) {
|
||||
|
||||
var client = new Client(false,version.majorVersion);
|
||||
client.on('connect', onConnect);
|
||||
if(keepAlive) keepalive(client);
|
||||
keepalive(client, options);
|
||||
encrypt(client);
|
||||
client.once('success', onLogin);
|
||||
compress(client);
|
||||
|
Loading…
x
Reference in New Issue
Block a user