🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

minecraft-wrap

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minecraft-wrap - npm Package Compare versions

Comparing version

to
1.4.0

.github/dependabot.yml

6

HISTORY.md
# History
## 1.4.0
* Throw on too old java version
* Don't use broken native transport (Thanks @nickelpro)
* Allow explicitly picking a java executable
* Use node-fetch instead of request
## 1.3.0

@@ -4,0 +10,0 @@

22

lib/launcher_download.js

@@ -1,3 +0,2 @@

const rp = require('request-promise')
const rq = require('request')
const fetch = require('node-fetch')
const fs = require('mz/fs')

@@ -38,6 +37,7 @@ const crypto = require('mz/crypto')

if (this.versionsList) { return Promise.resolve(this.versionsList) }
return rp('https://launchermeta.mojang.com/mc/game/version_manifest.json').then((text) => {
this.versionsList = JSON.parse(text)
return this.versionsList
})
return fetch('https://launchermeta.mojang.com/mc/game/version_manifest.json')
.then(res => res.json()).then((json) => {
this.versionsList = json
return json
})
}

@@ -170,6 +170,8 @@

return queue.add(() => new Promise((resolve, reject) => {
rq(url)
.pipe(fs.createWriteStream(path))
.on('close', () => resolve(path))
.on('error', err => reject(err))
fetch(url).then(res => {
const fileStream = fs.createWriteStream(path)
res.body.pipe(fileStream)
res.body.on('error', err => reject(err))
fileStream.on('finish', () => resolve())
})
}))

@@ -176,0 +178,0 @@ })

@@ -41,5 +41,8 @@ const path = require('path')

'spawn-protection': '16',
motd: 'A Minecraft Server'
motd: 'A Minecraft Server',
'use-native-transport': 'false'
}
const TOO_OLD_JAVA_REGEX = /has been compiled by a more recent version of the Java Runtime \(class file version (\d+\.\d+)\), this version of the Java Runtime only recognizes class file versions up to (\d+\.\d+)/
class WrapServer extends EventEmitter {

@@ -54,3 +57,4 @@ constructor (MC_SERVER_JAR, MC_SERVER_PATH, OPTIONS) {

doneRegex: (OPTIONS && OPTIONS.doneRegex) ? OPTIONS.doneRegex : /\[.+\]: Done/,
noOverride: OPTIONS && OPTIONS.noOverride
noOverride: OPTIONS && OPTIONS.noOverride,
javaPath: OPTIONS && OPTIONS.javaPath
}

@@ -102,3 +106,3 @@ }

.then(() => new Promise((resolve, reject) => {
this.mcServer = spawn('java', [
this.mcServer = spawn(this.OPTIONS.javaPath ?? 'java', [
'-jar',

@@ -142,5 +146,7 @@ '-Xms' + this.OPTIONS.minMem + 'M',

return resolve()
}
if (/FAILED TO BIND TO PORT/.test(line)) {
} else if (/FAILED TO BIND TO PORT/.test(line)) {
return reject(new Error('failed to bind to port'))
} else if (TOO_OLD_JAVA_REGEX.test(line)) {
const matches = line.match(TOO_OLD_JAVA_REGEX)
return reject(new Error(`Java too old, have java for class files version ${matches[1]}, need java for class files version ${matches[2]}`))
}

@@ -147,0 +153,0 @@ }

{
"name": "minecraft-wrap",
"version": "1.3.0",
"version": "1.4.0",
"description": "Download and wrap the vanilla minecraft server in node.js",

@@ -38,5 +38,4 @@ "main": "index.js",

"mz": "^2.7.0",
"node-fetch": "^2.6.1",
"promise-queue": "^2.2.5",
"request": "^2.88.0",
"request-promise": "^4.2.2",
"rimraf": "^3.0.2",

@@ -46,3 +45,3 @@ "yggdrasil": "^1.1.1"

"devDependencies": {
"mocha": "^8.0.1",
"mocha": "^9.0.0",
"standard": "^16.0.1"

@@ -49,0 +48,0 @@ },

@@ -49,2 +49,3 @@ # minecraft wrap

* noOverride : don't override config files
* javaPath : specify path to a java executable to use, by default it's just `java`

@@ -51,0 +52,0 @@ #### WrapServer.startServer(propOverrides, done)

Sorry, the diff of this file is not supported yet