From 28164ae10c4afcc68f59546ddcb8a9f705e48def Mon Sep 17 00:00:00 2001 From: Daniel Scalzi Date: Fri, 12 Jun 2020 19:56:57 -0400 Subject: [PATCH] Re-enable --server and --port on patched 1.15.2 builds. (#74) --- app/assets/js/assetguard.js | 20 ++++++++++++++++++++ app/assets/js/processbuilder.js | 13 +++++++++++-- package-lock.json | 6 +++--- package.json | 2 +- 4 files changed, 35 insertions(+), 6 deletions(-) diff --git a/app/assets/js/assetguard.js b/app/assets/js/assetguard.js index 0420f47e01..53ed2c1141 100644 --- a/app/assets/js/assetguard.js +++ b/app/assets/js/assetguard.js @@ -194,6 +194,26 @@ class Util { } } + static isAutoconnectBroken(forgeVersion) { + + const forgeVer = forgeVersion.split('-')[1] + + const minWorking = [31, 2, 15] + const verSplit = forgeVer.split('.').map(v => Number(v)) + + if(verSplit[0] === 31) { + for(let i=0; i minWorking[i]) { + return false + } else if(verSplit[i] < minWorking[i]) { + return true + } + } + } + + return false + } + } diff --git a/app/assets/js/processbuilder.js b/app/assets/js/processbuilder.js index e43b04e9c5..6a43d82f99 100644 --- a/app/assets/js/processbuilder.js +++ b/app/assets/js/processbuilder.js @@ -481,11 +481,20 @@ class ProcessBuilder { } // Autoconnect - if(Util.mcVersionAtLeast('1.15', this.server.getMinecraftVersion())) { - logger.error('Server autoconnect disabled on 1.15+ due to OpenGL Stack Overflow issue.') + let isAutoconnectBroken + try { + isAutoconnectBroken = Util.isAutoconnectBroken(this.forgeData.id.split('-')[2]) + } catch(err) { + logger.error('Forge version format changed.. assuming autoconnect works.') + } + + if(isAutoconnectBroken) { + logger.error('Server autoconnect disabled on Forge 1.15.2 for builds earlier than 31.2.15 due to OpenGL Stack Overflow issue.') + logger.error('Please upgrade your Forge version to at least 31.2.15!') } else { this._processAutoConnectArg(args) } + // Forge Specific Arguments // Ignore if not running Forge diff --git a/package-lock.json b/package-lock.json index 672f83174b..aee2ed423e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1081,9 +1081,9 @@ } }, "electron": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/electron/-/electron-9.0.3.tgz", - "integrity": "sha512-rY59wy50z0oWp/q69zq0UIzvtcM5j2BJbLAwEoLfVNS3DLt9wDZqRqSIBvLEBl+xWbafCnRA9haEqi7ssM94GA==", + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/electron/-/electron-9.0.4.tgz", + "integrity": "sha512-QzkeZNAiNB7KxcdoQKSoaiVT/GQdB4Vt0/ZZOuU8tIKABAsni2I7ztiAbUzxcsnQsqEBSfChuPuDQ5A4VbbzPg==", "dev": true, "requires": { "@electron/get": "^1.0.1", diff --git a/package.json b/package.json index 64f4c0164c..16069d9b37 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ }, "devDependencies": { "cross-env": "^7.0.2", - "electron": "^9.0.3", + "electron": "^9.0.4", "electron-builder": "^22.7.0", "eslint": "^7.2.0" },