mirror of
https://github.com/unmojang/node-minecraft-protocol.git
synced 2025-09-29 14:13:45 -04:00
Move onLogin set state=PLAY to client/play
This commit is contained in:
parent
b37dcc4d08
commit
34534b2aa6
11
src/client/play.js
Normal file
11
src/client/play.js
Normal file
@ -0,0 +1,11 @@
|
||||
var states = require("../states");
|
||||
|
||||
module.exports = function(client, options) {
|
||||
client.once('success', onLogin);
|
||||
|
||||
function onLogin(packet) {
|
||||
client.state = states.PLAY;
|
||||
client.uuid = packet.uuid;
|
||||
client.username = packet.username;
|
||||
}
|
||||
};
|
@ -3,7 +3,6 @@ var net = require('net');
|
||||
var dns = require('dns');
|
||||
var Client = require('./client');
|
||||
var assert = require('assert');
|
||||
var states = require("./states");
|
||||
var debug = require("./debug");
|
||||
|
||||
var encrypt = require('./client/encrypt');
|
||||
@ -11,6 +10,7 @@ var keepalive = require('./client/keepalive');
|
||||
var compress = require('./client/compress');
|
||||
var caseCorrect = require('./client/caseCorrect');
|
||||
var setProtocol = require('./client/setProtocol');
|
||||
var play = require('./client/play');
|
||||
|
||||
module.exports=createClient;
|
||||
|
||||
@ -42,20 +42,14 @@ function createClient(options) {
|
||||
options.majorVersion = version.majorVersion;
|
||||
options.protocolVersion = version.version;
|
||||
|
||||
|
||||
var client = new Client(false, options.majorVersion);
|
||||
|
||||
setProtocol(client, options);
|
||||
keepalive(client, options);
|
||||
encrypt(client);
|
||||
client.once('success', onLogin);
|
||||
play(client);
|
||||
compress(client);
|
||||
caseCorrect(client, options);
|
||||
|
||||
return client;
|
||||
|
||||
function onLogin(packet) {
|
||||
client.state = states.PLAY;
|
||||
client.uuid = packet.uuid;
|
||||
client.username = packet.username;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user