Update start.sh
Browse files11 unmodified lines121314151617181920212223242554 unmodified lines8081828384858687888990919293949596979839 unmodified lines13813914014114214314411 unmodified linescd /app/serverfi# Clean up old jars and setup logsrm -f plugins/Via*.jarrm -f plugins/EaglerX*.jarmkdir -p logs# 2. Self-Healing PaperMC Downloadif [ -f "server.jar" ]; then# Test if the jar is corrupted. If it is, delete it!if ! jar tf server.jar >/dev/null 2>&1; thenecho "[System] server.jar is corrupted! Deleting for a fresh download..."rm -f server.jar54 unmodified linesconsole.log(' Starting Eaglercraft & Web Console ');console.log('=========================================');// A. Launch the Minecraft Server as a Child Process of Nodeconst mcProcess = spawn('java', ['-Xms2G', '-Xmx2G', '-jar', 'server.jar', 'nogui'], {cwd: '/data'});// B. Route Minecraft's outputconst logStream = fs.createWriteStream('/data/logs/latest.log', { flags: 'w' });mcProcess.stdout.pipe(logStream);mcProcess.stderr.pipe(logStream);mcProcess.stdout.pipe(process.stdout);mcProcess.stderr.pipe(process.stderr);// C. Host the Web Console UI on Port 7860const server = http.createServer((req, res) => {if (req.method === 'GET' && req.url === '/') {res.writeHead(200, { 'Content-Type': 'text/html' });39 unmodified lines}});// D. Proxy Game WebSockets to Eaglercraft (Internal Port 25566)server.on('upgrade', (req, clientSocket, head) => {const serverSocket = net.connect(25566, '127.0.0.1', () => {let headers = req.method + ' ' + req.url + ' HTTP/' + req.httpVersion + '\r\n';11 unmodified lines121314151617181920212223242526272854 unmodified lines8384858687888990919293949596979839 unmodified lines13813914014114214311 unmodified linescd /app/serverfi# Clean up old plugins and logsrm -f plugins/Via*.jarrm -f plugins/EaglerX*.jarmkdir -p logs# FIX: Delete the corrupted Paperclip cache so it cleanly rebuilds the Minecraft jar!echo "[System] Clearing Paperclip cache to prevent corrupted jar errors..."rm -rf cache# 2. Self-Healing PaperMC Downloadif [ -f "server.jar" ]; thenif ! jar tf server.jar >/dev/null 2>&1; thenecho "[System] server.jar is corrupted! Deleting for a fresh download..."rm -f server.jar54 unmodified linesconsole.log(' Starting Eaglercraft & Web Console ');console.log('=========================================');const mcProcess = spawn('java', ['-Xms2G', '-Xmx2G', '-jar', 'server.jar', 'nogui'], {cwd: '/data'});const logStream = fs.createWriteStream('/data/logs/latest.log', { flags: 'w' });mcProcess.stdout.pipe(logStream);mcProcess.stderr.pipe(logStream);mcProcess.stdout.pipe(process.stdout);mcProcess.stderr.pipe(process.stderr);const server = http.createServer((req, res) => {if (req.method === 'GET' && req.url === '/') {res.writeHead(200, { 'Content-Type': 'text/html' });39 unmodified lines}});server.on('upgrade', (req, clientSocket, head) => {const serverSocket = net.connect(25566, '127.0.0.1', () => {let headers = req.method + ' ' + req.url + ' HTTP/' + req.httpVersion + '\r\n';
start.sh+5-6