diff --git a/components/authenticator.js b/components/authenticator.js index 5a3a8d2..907eca8 100644 --- a/components/authenticator.js +++ b/components/authenticator.js @@ -10,7 +10,7 @@ module.exports.getAuth = function (username, password) { client_token: uuid(), uuid: uuid(), name: username, - user_properties: JSON.stringify({}) + user_properties: '{}' } return resolve(user) @@ -42,7 +42,7 @@ module.exports.getAuth = function (username, password) { uuid: body.selectedProfile.id, name: body.selectedProfile.name, selected_profile: body.selectedProfile, - user_properties: JSON.stringify(body.user.properties || {}) + user_properties: parsePropts(body.user.properties) } resolve(userProfile) @@ -92,7 +92,7 @@ module.exports.refreshAuth = function (accessToken, clientToken, selectedProfile client_token: uuid(), uuid: body.selectedProfile.id, name: body.selectedProfile.name, - user_properties: JSON.stringify(body.user.properties || {}) + user_properties: parsePropts(body.user.properties) } resolve(userProfile) @@ -141,3 +141,19 @@ module.exports.signOut = function (username, password) { module.exports.changeApiUrl = function (url) { api_url = url } + +function parsePropts (array) { + if (array) { + const newObj = {} + for (const entry of array) { + if (newObj[entry.name]) { + newObj[entry.name].push(entry.value) + } else { + newObj[entry.name] = [entry.value] + } + } + return JSON.stringify(newObj) + } else { + return '{}' + } +} diff --git a/package.json b/package.json index 6f45508..e8a7dae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "minecraft-launcher-core", - "version": "3.16.2", + "version": "3.16.3", "description": "Lightweight module that downloads and runs Minecraft using javascript / NodeJS", "main": "index.js", "dependencies": {