@dimzxzzx07/mc-headless 2.2.0 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -31
- package/dist/core/JavaChecker.d.ts +8 -2
- package/dist/core/JavaChecker.d.ts.map +1 -1
- package/dist/core/JavaChecker.js +219 -104
- package/dist/core/JavaChecker.js.map +1 -1
- package/dist/core/MinecraftServer.d.ts +11 -1
- package/dist/core/MinecraftServer.d.ts.map +1 -1
- package/dist/core/MinecraftServer.js +337 -158
- package/dist/core/MinecraftServer.js.map +1 -1
- package/package.json +1 -1
- package/src/core/JavaChecker.ts +224 -108
- package/src/core/MinecraftServer.ts +402 -201
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
</div>
|
|
6
6
|
|
|
7
7
|
<div align="center">
|
|
8
|
-
<img src="https://img.shields.io/badge/Version-2.2.
|
|
8
|
+
<img src="https://img.shields.io/badge/Version-2.2.2-2563eb?style=for-the-badge&logo=typescript" alt="Version">
|
|
9
9
|
<img src="https://img.shields.io/badge/License-MIT-green?style=for-the-badge&logo=open-source-initiative" alt="License">
|
|
10
10
|
<img src="https://img.shields.io/badge/Node-18%2B-339933?style=for-the-badge&logo=nodedotjs" alt="Node">
|
|
11
11
|
<img src="https://img.shields.io/badge/Java-Portable-007396?style=for-the-badge&logo=openjdk" alt="Java Portable">
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<a href="https://t.me/Dimzxzzx07">
|
|
18
18
|
<img src="https://img.shields.io/badge/Telegram-Dimzxzzx07-26A5E4?style=for-the-badge&logo=telegram&logoColor=white" alt="Telegram">
|
|
19
19
|
</a>
|
|
20
|
-
<a href="https://github.com/
|
|
20
|
+
<a href="https://github.com/Dimzxzzx07">
|
|
21
21
|
<img src="https://img.shields.io/badge/GitHub-Dimzxzzx07-181717?style=for-the-badge&logo=github&logoColor=white" alt="GitHub">
|
|
22
22
|
</a>
|
|
23
23
|
<a href="https://www.npmjs.com/package/@dimzxzzx07/mc-headless">
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
## Table of Contents
|
|
56
56
|
|
|
57
57
|
- [What is MC-Headless?](#what-is-mc-headless)
|
|
58
|
-
- [What's New in 2.2.
|
|
58
|
+
- [What's New in 2.2.2](#whats-new-in-222)
|
|
59
59
|
- [Features](#features)
|
|
60
60
|
- [Why MC-Headless?](#why-mc-headless)
|
|
61
61
|
- [Installation](#installation)
|
|
@@ -111,19 +111,21 @@ Built specifically for developers, sysadmins, and Minecraft enthusiasts who want
|
|
|
111
111
|
|
|
112
112
|
---
|
|
113
113
|
|
|
114
|
-
## What's New in 2.2.
|
|
114
|
+
## What's New in 2.2.2
|
|
115
115
|
|
|
116
|
-
### Version 2.2.
|
|
116
|
+
### Version 2.2.2 - March 2026
|
|
117
117
|
|
|
118
|
-
- **
|
|
119
|
-
- **
|
|
120
|
-
- **
|
|
121
|
-
- **
|
|
122
|
-
- **
|
|
123
|
-
- **
|
|
124
|
-
- **
|
|
125
|
-
- **
|
|
126
|
-
- **
|
|
118
|
+
- **Smart Java Storage** - Automatically detects Pterodactyl environment and stores Java in `/home/container/.java` instead of RAM-heavy `/tmp`
|
|
119
|
+
- **Multi-Architecture Support** - Full support for x64, ARM64 (Oracle Cloud Ampere), and ARM (Raspberry Pi)
|
|
120
|
+
- **Streaming Download + Extract** - Downloads and extracts Java simultaneously, saving disk space and time
|
|
121
|
+
- **Partial Download Recovery** - Automatically cleans up corrupted partial downloads and retries
|
|
122
|
+
- **Content-Length Verification** - Ensures downloaded files match expected size (within 95% tolerance)
|
|
123
|
+
- **Rotating User-Agents** - Bypasses rate limiting with 4 different user-agent strings
|
|
124
|
+
- **Smart Retry Logic** - Retries on rate limits (429), server errors (500+), and network timeouts
|
|
125
|
+
- **30-Day Auto-Update** - Automatically checks and updates Java if older than 30 days
|
|
126
|
+
- **Low RAM Warning** - Alerts users when storing Java in `/tmp` on systems with less than 3GB RAM
|
|
127
|
+
- **Robust Redirect Handling** - Follows up to 3 redirects with proper error handling
|
|
128
|
+
- **Stalled Download Detection** - Cancels and retries if no data received for 30 seconds
|
|
127
129
|
|
|
128
130
|
---
|
|
129
131
|
|
|
@@ -133,17 +135,20 @@ Built specifically for developers, sysadmins, and Minecraft enthusiasts who want
|
|
|
133
135
|
|----------|----------|
|
|
134
136
|
| **Server Types** | Paper, Purpur, Vanilla, Spigot, Forge, Fabric |
|
|
135
137
|
| **Platforms** | Java Edition, Bedrock Edition, Cross-play (Geyser) |
|
|
138
|
+
| **Architecture Support** | x64, ARM64, ARM (Raspberry Pi, Oracle Cloud) |
|
|
136
139
|
| **Auto Setup** | Automatic Java detection, EULA acceptance, server.properties generation |
|
|
137
|
-
| **Portable Java** | Download JRE to
|
|
140
|
+
| **Portable Java** | Download JRE to `/home/container/.java` (Pterodactyl) or `/tmp/.mc-headless` |
|
|
141
|
+
| **Smart Storage** | Detects Pterodactyl, warns on low RAM for /tmp usage |
|
|
142
|
+
| **Streaming Download** | Download and extract simultaneously, no temporary files |
|
|
138
143
|
| **Cgroups Stats** | CPU/Memory stats like Pterodactyl (30s interval) |
|
|
139
|
-
| **Downloader** | Pure Node.js
|
|
144
|
+
| **Downloader** | Pure Node.js with rotating user-agents, retry logic, stalled detection |
|
|
140
145
|
| **Memory Management** | Custom memory allocation, Aikar's flags optimization |
|
|
141
146
|
| **Backup System** | Automatic scheduled backups, manual backup triggers |
|
|
142
147
|
| **Monitoring** | Real-time CPU/memory usage, player tracking, server events |
|
|
143
148
|
| **Cross-play** | Built-in Geyser & Floodgate support for Bedrock clients |
|
|
144
149
|
| **ViaVersion** | Built-in ViaVersion, ViaBackwards, ViaRewind support |
|
|
145
150
|
| **SkinRestorer** | Auto-download and install SkinRestorer plugin |
|
|
146
|
-
| **Pterodactyl Ready** | Optimized for panel hosting |
|
|
151
|
+
| **Pterodactyl Ready** | Optimized for panel hosting with environment variable support |
|
|
147
152
|
| **Termux Friendly** | Optimized for Android/Termux environments |
|
|
148
153
|
| **Headless Ready** | No GUI required, perfect for servers and automation |
|
|
149
154
|
| **Silent Mode** | Direct log piping for minimal CPU usage |
|
|
@@ -181,7 +186,7 @@ wget https://github.com/SkinsRestorer/SkinsRestorerX/releases/latest/download/Sk
|
|
|
181
186
|
tail -f logs/latest.log
|
|
182
187
|
```
|
|
183
188
|
|
|
184
|
-
After (MC-Headless v2.2.
|
|
189
|
+
After (MC-Headless v2.2.2)
|
|
185
190
|
|
|
186
191
|
```javascript
|
|
187
192
|
const { MinecraftServer } = require('@dimzxzzx07/mc-headless');
|
|
@@ -223,7 +228,7 @@ RAM 2 GB 4 GB or more
|
|
|
223
228
|
Storage 2 GB 10 GB
|
|
224
229
|
OS Linux, macOS, Windows, Termux Linux (production)
|
|
225
230
|
|
|
226
|
-
Note: Java is auto-downloaded as portable JRE (no system installation needed)
|
|
231
|
+
Note: Java is auto-downloaded as portable JRE (no system installation needed). On Pterodactyl, Java is stored in /home/container/.java to save RAM.
|
|
227
232
|
|
|
228
233
|
---
|
|
229
234
|
|
|
@@ -341,7 +346,7 @@ async function startServer() {
|
|
|
341
346
|
server.on("ready", (info) => {
|
|
342
347
|
console.clear();
|
|
343
348
|
console.log(`\n==========================================`);
|
|
344
|
-
console.log(`Minecraft Server - v2.2.
|
|
349
|
+
console.log(`Minecraft Server - v2.2.2`);
|
|
345
350
|
console.log(` IP: ${publicIp}:${info.port}`);
|
|
346
351
|
console.log(` Version: ${info.version}`);
|
|
347
352
|
console.log(` Memory: ${info.memory.used}/${info.memory.max} MB`);
|
|
@@ -470,7 +475,7 @@ autoAcceptEula boolean true Automatically accept Minecraft EULA
|
|
|
470
475
|
Java Options
|
|
471
476
|
|
|
472
477
|
Option Type Default Description
|
|
473
|
-
usePortableJava boolean true Download portable JRE to
|
|
478
|
+
usePortableJava boolean true Download portable JRE to /home/container/.java (Pterodactyl) or /tmp/.mc-headless
|
|
474
479
|
javaVersion string 'auto' '17', '21', or 'auto'
|
|
475
480
|
|
|
476
481
|
Memory Options
|
|
@@ -1070,12 +1075,13 @@ const server = new MinecraftServer({
|
|
|
1070
1075
|
});
|
|
1071
1076
|
```
|
|
1072
1077
|
|
|
1073
|
-
·
|
|
1074
|
-
·
|
|
1075
|
-
·
|
|
1076
|
-
·
|
|
1077
|
-
·
|
|
1078
|
-
·
|
|
1078
|
+
· Smart Storage: Automatically detects Pterodactyl environment and stores Java in /home/container/.java (disk) instead of /tmp (RAM)
|
|
1079
|
+
· Low RAM Warning: Alerts if storing Java in /tmp on systems with less than 3GB RAM
|
|
1080
|
+
· Multi-Architecture: Supports x64, ARM64 (Oracle Cloud), and ARM (Raspberry Pi)
|
|
1081
|
+
· Streaming Download: Downloads and extracts simultaneously, saving disk space
|
|
1082
|
+
· Auto-Update: Checks and updates Java if older than 30 days
|
|
1083
|
+
· Robust Download: Rotating user-agents, retry logic, stalled detection, size verification
|
|
1084
|
+
· No System Installation: Java runs from local folder, no root required
|
|
1079
1085
|
|
|
1080
1086
|
Java Version Requirements
|
|
1081
1087
|
|
|
@@ -1170,9 +1176,18 @@ EOF
|
|
|
1170
1176
|
node index.js
|
|
1171
1177
|
```
|
|
1172
1178
|
|
|
1173
|
-
Pterodactyl
|
|
1179
|
+
Pterodactyl Environment Variables
|
|
1180
|
+
|
|
1181
|
+
MC-Headless automatically detects Pterodactyl and respects these environment variables:
|
|
1174
1182
|
|
|
1175
|
-
|
|
1183
|
+
Variable Description Default
|
|
1184
|
+
SERVER_PORT Server port 25565
|
|
1185
|
+
SERVER_MEMORY_INIT Initial memory 2G
|
|
1186
|
+
SERVER_MEMORY_MAX Max memory 4G
|
|
1187
|
+
SERVER_MOTD Message of the day "Minecraft Server"
|
|
1188
|
+
SERVER_IP Bind IP 0.0.0.0
|
|
1189
|
+
|
|
1190
|
+
Pterodactyl Egg Configuration
|
|
1176
1191
|
|
|
1177
1192
|
```json
|
|
1178
1193
|
{
|
|
@@ -1261,11 +1276,13 @@ Common Issues
|
|
|
1261
1276
|
Issue Cause Solution
|
|
1262
1277
|
Java not found Java not installed Enable usePortableJava: true
|
|
1263
1278
|
ENOSPC: no space left Disk full Free disk space, reduce memory
|
|
1264
|
-
Download failed: 302 URL redirect
|
|
1279
|
+
Download failed: 302 URL redirect Automatic in v2.2.2
|
|
1265
1280
|
Port already in use Another server running Change port number
|
|
1266
1281
|
Plugin corrupt Bad download Delete plugin and restart
|
|
1267
1282
|
High CPU usage Too many chunks Reduce viewDistance to 4
|
|
1268
1283
|
Out of memory RAM too low Reduce max memory or add RAM
|
|
1284
|
+
Java verification failed Corrupt download Automatic retry in v2.2.2
|
|
1285
|
+
Download stalled Slow connection Automatic retry in v2.2.2
|
|
1269
1286
|
|
|
1270
1287
|
Disk Space Issues
|
|
1271
1288
|
|
|
@@ -1389,7 +1406,7 @@ SOFTWARE.
|
|
|
1389
1406
|
<a href="https://t.me/Dimzxzzx07">
|
|
1390
1407
|
<img src="https://img.shields.io/badge/Telegram-Contact-26A5E4?style=for-the-badge&logo=telegram" alt="Telegram">
|
|
1391
1408
|
</a>
|
|
1392
|
-
<a href="https://github.com/
|
|
1409
|
+
<a href="https://github.com/Dimzxzzx07">
|
|
1393
1410
|
<img src="https://img.shields.io/badge/GitHub-Follow-181717?style=for-the-badge&logo=github" alt="GitHub">
|
|
1394
1411
|
</a>
|
|
1395
1412
|
<br>
|
|
@@ -4,16 +4,22 @@ export interface JavaInfo {
|
|
|
4
4
|
type: 'system' | 'portable';
|
|
5
5
|
}
|
|
6
6
|
export declare class JavaChecker {
|
|
7
|
-
private static logger;
|
|
8
7
|
private static readonly JAVA_DIR;
|
|
9
8
|
private static readonly JAVA_URLS;
|
|
9
|
+
private static getOptimalJavaDirectory;
|
|
10
|
+
private static getArch;
|
|
10
11
|
static getRequiredJavaVersion(serverVersion: string): '17' | '21';
|
|
11
12
|
static checkJava(): Promise<boolean>;
|
|
12
13
|
static getSystemJavaPath(): string | null;
|
|
13
14
|
static getSystemJavaVersion(): string | null;
|
|
14
|
-
private static
|
|
15
|
+
private static shouldUpdateJava;
|
|
16
|
+
private static downloadAndExtractWithStream;
|
|
15
17
|
static getOrDownloadPortableJava(version: '17' | '21'): Promise<JavaInfo>;
|
|
16
18
|
static ensureJava(serverVersion: string, usePortable?: boolean): Promise<JavaInfo>;
|
|
17
19
|
static cleanupOldJava(): void;
|
|
20
|
+
static getJavaInfo(): {
|
|
21
|
+
dir: string;
|
|
22
|
+
arch: string;
|
|
23
|
+
};
|
|
18
24
|
}
|
|
19
25
|
//# sourceMappingURL=JavaChecker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JavaChecker.d.ts","sourceRoot":"","sources":["../../src/core/JavaChecker.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,QAAQ;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,QAAQ,GAAG,UAAU,CAAC;CAC/B;AAED,qBAAa,WAAW;IACpB,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"JavaChecker.d.ts","sourceRoot":"","sources":["../../src/core/JavaChecker.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,QAAQ;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,QAAQ,GAAG,UAAU,CAAC;CAC/B;AAED,qBAAa,WAAW;IACpB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAyC;IAEzE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CA+B/B;IAEF,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAmBtC,OAAO,CAAC,MAAM,CAAC,OAAO;WAOR,sBAAsB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;WAUpD,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;WAYnC,iBAAiB,IAAI,MAAM,GAAG,IAAI;WASlC,oBAAoB,IAAI,MAAM,GAAG,IAAI;IA2BnD,OAAO,CAAC,MAAM,CAAC,gBAAgB;mBAUV,4BAA4B;WAoI7B,yBAAyB,CAAC,OAAO,EAAE,IAAI,GAAG,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC;WAgElE,UAAU,CAAC,aAAa,EAAE,MAAM,EAAE,WAAW,GAAE,OAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;WAoBvF,cAAc,IAAI,IAAI;WAwBtB,WAAW,IAAI;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE;CAM7D"}
|