mirror of
https://github.com/unmojang/node-minecraft-protocol.git
synced 2025-09-29 14:13:45 -04:00
Fix createServer
This commit is contained in:
parent
36d75fd3b6
commit
1efc14be78
@ -68,7 +68,7 @@ function createClient(options) {
|
|||||||
if (options.session) {
|
if (options.session) {
|
||||||
yggdrasil.validate(options.session.accessToken, function(ok) {
|
yggdrasil.validate(options.session.accessToken, function(ok) {
|
||||||
if (ok)
|
if (ok)
|
||||||
cb(null, options.sesson);
|
cb(null, options.session);
|
||||||
else
|
else
|
||||||
yggdrasil.refresh(options.session.accessToken, options.session.clientToken, function(err, _, data) {
|
yggdrasil.refresh(options.session.accessToken, options.session.clientToken, function(err, _, data) {
|
||||||
cb(err, data);
|
cb(err, data);
|
||||||
|
@ -181,15 +181,14 @@ function createServer(options) {
|
|||||||
nextStep();
|
nextStep();
|
||||||
|
|
||||||
function verifyUsername() {
|
function verifyUsername() {
|
||||||
yggserver.hasJoined(client.username, serverId, sharedSecret, client.publicKey, function(err, uuid, profile) {
|
yggserver.hasJoined(client.username, serverId, sharedSecret, client.publicKey, function(err, profile) {
|
||||||
if(err) {
|
if(err) {
|
||||||
client.end("Failed to verify username!");
|
client.end("Failed to verify username!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
client.uuid = uuid;
|
|
||||||
// Convert to a valid UUID until the session server updates and does
|
// Convert to a valid UUID until the session server updates and does
|
||||||
// it automatically
|
// it automatically
|
||||||
client.uuid = client.uuid.replace(/(\w{8})(\w{4})(\w{4})(\w{4})(\w{12})/, "$1-$2-$3-$4-$5");
|
client.uuid = profile.id.replace(/(\w{8})(\w{4})(\w{4})(\w{4})(\w{12})/, "$1-$2-$3-$4-$5");
|
||||||
client.profile = profile;
|
client.profile = profile;
|
||||||
loginClient();
|
loginClient();
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user