Cleaning up jsdocs to be more aligned with the standard.
This commit is contained in:
parent
d3c5997baa
commit
4fd202d180
@ -39,11 +39,11 @@ class Asset {
|
||||
/**
|
||||
* Create an asset.
|
||||
*
|
||||
* @param {any} id - id of the asset.
|
||||
* @param {String} hash - hash value of the asset.
|
||||
* @param {Number} size - size in bytes of the asset.
|
||||
* @param {String} from - url where the asset can be found.
|
||||
* @param {String} to - absolute local file path of the asset.
|
||||
* @param {any} id The id of the asset.
|
||||
* @param {string} hash The hash value of the asset.
|
||||
* @param {number} size The size in bytes of the asset.
|
||||
* @param {string} from The url where the asset can be found.
|
||||
* @param {string} to The absolute local file path of the asset.
|
||||
*/
|
||||
constructor(id, hash, size, from, to){
|
||||
this.id = id
|
||||
@ -80,8 +80,8 @@ class Library extends Asset {
|
||||
* property has instead specified an OS, the library can be downloaded on any OS EXCLUDING
|
||||
* the one specified.
|
||||
*
|
||||
* @param {Object} rules - the Library's download rules.
|
||||
* @returns {Boolean} - true if the Library follows the specified rules, otherwise false.
|
||||
* @param {Object} rules The Library's download rules.
|
||||
* @returns {boolean} True if the Library follows the specified rules, otherwise false.
|
||||
*/
|
||||
static validateRules(rules){
|
||||
if(rules == null) return true
|
||||
@ -115,12 +115,12 @@ class DistroModule extends Asset {
|
||||
* not equivalent to the module objects in the
|
||||
* distro index.
|
||||
*
|
||||
* @param {any} id - id of the asset.
|
||||
* @param {String} hash - hash value of the asset.
|
||||
* @param {Number} size - size in bytes of the asset.
|
||||
* @param {String} from - url where the asset can be found.
|
||||
* @param {String} to - absolute local file path of the asset.
|
||||
* @param {String} type - the module type.
|
||||
* @param {any} id The id of the asset.
|
||||
* @param {string} hash The hash value of the asset.
|
||||
* @param {number} size The size in bytes of the asset.
|
||||
* @param {string} from The url where the asset can be found.
|
||||
* @param {string} to The absolute local file path of the asset.
|
||||
* @param {string} type The the module type.
|
||||
*/
|
||||
constructor(id, hash, size, from, to, type){
|
||||
super(id, hash, size, from, to)
|
||||
@ -138,9 +138,9 @@ class DLTracker {
|
||||
/**
|
||||
* Create a DLTracker
|
||||
*
|
||||
* @param {Array.<Asset>} dlqueue - an array containing assets queued for download.
|
||||
* @param {Number} dlsize - the combined size of each asset in the download queue array.
|
||||
* @param {function(Asset)} callback - optional callback which is called when an asset finishes downloading.
|
||||
* @param {Array.<Asset>} dlqueue An array containing assets queued for download.
|
||||
* @param {number} dlsize The combined size of each asset in the download queue array.
|
||||
* @param {function(Asset)} callback Optional callback which is called when an asset finishes downloading.
|
||||
*/
|
||||
constructor(dlqueue, dlsize, callback = null){
|
||||
this.dlqueue = dlqueue
|
||||
@ -167,8 +167,8 @@ class AssetGuard extends EventEmitter {
|
||||
* On creation the object's properties are never-null default
|
||||
* values. Each identifier is resolved to an empty DLTracker.
|
||||
*
|
||||
* @param {String} basePath - base path for asset validation (game root).
|
||||
* @param {String} javaexec - path to a java executable which will be used
|
||||
* @param {string} basePath The base path for asset validation (game root).
|
||||
* @param {string} javaexec The path to a java executable which will be used
|
||||
* to finalize installation.
|
||||
*/
|
||||
constructor(basePath, javaexec){
|
||||
@ -190,9 +190,9 @@ class AssetGuard extends EventEmitter {
|
||||
* 'net.minecraftforge:forge:1.11.2-13.20.0.2282', '.jar' becomes
|
||||
* net\minecraftforge\forge\1.11.2-13.20.0.2282\forge-1.11.2-13.20.0.2282.jar
|
||||
*
|
||||
* @param {String} artifactid - the artifact id string.
|
||||
* @param {String} extension - the extension of the file at the resolved path.
|
||||
* @returns {String} - the resolved relative path from the artifact id.
|
||||
* @param {string} artifactid The artifact id string.
|
||||
* @param {string} extension The extension of the file at the resolved path.
|
||||
* @returns {string} The resolved relative path from the artifact id.
|
||||
*/
|
||||
static _resolvePath(artifactid, extension){
|
||||
let ps = artifactid.split(':')
|
||||
@ -210,9 +210,9 @@ class AssetGuard extends EventEmitter {
|
||||
* 'net.minecraftforge:forge:1.11.2-13.20.0.2282', '.jar' becomes
|
||||
* net/minecraftforge/forge/1.11.2-13.20.0.2282/forge-1.11.2-13.20.0.2282.jar
|
||||
*
|
||||
* @param {String} artifactid - the artifact id string.
|
||||
* @param {String} extension - the extension of the file at the resolved url.
|
||||
* @returns {String} - the resolved relative URL from the artifact id.
|
||||
* @param {string} artifactid The artifact id string.
|
||||
* @param {string} extension The extension of the file at the resolved url.
|
||||
* @returns {string} The resolved relative URL from the artifact id.
|
||||
*/
|
||||
static _resolveURL(artifactid, extension){
|
||||
let ps = artifactid.split(':')
|
||||
@ -228,9 +228,9 @@ class AssetGuard extends EventEmitter {
|
||||
/**
|
||||
* Calculates the hash for a file using the specified algorithm.
|
||||
*
|
||||
* @param {Buffer} buf - the buffer containing file data.
|
||||
* @param {String} algo - the hash algorithm.
|
||||
* @returns {String} - the calculated hash in hex.
|
||||
* @param {Buffer} buf The buffer containing file data.
|
||||
* @param {string} algo The hash algorithm.
|
||||
* @returns {string} The calculated hash in hex.
|
||||
*/
|
||||
static _calculateHash(buf, algo){
|
||||
return crypto.createHash(algo).update(buf).digest('hex')
|
||||
@ -240,8 +240,8 @@ class AssetGuard extends EventEmitter {
|
||||
* Used to parse a checksums file. This is specifically designed for
|
||||
* the checksums.sha1 files found inside the forge scala dependencies.
|
||||
*
|
||||
* @param {String} content - the string content of the checksums file.
|
||||
* @returns {Object} - an object with keys being the file names, and values being the hashes.
|
||||
* @param {string} content The string content of the checksums file.
|
||||
* @returns {Object} An object with keys being the file names, and values being the hashes.
|
||||
*/
|
||||
static _parseChecksumsFile(content){
|
||||
let finalContent = {}
|
||||
@ -259,10 +259,10 @@ class AssetGuard extends EventEmitter {
|
||||
/**
|
||||
* Validate that a file exists and matches a given hash value.
|
||||
*
|
||||
* @param {String} filePath - the path of the file to validate.
|
||||
* @param {String} algo - the hash algorithm to check against.
|
||||
* @param {String} hash - the existing hash to check against.
|
||||
* @returns {Boolean} - true if the file exists and calculated hash matches the given hash, otherwise false.
|
||||
* @param {string} filePath The path of the file to validate.
|
||||
* @param {string} algo The hash algorithm to check against.
|
||||
* @param {string} hash The existing hash to check against.
|
||||
* @returns {boolean} True if the file exists and calculated hash matches the given hash, otherwise false.
|
||||
*/
|
||||
static _validateLocal(filePath, algo, hash){
|
||||
if(fs.existsSync(filePath)){
|
||||
@ -281,10 +281,10 @@ class AssetGuard extends EventEmitter {
|
||||
/**
|
||||
* Statically retrieve the distribution data.
|
||||
*
|
||||
* @param {String} basePath - base path for asset validation (game root).
|
||||
* @param {Boolean} cached - optional. False if the distro should be freshly downloaded, else
|
||||
* @param {string} basePath The base path for asset validation (game root).
|
||||
* @param {boolean} cached Optional. False if the distro should be freshly downloaded, else
|
||||
* a cached copy will be returned.
|
||||
* @returns {Promise.<Object>} - A promise which resolves to the distribution data object.
|
||||
* @returns {Promise.<Object>} A promise which resolves to the distribution data object.
|
||||
*/
|
||||
static retrieveDistributionData(basePath, cached = true){
|
||||
return new Promise(function(fulfill, reject){
|
||||
@ -308,10 +308,10 @@ class AssetGuard extends EventEmitter {
|
||||
/**
|
||||
* Statically retrieve the distribution data.
|
||||
*
|
||||
* @param {String} basePath - base path for asset validation (game root).
|
||||
* @param {Boolean} cached - optional. False if the distro should be freshly downloaded, else
|
||||
* @param {string} basePath The base path for asset validation (game root).
|
||||
* @param {boolean} cached Optional. False if the distro should be freshly downloaded, else
|
||||
* a cached copy will be returned.
|
||||
* @returns {Object} - The distribution data object.
|
||||
* @returns {Object} The distribution data object.
|
||||
*/
|
||||
static retrieveDistributionDataSync(basePath, cached = true){
|
||||
if(!cached || distributionData == null){
|
||||
@ -323,8 +323,8 @@ class AssetGuard extends EventEmitter {
|
||||
/**
|
||||
* Resolve the default selected server from the distribution index.
|
||||
*
|
||||
* @param {String} basePath - base path for asset validation (game root).
|
||||
* @returns {Object} - An object resolving to the default selected server.
|
||||
* @param {string} basePath The base path for asset validation (game root).
|
||||
* @returns {Object} An object resolving to the default selected server.
|
||||
*/
|
||||
static resolveSelectedServer(basePath){
|
||||
const distro = AssetGuard.retrieveDistributionDataSync(basePath)
|
||||
@ -343,9 +343,9 @@ class AssetGuard extends EventEmitter {
|
||||
* Returns null if the ID could not be found or the distro index has
|
||||
* not yet been loaded.
|
||||
*
|
||||
* @param {String} basePath - base path for asset validation (game root).
|
||||
* @param {String} serverID - The id of the server to retrieve.
|
||||
* @returns {Object} - The server object whose id matches the parameter.
|
||||
* @param {string} basePath The base path for asset validation (game root).
|
||||
* @param {string} serverID The id of the server to retrieve.
|
||||
* @returns {Object} The server object whose id matches the parameter.
|
||||
*/
|
||||
static getServerById(basePath, serverID){
|
||||
if(distributionData == null){
|
||||
@ -364,9 +364,9 @@ class AssetGuard extends EventEmitter {
|
||||
/**
|
||||
* Validates a file in the style used by forge's version index.
|
||||
*
|
||||
* @param {String} filePath - the path of the file to validate.
|
||||
* @param {Array.<String>} checksums - the checksums listed in the forge version index.
|
||||
* @returns {Boolean} - true if the file exists and the hashes match, otherwise false.
|
||||
* @param {string} filePath The path of the file to validate.
|
||||
* @param {Array.<string>} checksums The checksums listed in the forge version index.
|
||||
* @returns {boolean} True if the file exists and the hashes match, otherwise false.
|
||||
*/
|
||||
static _validateForgeChecksum(filePath, checksums){
|
||||
if(fs.existsSync(filePath)){
|
||||
@ -389,9 +389,9 @@ class AssetGuard extends EventEmitter {
|
||||
* This can be an expensive task as it usually requires that we calculate thousands
|
||||
* of hashes.
|
||||
*
|
||||
* @param {Buffer} buf - the buffer of the jar file.
|
||||
* @param {Array.<String>} checksums - the checksums listed in the forge version index.
|
||||
* @returns {Boolean} - true if all hashes declared in the checksums.sha1 file match the actual hashes.
|
||||
* @param {Buffer} buf The buffer of the jar file.
|
||||
* @param {Array.<string>} checksums The checksums listed in the forge version index.
|
||||
* @returns {boolean} True if all hashes declared in the checksums.sha1 file match the actual hashes.
|
||||
*/
|
||||
static _validateForgeJar(buf, checksums){
|
||||
// Double pass method was the quickest I found. I tried a version where we store data
|
||||
@ -429,8 +429,8 @@ class AssetGuard extends EventEmitter {
|
||||
/**
|
||||
* Extracts and unpacks a file from .pack.xz format.
|
||||
*
|
||||
* @param {Array.<String>} filePaths - The paths of the files to be extracted and unpacked.
|
||||
* @returns {Promise.<Void>} - An empty promise to indicate the extraction has completed.
|
||||
* @param {Array.<string>} filePaths The paths of the files to be extracted and unpacked.
|
||||
* @returns {Promise.<void>} An empty promise to indicate the extraction has completed.
|
||||
*/
|
||||
static _extractPackXZ(filePaths, javaExecutable){
|
||||
return new Promise(function(fulfill, reject){
|
||||
@ -456,9 +456,9 @@ class AssetGuard extends EventEmitter {
|
||||
* instance already exists, the contents of the version.json file are read and returned
|
||||
* in a promise.
|
||||
*
|
||||
* @param {Asset} asset - The Asset object representing Forge.
|
||||
* @param {String} basePath - Base path for asset validation (game root).
|
||||
* @returns {Promise.<Object>} - A promise which resolves to the contents of forge's version.json.
|
||||
* @param {Asset} asset The Asset object representing Forge.
|
||||
* @param {string} basePath Base path for asset validation (game root).
|
||||
* @returns {Promise.<Object>} A promise which resolves to the contents of forge's version.json.
|
||||
*/
|
||||
static _finalizeForgeAsset(asset, basePath){
|
||||
return new Promise(function(fulfill, reject){
|
||||
@ -491,9 +491,9 @@ class AssetGuard extends EventEmitter {
|
||||
/**
|
||||
* Initiate an async download process for an AssetGuard DLTracker.
|
||||
*
|
||||
* @param {String} identifier - the identifier of the AssetGuard DLTracker.
|
||||
* @param {Number} limit - optional. The number of async processes to run in parallel.
|
||||
* @returns {Boolean} - true if the process began, otherwise false.
|
||||
* @param {string} identifier The identifier of the AssetGuard DLTracker.
|
||||
* @param {number} limit Optional. The number of async processes to run in parallel.
|
||||
* @returns {boolean} True if the process began, otherwise false.
|
||||
*/
|
||||
startAsyncProcess(identifier, limit = 5){
|
||||
const self = this
|
||||
@ -559,9 +559,9 @@ class AssetGuard extends EventEmitter {
|
||||
/**
|
||||
* Loads the version data for a given minecraft version.
|
||||
*
|
||||
* @param {String} version - the game version for which to load the index data.
|
||||
* @param {Boolean} force - optional. If true, the version index will be downloaded even if it exists locally. Defaults to false.
|
||||
* @returns {Promise.<Object>} - Promise which resolves to the version data object.
|
||||
* @param {string} version The game version for which to load the index data.
|
||||
* @param {boolean} force Optional. If true, the version index will be downloaded even if it exists locally. Defaults to false.
|
||||
* @returns {Promise.<Object>} Promise which resolves to the version data object.
|
||||
*/
|
||||
loadVersionData(version, force = false){
|
||||
const self = this
|
||||
@ -592,9 +592,9 @@ class AssetGuard extends EventEmitter {
|
||||
* asset entry. In this analysis it will check to see if the local file exists and is valid.
|
||||
* If not, it will be added to the download queue for the 'assets' identifier.
|
||||
*
|
||||
* @param {Object} versionData - the version data for the assets.
|
||||
* @param {Boolean} force - optional. If true, the asset index will be downloaded even if it exists locally. Defaults to false.
|
||||
* @returns {Promise.<Void>} - An empty promise to indicate the async processing has completed.
|
||||
* @param {Object} versionData The version data for the assets.
|
||||
* @param {boolean} force Optional. If true, the asset index will be downloaded even if it exists locally. Defaults to false.
|
||||
* @returns {Promise.<void>} An empty promise to indicate the async processing has completed.
|
||||
*/
|
||||
validateAssets(versionData, force = false){
|
||||
const self = this
|
||||
@ -610,8 +610,8 @@ class AssetGuard extends EventEmitter {
|
||||
* Private function used to chain the asset validation process. This function retrieves
|
||||
* the index data.
|
||||
* @param {Object} versionData
|
||||
* @param {Boolean} force
|
||||
* @returns {Promise.<Void>} - An empty promise to indicate the async processing has completed.
|
||||
* @param {boolean} force
|
||||
* @returns {Promise.<void>} An empty promise to indicate the async processing has completed.
|
||||
*/
|
||||
_assetChainIndexData(versionData, force = false){
|
||||
const self = this
|
||||
@ -646,8 +646,8 @@ class AssetGuard extends EventEmitter {
|
||||
* Private function used to chain the asset validation process. This function processes
|
||||
* the assets and enqueues missing or invalid files.
|
||||
* @param {Object} versionData
|
||||
* @param {Boolean} force
|
||||
* @returns {Promise.<Void>} - An empty promise to indicate the async processing has completed.
|
||||
* @param {boolean} force
|
||||
* @returns {Promise.<void>} An empty promise to indicate the async processing has completed.
|
||||
*/
|
||||
_assetChainValidateAssets(versionData, indexData){
|
||||
const self = this
|
||||
@ -685,8 +685,8 @@ class AssetGuard extends EventEmitter {
|
||||
* check to see if the local file exists and is valid. If not, it will be added to the download
|
||||
* queue for the 'libraries' identifier.
|
||||
*
|
||||
* @param {Object} versionData - the version data for the assets.
|
||||
* @returns {Promise.<Void>} - An empty promise to indicate the async processing has completed.
|
||||
* @param {Object} versionData The version data for the assets.
|
||||
* @returns {Promise.<void>} An empty promise to indicate the async processing has completed.
|
||||
*/
|
||||
validateLibraries(versionData){
|
||||
const self = this
|
||||
@ -720,8 +720,8 @@ class AssetGuard extends EventEmitter {
|
||||
* Public miscellaneous mojang file validation function. These files will be enqueued under
|
||||
* the 'files' identifier.
|
||||
*
|
||||
* @param {Object} versionData - the version data for the assets.
|
||||
* @returns {Promise.<Void>} - An empty promise to indicate the async processing has completed.
|
||||
* @param {Object} versionData The version data for the assets.
|
||||
* @returns {Promise.<void>} An empty promise to indicate the async processing has completed.
|
||||
*/
|
||||
validateMiscellaneous(versionData){
|
||||
const self = this
|
||||
@ -735,9 +735,9 @@ class AssetGuard extends EventEmitter {
|
||||
/**
|
||||
* Validate client file - artifact renamed from client.jar to '{version}'.jar.
|
||||
*
|
||||
* @param {Object} versionData - the version data for the assets.
|
||||
* @param {Boolean} force - optional. If true, the asset index will be downloaded even if it exists locally. Defaults to false.
|
||||
* @returns {Promise.<Void>} - An empty promise to indicate the async processing has completed.
|
||||
* @param {Object} versionData The version data for the assets.
|
||||
* @param {boolean} force Optional. If true, the asset index will be downloaded even if it exists locally. Defaults to false.
|
||||
* @returns {Promise.<void>} An empty promise to indicate the async processing has completed.
|
||||
*/
|
||||
validateClient(versionData, force = false){
|
||||
const self = this
|
||||
@ -762,9 +762,9 @@ class AssetGuard extends EventEmitter {
|
||||
/**
|
||||
* Validate log config.
|
||||
*
|
||||
* @param {Object} versionData - the version data for the assets.
|
||||
* @param {Boolean} force - optional. If true, the asset index will be downloaded even if it exists locally. Defaults to false.
|
||||
* @returns {Promise.<Void>} - An empty promise to indicate the async processing has completed.
|
||||
* @param {Object} versionData The version data for the assets.
|
||||
* @param {boolean} force Optional. If true, the asset index will be downloaded even if it exists locally. Defaults to false.
|
||||
* @returns {Promise.<void>} An empty promise to indicate the async processing has completed.
|
||||
*/
|
||||
validateLogConfig(versionData){
|
||||
const self = this
|
||||
@ -788,8 +788,8 @@ class AssetGuard extends EventEmitter {
|
||||
/**
|
||||
* Validate the distribution.
|
||||
*
|
||||
* @param {String} serverpackid - The id of the server to validate.
|
||||
* @returns {Promise.<Object>} - A promise which resolves to the server distribution object.
|
||||
* @param {string} serverpackid The id of the server to validate.
|
||||
* @returns {Promise.<Object>} A promise which resolves to the server distribution object.
|
||||
*/
|
||||
validateDistribution(serverpackid){
|
||||
const self = this
|
||||
@ -889,8 +889,8 @@ class AssetGuard extends EventEmitter {
|
||||
/**
|
||||
* Loads Forge's version.json data into memory for the specified server id.
|
||||
*
|
||||
* @param {String} serverpack - The id of the server to load Forge data for.
|
||||
* @returns {Promise.<Object>} - A promise which resolves to Forge's version.json data.
|
||||
* @param {string} serverpack The id of the server to load Forge data for.
|
||||
* @returns {Promise.<Object>} A promise which resolves to Forge's version.json data.
|
||||
*/
|
||||
loadForgeData(serverpack){
|
||||
const self = this
|
||||
@ -938,7 +938,7 @@ class AssetGuard extends EventEmitter {
|
||||
* immediately. Once all downloads are complete, this function will fire the 'dlcomplete' event on the
|
||||
* global object instance.
|
||||
*
|
||||
* @param {Array.<{id: string, limit: number}>} identifiers - optional. The identifiers to process and corresponding parallel async task limit.
|
||||
* @param {Array.<{id: string, limit: number}>} identifiers Optional. The identifiers to process and corresponding parallel async task limit.
|
||||
*/
|
||||
processDlQueues(identifiers = [{id:'assets', limit:20}, {id:'libraries', limit:5}, {id:'files', limit:5}, {id:'forge', limit:5}]){
|
||||
this.progress = 0;
|
||||
|
@ -84,7 +84,7 @@ exports.load = function(){
|
||||
* Retrieve the launcher's Client Token.
|
||||
* There is no default client token.
|
||||
*
|
||||
* @returns {String} - the launcher's Client Token.
|
||||
* @returns {string} The launcher's Client Token.
|
||||
*/
|
||||
exports.getClientToken = function(){
|
||||
return config.clientToken
|
||||
@ -93,7 +93,7 @@ exports.getClientToken = function(){
|
||||
/**
|
||||
* Set the launcher's Client Token.
|
||||
*
|
||||
* @param {String} clientToken - the launcher's new Client Token.
|
||||
* @param {string} clientToken The launcher's new Client Token.
|
||||
*/
|
||||
exports.setClientToken = function(clientToken){
|
||||
config.clientToken = clientToken
|
||||
@ -102,8 +102,8 @@ exports.setClientToken = function(clientToken){
|
||||
/**
|
||||
* Retrieve the ID of the selected serverpack.
|
||||
*
|
||||
* @param {Boolean} def - optional. If true, the default value will be returned.
|
||||
* @returns {String} - the ID of the selected serverpack.
|
||||
* @param {boolean} def Optional. If true, the default value will be returned.
|
||||
* @returns {string} The ID of the selected serverpack.
|
||||
*/
|
||||
exports.getSelectedServer = function(def = false){
|
||||
return !def ? config.selectedServer : DEFAULT_CONFIG.clientToken
|
||||
@ -112,7 +112,7 @@ exports.getSelectedServer = function(def = false){
|
||||
/**
|
||||
* Set the ID of the selected serverpack.
|
||||
*
|
||||
* @param {String} serverID - the ID of the new selected serverpack.
|
||||
* @param {string} serverID The ID of the new selected serverpack.
|
||||
*/
|
||||
exports.setSelectedServer = function(serverID){
|
||||
config.selectedServer = serverID
|
||||
@ -121,7 +121,7 @@ exports.setSelectedServer = function(serverID){
|
||||
/**
|
||||
* Get an array of each account currently authenticated by the launcher.
|
||||
*
|
||||
* @returns {Array.<Object>} - an array of each stored authenticated account.
|
||||
* @returns {Array.<Object>} An array of each stored authenticated account.
|
||||
*/
|
||||
exports.getAuthAccounts = function(){
|
||||
return config.authenticationDatabase
|
||||
@ -131,8 +131,8 @@ exports.getAuthAccounts = function(){
|
||||
* Returns the authenticated account with the given uuid. Value may
|
||||
* be null.
|
||||
*
|
||||
* @param {String} uuid - the uuid of the authenticated account.
|
||||
* @returns {Object} - the authenticated account with the given uuid.
|
||||
* @param {string} uuid The uuid of the authenticated account.
|
||||
* @returns {Object} The authenticated account with the given uuid.
|
||||
*/
|
||||
exports.getAuthAccount = function(uuid){
|
||||
return config.authenticationDatabase[uuid]
|
||||
@ -141,10 +141,10 @@ exports.getAuthAccount = function(uuid){
|
||||
/**
|
||||
* Update the access token of an authenticated account.
|
||||
*
|
||||
* @param {String} uuid - uuid of the authenticated account.
|
||||
* @param {String} accessToken - the new Access Token.
|
||||
* @param {string} uuid The uuid of the authenticated account.
|
||||
* @param {string} accessToken The new Access Token.
|
||||
*
|
||||
* @returns {Object} - the authenticated account object created by this action.
|
||||
* @returns {Object} The authenticated account object created by this action.
|
||||
*/
|
||||
exports.updateAuthAccount = function(uuid, accessToken){
|
||||
config.authenticationDatabase[uuid].accessToken = accessToken
|
||||
@ -154,12 +154,12 @@ exports.updateAuthAccount = function(uuid, accessToken){
|
||||
/**
|
||||
* Adds an authenticated account to the database to be stored.
|
||||
*
|
||||
* @param {String} uuid - uuid of the authenticated account.
|
||||
* @param {String} accessToken - accessToken of the authenticated account.
|
||||
* @param {String} username - username (usually email) of the authenticated account.
|
||||
* @param {String} displayName - in game name of the authenticated account.
|
||||
* @param {string} uuid The uuid of the authenticated account.
|
||||
* @param {string} accessToken The accessToken of the authenticated account.
|
||||
* @param {string} username The username (usually email) of the authenticated account.
|
||||
* @param {string} displayName The in game name of the authenticated account.
|
||||
*
|
||||
* @returns {Object} - the authenticated account object created by this action.
|
||||
* @returns {Object} The authenticated account object created by this action.
|
||||
*/
|
||||
exports.addAuthAccount = function(uuid, accessToken, username, displayName){
|
||||
config.selectedAccount = uuid
|
||||
@ -175,7 +175,7 @@ exports.addAuthAccount = function(uuid, accessToken, username, displayName){
|
||||
/**
|
||||
* Get the currently selected authenticated account.
|
||||
*
|
||||
* @returns {Object} - the selected authenticated account.
|
||||
* @returns {Object} The selected authenticated account.
|
||||
*/
|
||||
exports.getSelectedAccount = function(){
|
||||
return config.authenticationDatabase[config.selectedAccount]
|
||||
@ -190,8 +190,8 @@ exports.getSelectedAccount = function(){
|
||||
* contains the units of memory. For example, '5G' = 5 GigaBytes, '1024M' =
|
||||
* 1024 MegaBytes, etc.
|
||||
*
|
||||
* @param {Boolean} def - optional. If true, the default value will be returned.
|
||||
* @returns {String} - the minimum amount of memory for JVM initialization.
|
||||
* @param {boolean} def Optional. If true, the default value will be returned.
|
||||
* @returns {string} The minimum amount of memory for JVM initialization.
|
||||
*/
|
||||
exports.getMinRAM = function(def = false){
|
||||
return !def ? config.settings.java.minRAM : DEFAULT_CONFIG.settings.java.minRAM
|
||||
@ -202,7 +202,7 @@ exports.getMinRAM = function(def = false){
|
||||
* contain the units of memory. For example, '5G' = 5 GigaBytes, '1024M' =
|
||||
* 1024 MegaBytes, etc.
|
||||
*
|
||||
* @param {String} minRAM - the new minimum amount of memory for JVM initialization.
|
||||
* @param {string} minRAM The new minimum amount of memory for JVM initialization.
|
||||
*/
|
||||
exports.setMinRAM = function(minRAM){
|
||||
config.settings.java.minRAM = minRAM
|
||||
@ -213,8 +213,8 @@ exports.setMinRAM = function(minRAM){
|
||||
* contains the units of memory. For example, '5G' = 5 GigaBytes, '1024M' =
|
||||
* 1024 MegaBytes, etc.
|
||||
*
|
||||
* @param {Boolean} def - optional. If true, the default value will be returned.
|
||||
* @returns {String} - the maximum amount of memory for JVM initialization.
|
||||
* @param {boolean} def Optional. If true, the default value will be returned.
|
||||
* @returns {string} The maximum amount of memory for JVM initialization.
|
||||
*/
|
||||
exports.getMaxRAM = function(def = false){
|
||||
return !def ? config.settings.java.maxRAM : resolveMaxRAM()
|
||||
@ -225,7 +225,7 @@ exports.getMaxRAM = function(def = false){
|
||||
* contain the units of memory. For example, '5G' = 5 GigaBytes, '1024M' =
|
||||
* 1024 MegaBytes, etc.
|
||||
*
|
||||
* @param {String} maxRAM - the new maximum amount of memory for JVM initialization.
|
||||
* @param {string} maxRAM The new maximum amount of memory for JVM initialization.
|
||||
*/
|
||||
exports.setMaxRAM = function(maxRAM){
|
||||
config.settings.java.maxRAM = maxRAM
|
||||
@ -236,7 +236,7 @@ exports.setMaxRAM = function(maxRAM){
|
||||
*
|
||||
* This is a resolved configuration value and defaults to null until externally assigned.
|
||||
*
|
||||
* @returns {String} - the path of the Java Executable.
|
||||
* @returns {string} The path of the Java Executable.
|
||||
*/
|
||||
exports.getJavaExecutable = function(){
|
||||
return config.settings.java.executable
|
||||
@ -245,7 +245,7 @@ exports.getJavaExecutable = function(){
|
||||
/**
|
||||
* Set the path of the Java Executable.
|
||||
*
|
||||
* @param {String} executable - the new path of the Java Executable.
|
||||
* @param {string} executable The new path of the Java Executable.
|
||||
*/
|
||||
exports.setJavaExecutable = function(executable){
|
||||
config.settings.java.executable = executable
|
||||
@ -256,8 +256,8 @@ exports.setJavaExecutable = function(executable){
|
||||
* such as memory allocation, will be dynamically resolved and will not be included
|
||||
* in this value.
|
||||
*
|
||||
* @param {Boolean} def - optional. If true, the default value will be returned.
|
||||
* @returns {Array.<String>} - an array of the additional arguments for JVM initialization.
|
||||
* @param {boolean} def Optional. If true, the default value will be returned.
|
||||
* @returns {Array.<string>} An array of the additional arguments for JVM initialization.
|
||||
*/
|
||||
exports.getJVMOptions = function(def = false){
|
||||
return !def ? config.settings.java.jvmOptions : DEFAULT_CONFIG.settings.java.jvmOptions
|
||||
@ -268,7 +268,7 @@ exports.getJVMOptions = function(def = false){
|
||||
* such as memory allocation, will be dynamically resolved and should not be
|
||||
* included in this value.
|
||||
*
|
||||
* @param {Array.<String>} jvmOptions - an array of the new additional arguments for JVM
|
||||
* @param {Array.<string>} jvmOptions An array of the new additional arguments for JVM
|
||||
* initialization.
|
||||
*/
|
||||
exports.setJVMOptions = function(jvmOptions){
|
||||
@ -280,8 +280,8 @@ exports.setJVMOptions = function(jvmOptions){
|
||||
/**
|
||||
* Retrieve the absolute path of the game directory.
|
||||
*
|
||||
* @param {Boolean} def - optional. If true, the default value will be returned.
|
||||
* @returns {String} - the absolute path of the game directory.
|
||||
* @param {boolean} def Optional. If true, the default value will be returned.
|
||||
* @returns {string} The absolute path of the game directory.
|
||||
*/
|
||||
exports.getGameDirectory = function(def = false){
|
||||
return !def ? config.settings.game.directory : DEFAULT_CONFIG.settings.game.directory
|
||||
@ -290,7 +290,7 @@ exports.getGameDirectory = function(def = false){
|
||||
/**
|
||||
* Set the absolute path of the game directory.
|
||||
*
|
||||
* @param {String} directory - the absolute path of the new game directory.
|
||||
* @param {string} directory The absolute path of the new game directory.
|
||||
*/
|
||||
exports.setGameDirectory = function(directory){
|
||||
config.settings.game.directory = directory
|
||||
@ -299,8 +299,8 @@ exports.setGameDirectory = function(directory){
|
||||
/**
|
||||
* Retrieve the width of the game window.
|
||||
*
|
||||
* @param {Boolean} def - optional. If true, the default value will be returned.
|
||||
* @returns {Number} - the width of the game window.
|
||||
* @param {boolean} def Optional. If true, the default value will be returned.
|
||||
* @returns {number} The width of the game window.
|
||||
*/
|
||||
exports.getGameWidth = function(def = false){
|
||||
return !def ? config.settings.game.resWidth : DEFAULT_CONFIG.settings.game.resWidth
|
||||
@ -309,7 +309,7 @@ exports.getGameWidth = function(def = false){
|
||||
/**
|
||||
* Set the width of the game window.
|
||||
*
|
||||
* @param {Number} resWidth - the new width of the game window.
|
||||
* @param {number} resWidth The new width of the game window.
|
||||
*/
|
||||
exports.setGameWidth = function(resWidth){
|
||||
config.settings.game.resWidth = resWidth
|
||||
@ -318,8 +318,8 @@ exports.setGameWidth = function(resWidth){
|
||||
/**
|
||||
* Retrieve the height of the game window.
|
||||
*
|
||||
* @param {Boolean} def - optional. If true, the default value will be returned.
|
||||
* @returns {Number} - the height of the game window.
|
||||
* @param {boolean} def Optional. If true, the default value will be returned.
|
||||
* @returns {number} The height of the game window.
|
||||
*/
|
||||
exports.getGameHeight = function(def = false){
|
||||
return !def ? config.settings.game.resHeight : DEFAULT_CONFIG.settings.game.resHeight
|
||||
@ -328,7 +328,7 @@ exports.getGameHeight = function(def = false){
|
||||
/**
|
||||
* Set the height of the game window.
|
||||
*
|
||||
* @param {Number} resHeight - the new height of the game window.
|
||||
* @param {number} resHeight The new height of the game window.
|
||||
*/
|
||||
exports.setGameHeight = function(resHeight){
|
||||
config.settings.game.resHeight = resHeight
|
||||
@ -337,8 +337,8 @@ exports.setGameHeight = function(resHeight){
|
||||
/**
|
||||
* Check if the game should be launched in fullscreen mode.
|
||||
*
|
||||
* @param {Boolean} def - optional. If true, the default value will be returned.
|
||||
* @returns {Boolean} - whether or not the game is set to launch in fullscreen mode.
|
||||
* @param {boolean} def Optional. If true, the default value will be returned.
|
||||
* @returns {boolean} Whether or not the game is set to launch in fullscreen mode.
|
||||
*/
|
||||
exports.isFullscreen = function(def = false){
|
||||
return !def ? config.settings.game.fullscreen : DEFAULT_CONFIG.settings.game.fullscreen
|
||||
@ -347,7 +347,7 @@ exports.isFullscreen = function(def = false){
|
||||
/**
|
||||
* Change the status of if the game should be launched in fullscreen mode.
|
||||
*
|
||||
* @param {Boolean} fullscreen - whether or not the game should launch in fullscreen mode.
|
||||
* @param {boolean} fullscreen Whether or not the game should launch in fullscreen mode.
|
||||
*/
|
||||
exports.setFullscreen = function(fullscreen){
|
||||
config.settings.game.fullscreen = fullscreen
|
||||
@ -356,8 +356,8 @@ exports.setFullscreen = function(fullscreen){
|
||||
/**
|
||||
* Check if the game should auto connect to servers.
|
||||
*
|
||||
* @param {Boolean} def - optional. If true, the default value will be returned.
|
||||
* @returns {Boolean} - whether or not the game should auto connect to servers.
|
||||
* @param {boolean} def Optional. If true, the default value will be returned.
|
||||
* @returns {boolean} Whether or not the game should auto connect to servers.
|
||||
*/
|
||||
exports.isAutoConnect = function(def = false){
|
||||
return !def ? config.settings.game.autoConnect : DEFAULT_CONFIG.settings.game.autoConnect
|
||||
@ -366,7 +366,7 @@ exports.isAutoConnect = function(def = false){
|
||||
/**
|
||||
* Change the status of whether or not the game should auto connect to servers.
|
||||
*
|
||||
* @param {Boolean} autoConnect - whether or not the game should auto connect to servers.
|
||||
* @param {boolean} autoConnect Whether or not the game should auto connect to servers.
|
||||
*/
|
||||
exports.setAutoConnect = function(autoConnect){
|
||||
config.settings.game.autoConnect = autoConnect
|
||||
|
@ -143,10 +143,10 @@ function _scanRegistry(){
|
||||
const javaVer = javaVers[j]
|
||||
const vKey = javaVer.key.substring(javaVer.key.lastIndexOf('\\')+1)
|
||||
// Only Java 8 is supported currently.
|
||||
if(parseFloat(vKey) == 1.8){
|
||||
if(parseFloat(vKey) === 1.8){
|
||||
javaVer.get('JavaHome', (err, res) => {
|
||||
const jHome = res.value
|
||||
if(jHome.indexOf('(x86)') == -1){
|
||||
if(jHome.indexOf('(x86)') === -1){
|
||||
candidates.add(jHome)
|
||||
cbAcc++
|
||||
}
|
||||
|
@ -43,8 +43,8 @@ const statuses = [
|
||||
* are 'green', 'yellow', 'red', and 'grey'. Grey is a custom status
|
||||
* to our project which represends an unknown status.
|
||||
*
|
||||
* @param {String} status - a valid status code.
|
||||
* @returns {String} - the hex color of the status code.
|
||||
* @param {string} status A valid status code.
|
||||
* @returns {string} The hex color of the status code.
|
||||
*/
|
||||
exports.statusToHex = function(status){
|
||||
switch(status.toLowerCase()){
|
||||
@ -97,11 +97,11 @@ exports.status = function(){
|
||||
/**
|
||||
* Authenticate a user with their Mojang credentials.
|
||||
*
|
||||
* @param {String} username - user's username, this is often an email.
|
||||
* @param {String} password - user's password.
|
||||
* @param {String} clientToken - launcher's Client Token.
|
||||
* @param {Boolean} requestUser - optional. Adds user object to the reponse.
|
||||
* @param {Object} agent - optional. Provided by default. Adds user info to the response.
|
||||
* @param {string} username The user's username, this is often an email.
|
||||
* @param {string} password The user's password.
|
||||
* @param {string} clientToken The launcher's Client Token.
|
||||
* @param {boolean} requestUser Optional. Adds user object to the reponse.
|
||||
* @param {Object} agent Optional. Provided by default. Adds user info to the response.
|
||||
*
|
||||
* @see http://wiki.vg/Authentication#Authenticate
|
||||
*/
|
||||
@ -132,8 +132,8 @@ exports.authenticate = function(username, password, clientToken, requestUser = t
|
||||
* Validate an access token. This should always be done before launching.
|
||||
* The client token should match the one used to create the access token.
|
||||
*
|
||||
* @param {String} accessToken - the access token to validate.
|
||||
* @param {String} clientToken - the launcher's client token.
|
||||
* @param {string} accessToken The access token to validate.
|
||||
* @param {string} clientToken The launcher's client token.
|
||||
*
|
||||
* @see http://wiki.vg/Authentication#Validate
|
||||
*/
|
||||
@ -162,8 +162,8 @@ exports.validate = function(accessToken, clientToken){
|
||||
* Invalidates an access token. The clientToken must match the
|
||||
* token used to create the provided accessToken.
|
||||
*
|
||||
* @param {String} accessToken - the access token to invalidate.
|
||||
* @param {String} clientToken - the launcher's client token.
|
||||
* @param {string} accessToken The access token to invalidate.
|
||||
* @param {string} clientToken The launcher's client token.
|
||||
*
|
||||
* @see http://wiki.vg/Authentication#Invalidate
|
||||
*/
|
||||
@ -192,9 +192,9 @@ exports.invalidate = function(accessToken, clientToken){
|
||||
* in without asking them for their credentials again. A new access token will
|
||||
* be generated using a recent invalid access token. See Wiki for more info.
|
||||
*
|
||||
* @param {String} accessToken - the old access token.
|
||||
* @param {String} clientToken - the launcher's client token.
|
||||
* @param {Boolean} requestUser - optional. Adds user object to the reponse.
|
||||
* @param {string} accessToken The old access token.
|
||||
* @param {string} clientToken The launcher's client token.
|
||||
* @param {boolean} requestUser Optional. Adds user object to the reponse.
|
||||
*
|
||||
* @see http://wiki.vg/Authentication#Refresh
|
||||
*/
|
||||
|
@ -93,8 +93,8 @@ class ProcessBuilder {
|
||||
/**
|
||||
* Construct the argument array that will be passed to the JVM process.
|
||||
*
|
||||
* @param {Array.<Object>} mods - An array of enabled mods which will be launched with this process.
|
||||
* @returns {Array.<String>} - An array containing the full JVM arguments for this process.
|
||||
* @param {Array.<Object>} mods An array of enabled mods which will be launched with this process.
|
||||
* @returns {Array.<string>} An array containing the full JVM arguments for this process.
|
||||
*/
|
||||
constructJVMArguments(mods){
|
||||
|
||||
@ -118,7 +118,7 @@ class ProcessBuilder {
|
||||
/**
|
||||
* Resolve the arguments required by forge.
|
||||
*
|
||||
* @returns {Array.<String>} - An array containing the arguments required by forge.
|
||||
* @returns {Array.<string>} An array containing the arguments required by forge.
|
||||
*/
|
||||
_resolveForgeArgs(){
|
||||
const mcArgs = this.forgeData.minecraftArguments.split(' ')
|
||||
@ -196,8 +196,8 @@ class ProcessBuilder {
|
||||
* libraries as well as the libraries declared by the server. Since mods are permitted to declare libraries,
|
||||
* this method requires all enabled mods as an input
|
||||
*
|
||||
* @param {Array.<Object>} mods - An array of enabled mods which will be launched with this process.
|
||||
* @returns {Array.<String>} - An array containing the paths of each library required by this process.
|
||||
* @param {Array.<Object>} mods An array of enabled mods which will be launched with this process.
|
||||
* @returns {Array.<string>} An array containing the paths of each library required by this process.
|
||||
*/
|
||||
classpathArg(mods){
|
||||
let cpArgs = []
|
||||
@ -223,7 +223,7 @@ class ProcessBuilder {
|
||||
*
|
||||
* TODO - clean up function
|
||||
*
|
||||
* @returns {Array.<String>} - An array containing the paths of each library mojang declares.
|
||||
* @returns {Array.<string>} An array containing the paths of each library mojang declares.
|
||||
*/
|
||||
_resolveMojangLibraries(){
|
||||
const libs = []
|
||||
@ -293,8 +293,8 @@ class ProcessBuilder {
|
||||
* This method will also check each enabled mod for libraries, as mods are permitted to
|
||||
* declare libraries.
|
||||
*
|
||||
* @param {Array.<Object>} mods - An array of enabled mods which will be launched with this process.
|
||||
* @returns {Array.<String>} - An array containing the paths of each library this server requires.
|
||||
* @param {Array.<Object>} mods An array of enabled mods which will be launched with this process.
|
||||
* @returns {Array.<string>} An array containing the paths of each library this server requires.
|
||||
*/
|
||||
_resolveServerLibraries(mods){
|
||||
const mdles = this.server.modules
|
||||
@ -330,8 +330,8 @@ class ProcessBuilder {
|
||||
/**
|
||||
* Recursively resolve the path of each library required by this module.
|
||||
*
|
||||
* @param {Object} mdle - A module object from the server distro index.
|
||||
* @returns {Array.<String>} - An array containing the paths of each library this module requires.
|
||||
* @param {Object} mdle A module object from the server distro index.
|
||||
* @returns {Array.<string>} An array containing the paths of each library this module requires.
|
||||
*/
|
||||
_resolveModuleLibraries(mdle){
|
||||
if(mdle.sub_modules == null){
|
||||
|
Loading…
Reference in New Issue
Block a user