@dimzxzzx07/mc-headless 2.2.2 → 2.2.3

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 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.2-2563eb?style=for-the-badge&logo=typescript" alt="Version">
8
+ <img src="https://img.shields.io/badge/Version-2.2.3-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">
@@ -55,11 +55,14 @@
55
55
  ## Table of Contents
56
56
 
57
57
  - [What is MC-Headless?](#what-is-mc-headless)
58
- - [What's New in 2.2.2](#whats-new-in-222)
58
+ - [What's New in 2.2.3](#whats-new-in-223)
59
59
  - [Features](#features)
60
60
  - [Why MC-Headless?](#why-mc-headless)
61
61
  - [Installation](#installation)
62
62
  - [Quick Start](#quick-start)
63
+ - [Server Startup Flow Diagram](#server-startup-flow-diagram)
64
+ - [Pterodactyl Setup (No Egg Required)](#pterodactyl-setup-no-egg-required)
65
+ - [How to Connect from Minecraft](#how-to-connect-from-minecraft)
63
66
  - [Configuration Guide](#configuration-guide)
64
67
  - [API Reference](#api-reference)
65
68
  - [Usage Examples](#usage-examples)
@@ -68,6 +71,8 @@
68
71
  - [Memory Management](#memory-management)
69
72
  - [Network Settings](#network-settings)
70
73
  - [World Configuration](#world-configuration)
74
+ - [Plugins & Boosters](#plugins--boosters)
75
+ - [RAM Disk & Symlink System](#ram-disk--symlink-system)
71
76
  - [Folder Structure](#folder-structure)
72
77
  - [Backup System](#backup-system)
73
78
  - [Event System](#event-system)
@@ -78,7 +83,6 @@
78
83
  - [SkinRestorer Support](#skinrestorer-support)
79
84
  - [Portable Java](#portable-java)
80
85
  - [Performance Tuning](#performance-tuning)
81
- - [Pterodactyl Setup](#pterodactyl-setup)
82
86
  - [Termux Setup](#termux-setup)
83
87
  - [Troubleshooting](#troubleshooting)
84
88
  - [Contributing](#contributing)
@@ -111,21 +115,42 @@ Built specifically for developers, sysadmins, and Minecraft enthusiasts who want
111
115
 
112
116
  ---
113
117
 
114
- ## What's New in 2.2.2
115
-
116
- ### Version 2.2.2 - March 2026
117
-
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
118
+ ## What's New in 2.2.3
119
+
120
+ ### Version 2.2.3 - March 2026
121
+
122
+ - **Plugin Manager System** - Auto-download and install popular plugins:
123
+ - ProtocolLib
124
+ - TCPShield
125
+ - Spigot-Optimizers
126
+ - Spark (profiler)
127
+ - ViewDistanceTweaks
128
+ - FarmControl
129
+ - EntityDetection
130
+ - **RAM Disk Technology** - Run worlds, plugins, and addons in RAM for lightning-fast performance
131
+ - **Symlink Master Storage** - Secure master folder with symbolic links for data protection
132
+ - **Auto RAM Backup** - Automatically backup RAM data to disk every 5 minutes
133
+ - **RAM Restore on Crash** - Automatically restore data from master storage after crash
134
+ - **Network Optimization Suite**:
135
+ - TCP_NODELAY enabled by default
136
+ - Adjustable compression threshold (64-512)
137
+ - Velocity proxy support
138
+ - BungeeCord mode
139
+ - **Java Arguments Optimization**:
140
+ - `-XX:+UseG1GC -XX:MaxGCPauseMillis=50`
141
+ - `-XX:+UseStringDeduplication`
142
+ - `-Djava.net.preferIPv4Stack=true`
143
+ - `-Djava.net.tcpFastOpen=true`
144
+ - `-Djava.net.tcp.nodelay=true`
145
+ - `-Dio.netty.recycler.maxCapacity.default=0`
146
+ - `-Dio.netty.leakDetectionLevel=disabled`
147
+ - **Pterodactyl Port Sharing** - Geyser can run on same port as Java when only one port available
148
+ - **Auto UDP Detection** - Warns if Bedrock port needs UDP configuration
149
+ - **Stream Finished Guarantee** - Ensures downloads complete properly with stream.finished
150
+ - **1-Second Download Delay** - Prevents plugin corruption during simultaneous downloads
151
+ - **Auto-cleanup Paper Remapped** - Automatically removes corrupt `.paper-remapped` folders
152
+ - **Memory Safety** - Uses 90% of cgroup limit to prevent OOM killer
153
+ - **Smart Restart** - Only restarts when no players online
129
154
 
130
155
  ---
131
156
 
@@ -135,7 +160,11 @@ Built specifically for developers, sysadmins, and Minecraft enthusiasts who want
135
160
  |----------|----------|
136
161
  | **Server Types** | Paper, Purpur, Vanilla, Spigot, Forge, Fabric |
137
162
  | **Platforms** | Java Edition, Bedrock Edition, Cross-play (Geyser) |
163
+ | **Plugins** | ProtocolLib, TCPShield, Spark, ViewDistanceTweaks, FarmControl, EntityDetection |
164
+ | **RAM Disk** | World/plugins/addons in RAM, auto backup to disk, restore after crash |
165
+ | **Symlink Master** | Secure master storage with symbolic links |
138
166
  | **Architecture Support** | x64, ARM64, ARM (Raspberry Pi, Oracle Cloud) |
167
+ | **Pterodactyl Integration** | Auto-detect, port sharing, environment variables, 90% memory safety |
139
168
  | **Auto Setup** | Automatic Java detection, EULA acceptance, server.properties generation |
140
169
  | **Portable Java** | Download JRE to `/home/container/.java` (Pterodactyl) or `/tmp/.mc-headless` |
141
170
  | **Smart Storage** | Detects Pterodactyl, warns on low RAM for /tmp usage |
@@ -148,7 +177,6 @@ Built specifically for developers, sysadmins, and Minecraft enthusiasts who want
148
177
  | **Cross-play** | Built-in Geyser & Floodgate support for Bedrock clients |
149
178
  | **ViaVersion** | Built-in ViaVersion, ViaBackwards, ViaRewind support |
150
179
  | **SkinRestorer** | Auto-download and install SkinRestorer plugin |
151
- | **Pterodactyl Ready** | Optimized for panel hosting with environment variable support |
152
180
  | **Termux Friendly** | Optimized for Android/Termux environments |
153
181
  | **Headless Ready** | No GUI required, perfect for servers and automation |
154
182
  | **Silent Mode** | Direct log piping for minimal CPU usage |
@@ -186,7 +214,7 @@ wget https://github.com/SkinsRestorer/SkinsRestorerX/releases/latest/download/Sk
186
214
  tail -f logs/latest.log
187
215
  ```
188
216
 
189
- After (MC-Headless v2.2.2)
217
+ After (MC-Headless v2.2.3)
190
218
 
191
219
  ```javascript
192
220
  const { MinecraftServer } = require('@dimzxzzx07/mc-headless');
@@ -197,7 +225,15 @@ const server = new MinecraftServer({
197
225
  usePortableJava: true,
198
226
  memory: { init: '4G', max: '12G' },
199
227
  enableViaVersion: true,
200
- enableSkinRestorer: true
228
+ enableSkinRestorer: true,
229
+ enableProtocolLib: true,
230
+ enableSpark: true,
231
+ ramdisk: {
232
+ enabled: true,
233
+ world: true,
234
+ plugins: true,
235
+ backupInterval: 300000
236
+ }
201
237
  });
202
238
 
203
239
  server.on('ready', () => console.log('Server ready!'));
@@ -241,7 +277,6 @@ const { MinecraftServer } = require('@dimzxzzx07/mc-headless');
241
277
  const os = require('os');
242
278
 
243
279
  async function startServer() {
244
- // Auto-detect system RAM
245
280
  const totalRam = Math.floor(os.totalmem() / 1024 / 1024 / 1024);
246
281
  const recommendedMax = Math.min(12, Math.max(2, Math.floor(totalRam * 0.7)));
247
282
 
@@ -279,7 +314,6 @@ const axios = require('axios');
279
314
  const os = require('os');
280
315
 
281
316
  async function startServer() {
282
- // Get public IP
283
317
  let publicIp = "127.0.0.1";
284
318
  try {
285
319
  const res = await axios.get('https://api.ipify.org?format=json');
@@ -288,17 +322,12 @@ async function startServer() {
288
322
  console.log("Using default IP");
289
323
  }
290
324
 
291
- // Auto-detect RAM
292
- const totalRam = Math.floor(os.totalmem() / 1024 / 1024 / 1024);
293
- const recommendedMax = Math.min(12, Math.max(2, Math.floor(totalRam * 0.7)));
294
-
295
325
  const server = new MinecraftServer({
296
326
  platform: "all",
297
327
  version: "1.21.11",
298
328
  type: "paper",
299
329
  autoAcceptEula: true,
300
330
 
301
- // Java options
302
331
  usePortableJava: true,
303
332
  javaVersion: "auto",
304
333
 
@@ -324,13 +353,45 @@ async function startServer() {
324
353
  simulationDistance: 4
325
354
  },
326
355
 
327
- // Plugins
356
+ // New plugins in 2.2.3
328
357
  enableViaVersion: true,
329
358
  enableViaBackwards: true,
330
359
  enableViaRewind: true,
331
360
  enableSkinRestorer: true,
361
+ enableProtocolLib: true,
362
+ enableTCPShield: true,
363
+ enableSpigotOptimizers: true,
364
+ enableSpark: true,
365
+ enableViewDistanceTweaks: true,
366
+ enableFarmControl: true,
367
+ enableEntityDetection: true,
368
+
369
+ // RAM Disk (NEW)
370
+ ramdisk: {
371
+ enabled: true,
372
+ world: true,
373
+ plugins: true,
374
+ addons: true,
375
+ backupInterval: 300000,
376
+ masterStorage: '/home/minecraft-master'
377
+ },
378
+
379
+ // Symlink Master (NEW)
380
+ symlinkMaster: '/home/minecraft-master',
381
+
382
+ // Network Optimization (NEW)
383
+ networkOptimization: {
384
+ tcpFastOpen: true,
385
+ tcpNoDelay: true,
386
+ preferIPv4: true,
387
+ compressionThreshold: 64,
388
+ bungeeMode: false,
389
+ velocity: {
390
+ enabled: false,
391
+ secret: ''
392
+ }
393
+ },
332
394
 
333
- // Monitoring
334
395
  memoryMonitor: {
335
396
  enabled: true,
336
397
  threshold: 85,
@@ -338,21 +399,24 @@ async function startServer() {
338
399
  action: 'warn'
339
400
  },
340
401
 
341
- // Performance
342
402
  silentMode: true,
343
403
  statsInterval: 30000
344
404
  });
345
405
 
346
406
  server.on("ready", (info) => {
347
407
  console.clear();
348
- console.log(`\n==========================================`);
349
- console.log(`Minecraft Server - v2.2.2`);
350
- console.log(` IP: ${publicIp}:${info.port}`);
351
- console.log(` Version: ${info.version}`);
352
- console.log(` Memory: ${info.memory.used}/${info.memory.max} MB`);
353
- console.log(` CPU: ${info.cpu || 0}%`);
354
- console.log(` Players: ${info.players}/${info.maxPlayers}`);
355
- console.log(`==========================================\n`);
408
+ console.log(`
409
+ ==========================================
410
+ Minecraft Server - v2.2.3
411
+ IP: ${publicIp}:${info.port}
412
+ Version: ${info.version}
413
+ Memory: ${info.memory.used}/${info.memory.max} MB
414
+ CPU: ${info.cpu}%
415
+ Players: ${info.players}/${info.maxPlayers}
416
+ RAM Disk: Active
417
+ Plugins: 7 boosters installed
418
+ ==========================================
419
+ `);
356
420
  });
357
421
 
358
422
  server.on("player-join", (player) => {
@@ -364,46 +428,367 @@ async function startServer() {
364
428
  console.log(`${name} left`);
365
429
  });
366
430
 
367
- server.on("resource", (info) => {
368
- if (info.memory.used > info.memory.max * 0.8) {
369
- console.log(` High memory: ${info.memory.used}/${info.memory.max} MB`);
431
+ await server.start();
432
+ }
433
+
434
+ startServer();
435
+ ```
436
+
437
+ ---
438
+
439
+ Server Startup Flow Diagram
440
+
441
+ ```
442
+ ┌─────────────────────────────────────────────────────────────────┐
443
+ │ SERVER STARTUP FLOW │
444
+ └─────────────────────────────────────────────────────────────────┘
445
+
446
+ ┌─────────────────┐
447
+ │ detectEnvironment │
448
+ │ • Pterodactyl? │
449
+ │ • Set ports │
450
+ └────────┬─────────┘
451
+
452
+ ┌─────────────────┐
453
+ │ setupSymlinkMaster │
454
+ │ • Create /home/ │
455
+ │ minecraft-master │
456
+ └────────┬─────────┘
457
+
458
+ ┌─────────────────┐
459
+ │ restoreFromMaster │
460
+ │ • Check RAM disk │
461
+ │ • Copy from master │
462
+ │ if RAM empty │
463
+ └────────┬─────────┘
464
+
465
+ ┌─────────────────┐
466
+ │ setupRamdisk │
467
+ │ • Create symlinks │
468
+ │ • Schedule backups │
469
+ └────────┬─────────┘
470
+
471
+ ┌─────────────────┐
472
+ │ ensureJava │
473
+ │ • Check system │
474
+ │ • Download JRE │
475
+ │ if needed │
476
+ └────────┬─────────┘
477
+
478
+ ┌─────────────────┐
479
+ │ download server │
480
+ │ • Paper/Vanilla │
481
+ │ etc. │
482
+ └────────┬─────────┘
483
+
484
+ ┌─────────────────┐
485
+ │ setup geyser │
486
+ │ • If platform all │
487
+ │ • Configure ports │
488
+ └────────┬─────────┘
489
+
490
+ ┌─────────────────┐
491
+ │ install plugins │
492
+ │ • ProtocolLib │
493
+ │ • TCPShield │
494
+ │ • Spark │
495
+ │ • ViewDistance │
496
+ │ • FarmControl │
497
+ │ • EntityDetection │
498
+ └────────┬─────────┘
499
+
500
+ ┌─────────────────┐
501
+ │ setup viaversion │
502
+ │ • ViaVersion │
503
+ │ • ViaBackwards │
504
+ │ • ViaRewind │
505
+ └────────┬─────────┘
506
+
507
+ ┌─────────────────┐
508
+ │ launch server │
509
+ │ • Build Java args │
510
+ │ • Set environment │
511
+ │ • Spawn process │
512
+ └────────┬─────────┘
513
+
514
+ ┌─────────────────┐
515
+ │ monitor logs │
516
+ │ • Wait for "Done" │
517
+ │ • Track players │
518
+ └────────┬─────────┘
519
+
520
+ ┌─────────────────┐
521
+ │ server ready │
522
+ │ • Emit 'ready' │
523
+ │ • Start monitoring│
524
+ └─────────────────┘
525
+
526
+ ┌─────────────────────────────────────────────────────────────────┐
527
+ │ BACKGROUND PROCESSES │
528
+ └─────────────────────────────────────────────────────────────────┘
529
+
530
+ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
531
+ │ RAM Disk Backup │ │ Log Cleanup │ │ Memory Monitor │
532
+ │ Every 5 min │ │ Every 3 hours │ │ Every 30 sec │
533
+ │ RAM → Master │ │ Delete old │ │ Check usage │
534
+ │ │ │ logs │ │ Warn if high │
535
+ └─────────────────┘ └─────────────────┘ └─────────────────┘
536
+ ```
537
+
538
+ ---
539
+
540
+ Pterodactyl Setup (No Egg Required)
541
+
542
+ Step 1: Create Server Files
543
+
544
+ Create the following files in your Pterodactyl server directory (/home/container):
545
+
546
+ index.js
547
+
548
+ ```javascript
549
+ const { MinecraftServer } = require('@dimzxzzx07/mc-headless');
550
+
551
+ async function startServer() {
552
+ const server = new MinecraftServer({
553
+ platform: "all",
554
+ version: "1.21.11",
555
+ type: "paper",
556
+ autoAcceptEula: true,
557
+ usePortableJava: false,
558
+
559
+ memory: {
560
+ init: process.env.SERVER_MEMORY_INIT || "2G",
561
+ max: process.env.SERVER_MEMORY_MAX || "4G",
562
+ useAikarsFlags: true
563
+ },
564
+
565
+ network: {
566
+ ip: "0.0.0.0",
567
+ port: parseInt(process.env.SERVER_PORT || "25565"),
568
+ bedrockPort: process.env.BEDROCK_PORT ? parseInt(process.env.BEDROCK_PORT) : undefined,
569
+ motd: process.env.SERVER_MOTD || "Minecraft Server",
570
+ onlineMode: false
571
+ },
572
+
573
+ world: {
574
+ difficulty: "normal",
575
+ maxPlayers: 20,
576
+ levelName: "world",
577
+ viewDistance: 6,
578
+ simulationDistance: 4
579
+ },
580
+
581
+ // Enable all plugins
582
+ enableViaVersion: true,
583
+ enableViaBackwards: true,
584
+ enableViaRewind: true,
585
+ enableSkinRestorer: true,
586
+ enableProtocolLib: true,
587
+ enableTCPShield: true,
588
+ enableSpigotOptimizers: true,
589
+ enableSpark: true,
590
+ enableViewDistanceTweaks: true,
591
+ enableFarmControl: true,
592
+ enableEntityDetection: true,
593
+
594
+ // RAM Disk for Pterodactyl
595
+ ramdisk: {
596
+ enabled: true,
597
+ world: true,
598
+ plugins: true,
599
+ backupInterval: 300000,
600
+ masterStorage: '/home/minecraft-master'
601
+ },
602
+
603
+ networkOptimization: {
604
+ tcpFastOpen: true,
605
+ tcpNoDelay: true,
606
+ compressionThreshold: 64
370
607
  }
371
608
  });
372
609
 
610
+ server.on("ready", (info) => {
611
+ console.log(`
612
+ ==========================================
613
+ Minecraft Server - Pterodactyl
614
+ IP: ${info.ip}:${info.port}
615
+ Version: ${info.version}
616
+ Memory: ${info.memory.used}/${info.memory.max} MB
617
+ CPU: ${info.cpu}%
618
+ Players: ${info.players}/${info.maxPlayers}
619
+ RAM Disk: Active
620
+ ==========================================
621
+ `);
622
+ });
623
+
373
624
  await server.start();
374
625
  }
375
626
 
376
- startServer();
627
+ startServer().catch(console.error);
628
+ ```
629
+
630
+ package.json
631
+
632
+ ```json
633
+ {
634
+ "name": "minecraft-server",
635
+ "version": "1.0.0",
636
+ "dependencies": {
637
+ "@dimzxzzx07/mc-headless": "^2.2.3"
638
+ }
639
+ }
640
+ ```
641
+
642
+ start.sh
643
+
644
+ ```bash
645
+ #!/bin/bash
646
+ echo "=========================================="
647
+ echo "MC-Headless Server - Pterodactyl v2.2.3"
648
+ echo "=========================================="
649
+ echo "Java Port: ${SERVER_PORT:-25565}"
650
+ if [ -n "$BEDROCK_PORT" ]; then
651
+ echo "Bedrock Port: $BEDROCK_PORT (UDP)"
652
+ else
653
+ echo "Bedrock Port: Sharing Java port (UDP must be enabled)"
654
+ fi
655
+ echo "Memory: ${SERVER_MEMORY_INIT:-2G} - ${SERVER_MEMORY_MAX:-4G}"
656
+ echo "Plugins: ProtocolLib, TCPShield, Spark, etc."
657
+ echo "RAM Disk: Active"
658
+ echo "=========================================="
659
+
660
+ # Clean up corrupt Paper cache
661
+ if [ -d "plugins" ]; then
662
+ find plugins -type d -name ".paper-remapped*" -exec rm -rf {} + 2>/dev/null || true
663
+ fi
664
+
665
+ node index.js
666
+ ```
667
+
668
+ Step 2: Upload Files via SFTP
669
+
670
+ ```bash
671
+ # Connect to your server via SFTP and upload:
672
+ /home/container/
673
+ ├── index.js
674
+ ├── package.json
675
+ ├── start.sh
676
+ └── node_modules/ (will be created by npm install)
677
+ ```
678
+
679
+ Step 3: Install Dependencies
680
+
681
+ ```bash
682
+ cd /home/container
683
+ npm install
684
+ chmod +x start.sh
377
685
  ```
378
686
 
687
+ Step 4: Configure Pterodactyl Panel
688
+
689
+ Startup Command:
690
+
691
+ ```
692
+ bash start.sh
693
+ ```
694
+
695
+ Docker Image:
696
+
697
+ ```
698
+ node:20-slim
699
+ ```
700
+
701
+ Environment Variables:
702
+
703
+ Variable Description Example
704
+ SERVER_PORT Java edition port (TCP) 25565
705
+ BEDROCK_PORT Bedrock edition port (UDP) 19132
706
+ SERVER_MEMORY_INIT Initial memory 2G
707
+ SERVER_MEMORY_MAX Max memory 4G
708
+ SERVER_MOTD Message of the day My Server
709
+
710
+ Pterodactyl Memory Safety
711
+
712
+ The module automatically:
713
+
714
+ · Detects cgroup memory limits
715
+ · Uses only 90% of available memory to prevent OOM killer
716
+ · Adjusts -Xmx accordingly
717
+ · Logs the adjusted memory value
718
+
719
+ Port Configuration Options
720
+
721
+ Option A: Separate Ports (Recommended)
722
+
723
+ · Add port 25565 (TCP) for Java
724
+ · Add port 19132 (UDP) for Bedrock
725
+ · Set both environment variables
726
+
727
+ Option B: Single Port (Port Sharing)
728
+
729
+ · Set only SERVER_PORT
730
+ · Ensure port is configured for BOTH TCP and UDP in panel
731
+ · Geyser will automatically share the same port
732
+ · Warning appears if UDP not enabled
733
+
734
+ ---
735
+
736
+ How to Connect from Minecraft
737
+
738
+ Java Edition Connection
739
+
740
+ 1. Open Minecraft Java Edition
741
+ 2. Click "Multiplayer" → "Add Server"
742
+ 3. Server Address: your-server-ip:25565 (or your configured port)
743
+ 4. Click "Done" and join
744
+
745
+ Bedrock Edition Connection
746
+
747
+ If you have separate Bedrock port (19132 UDP):
748
+
749
+ 1. Open Minecraft Bedrock Edition
750
+ 2. Click "Play" → "Servers" → "Add Server"
751
+ 3. Server Address: your-server-ip
752
+ 4. Port: 19132
753
+ 5. Click "Save" and join
754
+
755
+ If using port sharing (same port as Java):
756
+
757
+ 1. Open Minecraft Bedrock Edition
758
+ 2. Click "Play" → "Servers" → "Add Server"
759
+ 3. Server Address: your-server-ip
760
+ 4. Port: 25565 (or your configured port)
761
+ 5. IMPORTANT: Port must have UDP enabled in Pterodactyl panel
762
+ 6. Click "Save" and join
763
+
764
+ Cross-Play (Java + Bedrock together)
765
+
766
+ With Geyser and Floodgate enabled, both Java and Bedrock players can join the same server simultaneously. Bedrock players will see Java players and vice versa.
767
+
379
768
  ---
380
769
 
381
770
  Configuration Guide
382
771
 
383
- Complete Configuration Example
772
+ Complete Configuration Example with New Features
384
773
 
385
774
  ```javascript
386
775
  const { MinecraftServer } = require('@dimzxzzx07/mc-headless');
387
776
 
388
777
  const server = new MinecraftServer({
389
- // Platform Selection
390
778
  platform: 'all',
391
779
  version: '1.21.11',
392
780
  type: 'paper',
393
781
  autoAcceptEula: true,
394
782
 
395
- // Java Options
396
783
  usePortableJava: true,
397
784
  javaVersion: 'auto',
398
785
 
399
- // Resource Management
400
786
  memory: {
401
787
  init: '4G',
402
788
  max: '12G',
403
789
  useAikarsFlags: true
404
790
  },
405
791
 
406
- // Network Settings
407
792
  network: {
408
793
  port: 25565,
409
794
  bedrockPort: 19132,
@@ -412,7 +797,6 @@ const server = new MinecraftServer({
412
797
  motd: 'Minecraft Server'
413
798
  },
414
799
 
415
- // World & Difficulty Settings
416
800
  world: {
417
801
  difficulty: 'normal',
418
802
  hardcore: false,
@@ -424,7 +808,6 @@ const server = new MinecraftServer({
424
808
  levelName: 'world'
425
809
  },
426
810
 
427
- // Folder Management
428
811
  folders: {
429
812
  addons: './addons',
430
813
  mods: './mods',
@@ -432,13 +815,45 @@ const server = new MinecraftServer({
432
815
  world: './world'
433
816
  },
434
817
 
435
- // Plugins
818
+ // Plugins (NEW in 2.2.3)
436
819
  enableViaVersion: true,
437
820
  enableViaBackwards: true,
438
821
  enableViaRewind: true,
439
822
  enableSkinRestorer: true,
823
+ enableProtocolLib: true,
824
+ enableTCPShield: true,
825
+ enableSpigotOptimizers: true,
826
+ enableSpark: true,
827
+ enableViewDistanceTweaks: true,
828
+ enableFarmControl: true,
829
+ enableEntityDetection: true,
830
+
831
+ // RAM Disk (NEW)
832
+ ramdisk: {
833
+ enabled: true,
834
+ world: true,
835
+ plugins: true,
836
+ addons: true,
837
+ backupInterval: 300000,
838
+ masterStorage: '/home/minecraft-master'
839
+ },
840
+
841
+ // Symlink Master (NEW)
842
+ symlinkMaster: '/home/minecraft-master',
843
+
844
+ // Network Optimization (NEW)
845
+ networkOptimization: {
846
+ tcpFastOpen: true,
847
+ tcpNoDelay: true,
848
+ preferIPv4: true,
849
+ compressionThreshold: 64,
850
+ bungeeMode: false,
851
+ velocity: {
852
+ enabled: false,
853
+ secret: ''
854
+ }
855
+ },
440
856
 
441
- // Server Behavior
442
857
  autoRestart: true,
443
858
  backup: {
444
859
  enabled: true,
@@ -446,7 +861,6 @@ const server = new MinecraftServer({
446
861
  path: './backups'
447
862
  },
448
863
 
449
- // Monitoring
450
864
  memoryMonitor: {
451
865
  enabled: true,
452
866
  threshold: 85,
@@ -454,7 +868,6 @@ const server = new MinecraftServer({
454
868
  action: 'warn'
455
869
  },
456
870
 
457
- // Performance
458
871
  silentMode: true,
459
872
  statsInterval: 30000
460
873
  });
@@ -462,70 +875,44 @@ const server = new MinecraftServer({
462
875
  await server.start();
463
876
  ```
464
877
 
465
- Configuration Options Reference
878
+ New Configuration Options in 2.2.3
466
879
 
467
- Platform Options
468
-
469
- Option Type Default Description
470
- platform string 'java' 'java', 'bedrock', or 'all'
471
- version string '1.21.11' Minecraft version
472
- type string 'paper' paper, purpur, vanilla, spigot, forge, fabric
473
- autoAcceptEula boolean true Automatically accept Minecraft EULA
474
-
475
- Java Options
476
-
477
- Option Type Default Description
478
- usePortableJava boolean true Download portable JRE to /home/container/.java (Pterodactyl) or /tmp/.mc-headless
479
- javaVersion string 'auto' '17', '21', or 'auto'
480
-
481
- Memory Options
482
-
483
- Option Type Default Description
484
- memory.init string '2G' Initial heap size
485
- memory.max string '4G' Maximum heap size
486
- memory.useAikarsFlags boolean true Use Aikar's optimized GC flags
487
-
488
- Network Options
489
-
490
- Option Type Default Description
491
- network.port number 25565 Java edition server port
492
- network.bedrockPort number 19132 Bedrock edition server port
493
- network.ip string '0.0.0.0' Bind IP address
494
- network.onlineMode boolean false Enable Mojang authentication
495
- network.motd string 'Minecraft Server' Message of the day
496
-
497
- World Options
880
+ Plugin Options
498
881
 
499
882
  Option Type Default Description
500
- world.difficulty string 'normal' peaceful, easy, normal, hard
501
- world.hardcore boolean false Enable hardcore mode
502
- world.gamemode string 'survival' survival, creative, adventure, spectator
503
- world.seed string undefined World generation seed
504
- world.maxPlayers number 20 Maximum player count
505
- world.viewDistance number 6 Chunk view distance
506
- world.simulationDistance number 4 Simulation distance
507
- world.levelName string 'world' World folder name
883
+ enableProtocolLib boolean false ProtocolLib for packet manipulation
884
+ enableTCPShield boolean false TCPShield DDoS protection
885
+ enableSpigotOptimizers boolean false Performance optimization plugin
886
+ enableSpark boolean false Spark profiler for performance monitoring
887
+ enableViewDistanceTweaks boolean false Dynamic view distance adjustment
888
+ enableFarmControl boolean false Farm entity limit control
889
+ enableEntityDetection boolean false Entity tracking optimization
508
890
 
509
- Plugin Options
891
+ RAM Disk Options
510
892
 
511
893
  Option Type Default Description
512
- enableViaVersion boolean false Enable ViaVersion plugin
513
- enableViaBackwards boolean false Enable ViaBackwards plugin
514
- enableViaRewind boolean false Enable ViaRewind plugin
515
- enableSkinRestorer boolean false Enable SkinRestorer plugin
894
+ ramdisk.enabled boolean false Enable RAM disk for worlds/plugins
895
+ ramdisk.world boolean false Store world in RAM
896
+ ramdisk.plugins boolean false Store plugins in RAM
897
+ ramdisk.addons boolean false Store addons in RAM
898
+ ramdisk.backupInterval number 300000 Backup interval in ms (5 minutes default)
899
+ ramdisk.masterStorage string '/home/minecraft-master' Master storage path for backups
516
900
 
517
- Performance Options
901
+ Symlink Master Options
518
902
 
519
903
  Option Type Default Description
520
- silentMode boolean true Direct pipe logs (no Node.js processing)
521
- statsInterval number 30000 Stats update interval in ms
904
+ symlinkMaster string undefined Master directory for symbolic links
522
905
 
523
- Owner Options
906
+ Network Optimization Options
524
907
 
525
908
  Option Type Default Description
526
- owners array [] List of owner usernames
527
- ownerCommands.prefix string '!' Command prefix for owners
528
- ownerCommands.enabled boolean true Enable owner commands
909
+ networkOptimization.tcpFastOpen boolean true Enable TCP Fast Open
910
+ networkOptimization.tcpNoDelay boolean true Enable TCP_NODELAY
911
+ networkOptimization.preferIPv4 boolean true Prefer IPv4 stack
912
+ networkOptimization.compressionThreshold number 64 Network compression threshold
913
+ networkOptimization.bungeeMode boolean false Enable BungeeCord mode
914
+ networkOptimization.velocity.enabled boolean false Enable Velocity proxy support
915
+ networkOptimization.velocity.secret string '' Velocity forwarding secret
529
916
 
530
917
  ---
531
918
 
@@ -537,7 +924,6 @@ MinecraftServer Class
537
924
  class MinecraftServer extends EventEmitter {
538
925
  constructor(config: Partial<MinecraftConfig>);
539
926
 
540
- // Methods
541
927
  async start(): Promise<ServerInfo>;
542
928
  async stop(): Promise<void>;
543
929
  sendCommand(command: string): void;
@@ -545,7 +931,6 @@ class MinecraftServer extends EventEmitter {
545
931
  getPlayers(): Player[];
546
932
  async backup(type?: 'full' | 'world' | 'plugins'): Promise<string>;
547
933
 
548
- // Events
549
934
  on(event: 'ready', listener: (info: ServerInfo) => void): this;
550
935
  on(event: 'stop', listener: (data: { code: number }) => void): this;
551
936
  on(event: 'player-join', listener: (player: Player) => void): this;
@@ -568,536 +953,121 @@ interface ServerInfo {
568
953
  players: number;
569
954
  maxPlayers: number;
570
955
  uptime: number;
571
- memory: {
572
- used: number;
573
- max: number;
574
- };
956
+ memory: { used: number; max: number };
575
957
  cpu: number;
576
958
  status: 'starting' | 'running' | 'stopping' | 'stopped' | 'crashed';
577
959
  }
578
960
  ```
579
961
 
580
- Player Interface
581
-
582
- ```javascript
583
- interface Player {
584
- name: string;
585
- uuid: string;
586
- ip: string;
587
- ping: number;
588
- connectedAt: Date;
589
- }
590
- ```
591
-
592
- ---
593
-
594
- Usage Examples
595
-
596
- Server with Auto RAM Detection
597
-
598
- ```javascript
599
- const { MinecraftServer } = require('@dimzxzzx07/mc-headless');
600
- const os = require('os');
601
-
602
- const totalRam = Math.floor(os.totalmem() / 1024 / 1024 / 1024);
603
- const maxRam = Math.min(12, Math.floor(totalRam * 0.7));
604
-
605
- const server = new MinecraftServer({
606
- version: '1.21.11',
607
- type: 'paper',
608
- usePortableJava: true,
609
- memory: {
610
- init: `${Math.floor(maxRam * 0.3)}G`,
611
- max: `${maxRam}G`
612
- }
613
- });
614
-
615
- server.on('ready', (info) => {
616
- console.log(`Server running with ${info.memory.max} MB max`);
617
- });
618
-
619
- server.start();
620
- ```
621
-
622
- Multiple Servers with Different Versions
623
-
624
- ```javascript
625
- const { ServerManager } = require('@dimzxzzx07/mc-headless');
626
-
627
- const manager = new ServerManager();
628
-
629
- // Create servers
630
- manager.createServer('lobby', {
631
- version: '1.21.11',
632
- type: 'paper',
633
- network: { port: 25565 }
634
- });
635
-
636
- manager.createServer('survival', {
637
- version: '1.21.11',
638
- type: 'paper',
639
- network: { port: 25566 },
640
- world: { levelName: 'survival' }
641
- });
642
-
643
- manager.createServer('creative', {
644
- version: '1.21.11',
645
- type: 'paper',
646
- network: { port: 25567 },
647
- world: { gamemode: 'creative' }
648
- });
649
-
650
- // Start all
651
- await manager.startAll();
652
-
653
- // Broadcast command
654
- await manager.broadcastCommand('say Server is running!');
655
- ```
656
-
657
- Server with Owner Commands
658
-
659
- ```javascript
660
- const { MinecraftServer } = require('@dimzxzzx07/mc-headless');
661
-
662
- const server = new MinecraftServer({
663
- version: '1.21.11',
664
- type: 'paper',
665
- owners: ['dimzxind', 'admin1', 'tesuser'],
666
- ownerCommands: {
667
- prefix: '!',
668
- enabled: true
669
- }
670
- });
671
-
672
- server.on('player-join', (player) => {
673
- if (['dimzxind', 'admin1', 'tesuser'].includes(player.name)) {
674
- server.sendCommand(`tellraw ${player.name} {"text":"Welcome Owner! Use !help for commands","color":"gold"}`);
675
- }
676
- });
677
-
678
- server.start();
679
- ```
680
-
681
- Owner Commands Available
682
-
683
- Command Description Example
684
- !gamemode <mode> [player] Change gamemode !gamemode creative
685
- !gm <mode> [player] Shortcut for gamemode !gm survival
686
- !tp <player> [x y z] Teleport !tp player2
687
- !give <player> <item> [amount] Give items !give player2 diamond 64
688
- !time <set\|add> <value> Change time !time set day
689
- !weather <clear\|rain\|thunder> Change weather !weather clear
690
- !kill [player] Kill player !kill player2
691
- !ban <player> [reason] Ban player !ban hacker
692
- !kick <player> [reason] Kick player !kick spammer
693
- !op <player> Give operator !op friend
694
- !deop <player> Remove operator !deop friend
695
- !reload Reload server !reload
696
- !save Save world !save
697
- !list List players !list
698
- !help Show owner commands !help
699
-
700
962
  ---
701
963
 
702
- Server Types
964
+ Plugins & Boosters
703
965
 
704
- Paper (Recommended for Performance)
966
+ Available Plugins in v2.2.3
705
967
 
706
- ```javascript
707
- const server = new MinecraftServer({
708
- type: 'paper',
709
- version: '1.21.11',
710
- memory: { useAikarsFlags: true }
711
- });
712
- ```
968
+ Plugin Function Enable Option
969
+ ProtocolLib Packet manipulation library enableProtocolLib: true
970
+ TCPShield DDoS protection and proxy enableTCPShield: true
971
+ Spigot-Optimizers Performance optimizations enableSpigotOptimizers: true
972
+ Spark Performance profiling enableSpark: true
973
+ ViewDistanceTweaks Dynamic view distance enableViewDistanceTweaks: true
974
+ FarmControl Farm entity limits enableFarmControl: true
975
+ EntityDetection Entity tracking optimization enableEntityDetection: true
976
+ ViaVersion Cross-version support enableViaVersion: true
977
+ ViaBackwards Backwards compatibility enableViaBackwards: true
978
+ ViaRewind 1.7-1.8 support enableViaRewind: true
979
+ SkinRestorer Player skin fixing enableSkinRestorer: true
713
980
 
714
- Vanilla (Official Mojang)
981
+ Plugin Auto-Download
715
982
 
716
- ```javascript
717
- const server = new MinecraftServer({
718
- type: 'vanilla',
719
- version: '1.21.11'
720
- });
721
- ```
722
-
723
- Forge (Modded)
983
+ All plugins are automatically downloaded from official sources with:
724
984
 
725
- ```javascript
726
- const server = new MinecraftServer({
727
- type: 'forge',
728
- version: '1.21.11',
729
- folders: { mods: './mods' }
730
- });
731
- ```
732
-
733
- Fabric (Lightweight Modding)
734
-
735
- ```javascript
736
- const server = new MinecraftServer({
737
- type: 'fabric',
738
- version: '1.21.11',
739
- folders: { mods: './mods' }
740
- });
741
- ```
985
+ · Stream finished guarantee
986
+ · 1-second delay between downloads
987
+ · Size verification (>100KB)
988
+ · ZIP header validation
989
+ · Auto-retry on failure
742
990
 
743
991
  ---
744
992
 
745
- Platform Options
746
-
747
- Java Edition Only
993
+ RAM Disk & Symlink System
748
994
 
749
- ```javascript
750
- const server = new MinecraftServer({
751
- platform: 'java',
752
- version: '1.21.11',
753
- type: 'paper',
754
- network: { port: 25565 }
755
- });
756
- ```
757
-
758
- Bedrock Edition Only
759
-
760
- ```javascript
761
- const server = new MinecraftServer({
762
- platform: 'bedrock',
763
- version: '1.21.11',
764
- network: { port: 19132 },
765
- folders: { addons: './addons' }
766
- });
767
- ```
995
+ How RAM Disk Works
768
996
 
769
- Cross-Play (Java + Bedrock)
997
+ When enabled, worlds/plugins/addons are stored in RAM (/dev/shm/minecraft) for lightning-fast access:
770
998
 
771
999
  ```javascript
772
- const server = new MinecraftServer({
773
- platform: 'all',
774
- version: '1.21.11',
775
- type: 'paper',
776
- network: {
777
- port: 25565,
778
- bedrockPort: 19132
779
- }
780
- });
781
- ```
782
-
783
- ---
784
-
785
- Memory Management
786
-
787
- Basic Memory Configuration
788
-
789
- ```javascript
790
- memory: {
791
- init: '2G',
792
- max: '4G',
793
- useAikarsFlags: false
794
- }
795
- ```
796
-
797
- Aikar's Flags (Optimized)
798
-
799
- ```javascript
800
- memory: {
801
- init: '2G',
802
- max: '8G',
803
- useAikarsFlags: true
804
- }
805
- ```
806
-
807
- Memory Recommendations
808
-
809
- Players RAM Init Max
810
- 1-10 2 GB 1G 2G
811
- 10-20 4 GB 2G 4G
812
- 20-50 8 GB 4G 8G
813
- 50-100 16 GB 8G 16G
814
-
815
- ---
816
-
817
- Network Settings
818
-
819
- Basic Network
820
-
821
- ```javascript
822
- network: {
823
- port: 25565,
824
- ip: '0.0.0.0',
825
- onlineMode: false,
826
- motd: 'My Server'
827
- }
828
- ```
829
-
830
- Cross-Play Network
831
-
832
- ```javascript
833
- network: {
834
- port: 25565,
835
- bedrockPort: 19132,
836
- ip: '0.0.0.0',
837
- onlineMode: false,
838
- motd: 'Cross-Play Server'
839
- }
840
- ```
841
-
842
- ---
843
-
844
- World Configuration
845
-
846
- Basic World
847
-
848
- ```javascript
849
- world: {
850
- difficulty: 'normal',
851
- gamemode: 'survival',
852
- maxPlayers: 20,
853
- viewDistance: 6,
854
- simulationDistance: 4,
855
- levelName: 'world'
856
- }
857
- ```
858
-
859
- Hardcore Mode
860
-
861
- ```javascript
862
- world: {
863
- difficulty: 'hard',
864
- hardcore: true,
865
- gamemode: 'survival',
866
- maxPlayers: 10,
867
- viewDistance: 6
868
- }
869
- ```
870
-
871
- Custom Seed
872
-
873
- ```javascript
874
- world: {
875
- seed: 'my-amazing-seed-12345',
876
- levelName: 'custom_world'
877
- }
878
- ```
879
-
880
- ---
881
-
882
- Folder Structure
883
-
884
- ```
885
- server/
886
- ├── plugins/ # Paper/Spigot plugins
887
- ├── mods/ # Forge/Fabric mods
888
- ├── addons/ # Bedrock addons
889
- ├── world/ # World data
890
- ├── logs/ # Server logs
891
- ├── backups/ # Backup files
892
- └── .java/ # Portable Java (if enabled)
893
- ```
894
-
895
- ---
896
-
897
- Backup System
898
-
899
- Enable Automatic Backups
900
-
901
- ```javascript
902
- backup: {
1000
+ ramdisk: {
903
1001
  enabled: true,
904
- interval: '24h',
905
- path: './backups'
1002
+ world: true, // World in RAM
1003
+ plugins: true, // Plugins in RAM
1004
+ addons: true, // Addons in RAM
1005
+ backupInterval: 300000, // Backup every 5 minutes
1006
+ masterStorage: '/home/minecraft-master' // Master storage
906
1007
  }
907
1008
  ```
908
1009
 
909
- Manual Backup
910
-
911
- ```javascript
912
- // Full backup
913
- const fullPath = await server.backup('full');
914
-
915
- // World only backup
916
- const worldPath = await server.backup('world');
1010
+ Crash Recovery Flow
917
1011
 
918
- // Plugins only backup
919
- const pluginsPath = await server.backup('plugins');
920
1012
  ```
921
-
922
- ---
923
-
924
- Event System
925
-
926
- Server Events
927
-
928
- ```javascript
929
- server.on('ready', (info) => {
930
- console.log('Server ready at', info.port);
931
- });
932
-
933
- server.on('stop', ({ code }) => {
934
- console.log('Server stopped with code', code);
935
- });
936
-
937
- server.on('resource', (info) => {
938
- console.log(`Memory: ${info.memory.used}/${info.memory.max} MB`);
939
- });
940
- ```
941
-
942
- Player Events
943
-
944
- ```javascript
945
- server.on('player-join', (player) => {
946
- console.log(`${player.name} joined from ${player.ip}`);
947
- server.sendCommand(`say Welcome ${player.name}!`);
948
- });
949
-
950
- server.on('player-leave', (name) => {
951
- console.log(`${name} left the game`);
952
- });
953
- ```
954
-
955
- ---
956
-
957
- Commands
958
-
959
- Built-in Commands
960
-
961
- ```javascript
962
- // Send any Minecraft command
963
- server.sendCommand('say Hello world');
964
- server.sendCommand('time set day');
965
- server.sendCommand('weather clear');
966
- server.sendCommand('difficulty hard');
967
- server.sendCommand('gamemode creative @a');
968
- ```
969
-
970
- Console Commands
971
-
972
- ```javascript
973
- // Stop server
974
- server.sendCommand('stop');
975
-
976
- // Save world
977
- server.sendCommand('save-all');
978
-
979
- // List players
980
- server.sendCommand('list');
981
-
982
- // Ban player
983
- server.sendCommand('ban Notch');
984
- ```
985
-
986
- ---
987
-
988
- Player Management
989
-
990
- Get Player List
991
-
992
- ```javascript
993
- const players = server.getPlayers();
994
- players.forEach(player => {
995
- console.log(`${player.name} - Ping: ${player.ping}ms`);
996
- });
997
- ```
998
-
999
- Player Count
1000
-
1001
- ```javascript
1002
- const info = await server.getInfo();
1003
- console.log(`Players online: ${info.players}/${info.maxPlayers}`);
1004
- ```
1005
-
1006
- ---
1007
-
1008
- Cross-Play (Geyser)
1009
-
1010
- Automatic Setup
1011
-
1012
- ```javascript
1013
- const server = new MinecraftServer({
1014
- platform: 'all',
1015
- version: '1.21.11',
1016
- type: 'paper',
1017
- network: {
1018
- port: 25565,
1019
- bedrockPort: 19132
1020
- }
1021
- });
1013
+ ┌─────────────────────────────────────────────────────────┐
1014
+ │ CRASH RECOVERY FLOW │
1015
+ └─────────────────────────────────────────────────────────┘
1016
+
1017
+ 1. Server crashes or VPS reboots
1018
+
1019
+ 2. RAM disk data lost (/dev/shm cleared)
1020
+
1021
+ 3. Server restarts
1022
+
1023
+ 4. restoreFromMaster() runs
1024
+
1025
+ 5. Checks if RAM disk is empty
1026
+
1027
+ 6. Copies from master storage to RAM
1028
+
1029
+ 7. World/plugins restored exactly as before
1030
+
1031
+ 8. Server starts with latest data
1022
1032
  ```
1023
1033
 
1024
- ---
1034
+ Benefits
1025
1035
 
1026
- ViaVersion Support
1036
+ · 10-50x faster world loading
1037
+ · Zero lag during chunk generation
1038
+ · Instant plugin loading
1039
+ · Automatic backup to disk every 5 minutes
1040
+ · Crash recovery - Data restored from master storage
1041
+ · Data safety - RAM data regularly saved to disk
1027
1042
 
1028
- Enable All ViaVersion Plugins
1043
+ Symlink Master System
1029
1044
 
1030
1045
  ```javascript
1031
- const server = new MinecraftServer({
1032
- version: '1.21.11',
1033
- type: 'paper',
1034
- enableViaVersion: true,
1035
- enableViaBackwards: true,
1036
- enableViaRewind: true
1037
- });
1046
+ symlinkMaster: '/home/minecraft-master'
1038
1047
  ```
1039
1048
 
1040
- What Each Plugin Does
1041
-
1042
- Plugin Function
1043
- ViaVersion Allows newer clients to connect to older servers
1044
- ViaBackwards Allows older clients to connect to newer servers
1045
- ViaRewind Adds support for 1.7.x - 1.8.x clients
1046
-
1047
- With ViaVersion enabled, your server can accept connections from Minecraft versions 1.7.x through 1.21.x.
1049
+ Creates a secure master folder structure:
1048
1050
 
1049
- ---
1050
-
1051
- SkinRestorer Support
1052
-
1053
- Enable SkinRestorer
1054
-
1055
- ```javascript
1056
- const server = new MinecraftServer({
1057
- enableSkinRestorer: true
1058
- });
1059
1051
  ```
1060
-
1061
- · Auto-downloads latest SkinRestorer
1062
- · Fixes player skins for offline mode
1063
- · Works with Geyser (Bedrock players)
1064
-
1065
- ---
1066
-
1067
- Portable Java
1068
-
1069
- How It Works
1070
-
1071
- ```javascript
1072
- const server = new MinecraftServer({
1073
- usePortableJava: true, // Download JRE to .java folder
1074
- javaVersion: 'auto' // Auto-detect required version
1075
- });
1052
+ /home/minecraft-master/
1053
+ ├── worlds/
1054
+ ├── plugins/
1055
+ ├── addons/
1056
+ └── mods/
1076
1057
  ```
1077
1058
 
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
1085
-
1086
- Java Version Requirements
1059
+ Server folders become symbolic links pointing to master folders, providing:
1087
1060
 
1088
- Minecraft Version Java Version
1089
- 1.21.x Java 21
1090
- 1.20.x Java 17
1091
- 1.19.x Java 17
1092
- 1.18.x Java 17
1093
- 1.17.x Java 16
1094
- 1.16.x Java 8
1061
+ · Data safety - Master data survives server resets
1062
+ · Easy backups - Backup only master folder
1063
+ · Multiple servers - Share plugins across instances
1064
+ · Quick restore - Just recreate symlinks
1095
1065
 
1096
1066
  ---
1097
1067
 
1098
1068
  Performance Tuning
1099
1069
 
1100
- Optimized Configuration
1070
+ Optimized Configuration with New Features
1101
1071
 
1102
1072
  ```javascript
1103
1073
  const server = new MinecraftServer({
@@ -1114,211 +1084,124 @@ const server = new MinecraftServer({
1114
1084
  simulationDistance: 4,
1115
1085
  maxPlayers: 20
1116
1086
  },
1087
+
1088
+ // Enable performance plugins
1089
+ enableSpigotOptimizers: true,
1090
+ enableSpark: true,
1091
+ enableViewDistanceTweaks: true,
1092
+ enableFarmControl: true,
1093
+ enableEntityDetection: true,
1094
+
1095
+ // RAM Disk for speed
1096
+ ramdisk: {
1097
+ enabled: true,
1098
+ world: true,
1099
+ plugins: true,
1100
+ backupInterval: 300000
1101
+ },
1102
+
1103
+ // Network optimizations
1104
+ networkOptimization: {
1105
+ tcpFastOpen: true,
1106
+ tcpNoDelay: true,
1107
+ compressionThreshold: 64
1108
+ },
1109
+
1117
1110
  silentMode: true,
1118
1111
  statsInterval: 30000
1119
1112
  });
1120
1113
  ```
1121
1114
 
1122
- Environment Optimizations
1123
-
1124
- Variable Value Effect
1125
- MALLOC_ARENA_MAX 2 Prevents memory fragmentation
1126
- _JAVA_OPTIONS -Xmx... Global Java memory limit
1127
- JAVA_HOME (auto) Points to portable Java
1128
-
1129
- ---
1130
-
1131
- Pterodactyl Setup
1132
-
1133
- Installation on Pterodactyl
1115
+ Java Arguments Added in 2.2.3
1134
1116
 
1135
1117
  ```bash
1136
- # Connect to your Pterodactyl server via SSH
1137
- ssh user@your-server.com
1138
-
1139
- # Create directory for your server
1140
- mkdir minecraft-server
1141
- cd minecraft-server
1142
-
1143
- # Install Node.js (if not available)
1144
- curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
1145
- apt install -y nodejs
1146
-
1147
- # Install mc-headless
1148
- npm init -y
1149
- npm install @dimzxzzx07/mc-headless
1150
-
1151
- # Create server script
1152
- cat > index.js << 'EOF'
1153
- const { MinecraftServer } = require('@dimzxzzx07/mc-headless');
1154
-
1155
- const server = new MinecraftServer({
1156
- version: '1.21.11',
1157
- type: 'paper',
1158
- usePortableJava: true,
1159
- memory: {
1160
- init: '2G',
1161
- max: '4G'
1162
- },
1163
- network: {
1164
- port: 25565
1165
- }
1166
- });
1167
-
1168
- server.on('ready', (info) => {
1169
- console.log(`Server ready on port ${info.port}`);
1170
- });
1171
-
1172
- server.start();
1173
- EOF
1174
-
1175
- # Run server
1176
- node index.js
1118
+ # Base memory and GC
1119
+ -Xms4G -Xmx12G
1120
+ -XX:+UseG1GC
1121
+ -XX:MaxGCPauseMillis=50
1122
+ -XX:+UseStringDeduplication
1123
+ -XX:G1MixedGCLiveThresholdPercent=90
1124
+
1125
+ # Network optimizations
1126
+ -Djava.net.preferIPv4Stack=true
1127
+ -Djava.net.tcpFastOpen=true
1128
+ -Djava.net.tcp.nodelay=true
1129
+ -Dnetwork-compression-threshold=64
1130
+
1131
+ # Netty optimizations
1132
+ -Dio.netty.recycler.maxCapacity.default=0
1133
+ -Dio.netty.leakDetectionLevel=disabled
1134
+
1135
+ # Terminal settings (Pterodactyl)
1136
+ -Dterminal.jline=false
1137
+ -Dterminal.ansi=true
1177
1138
  ```
1178
1139
 
1179
- Pterodactyl Environment Variables
1180
-
1181
- MC-Headless automatically detects Pterodactyl and respects these environment variables:
1182
-
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
1140
+ Pterodactyl Memory Safety
1191
1141
 
1192
- ```json
1193
- {
1194
- "name": "MC-Headless",
1195
- "description": "Minecraft Headless Server Manager",
1196
- "docker_images": {
1197
- "node:20": "node:20"
1198
- },
1199
- "startup": "node /home/container/index.js",
1200
- "environment": {
1201
- "SERVER_VERSION": "1.21.11",
1202
- "SERVER_TYPE": "paper",
1203
- "MEMORY_INIT": "2G",
1204
- "MEMORY_MAX": "4G"
1205
- }
1142
+ ```javascript
1143
+ // Automatically applied in Pterodactyl
1144
+ if (isPterodactyl && cgroupMemory > 0) {
1145
+ const safeMem = Math.floor(cgroupMemory * 0.9);
1146
+ memMax = Math.min(memMax, safeMem);
1147
+ // Uses 90% of cgroup limit to prevent OOM killer
1206
1148
  }
1207
1149
  ```
1208
1150
 
1209
1151
  ---
1210
1152
 
1211
- Termux Setup
1212
-
1213
- Install in Termux
1214
-
1215
- ```bash
1216
- # Update packages
1217
- pkg update && pkg upgrade
1218
-
1219
- # Install Node.js
1220
- pkg install nodejs
1221
-
1222
- # Install mc-headless
1223
- npm install -g @dimzxzzx07/mc-headless
1153
+ Troubleshooting
1224
1154
 
1225
- # Create server directory
1226
- mkdir minecraft-server
1227
- cd minecraft-server
1155
+ Common Issues in 2.2.3
1228
1156
 
1229
- # Create server script
1230
- cat > server.js << 'EOF'
1231
- const { MinecraftServer } = require('@dimzxzzx07/mc-headless');
1157
+ Issue Cause Solution
1158
+ plugins/.paper-remapped error Corrupt plugin cache Auto-fixed in v2.2.3
1159
+ Bedrock cannot connect UDP not enabled Ensure port has UDP enabled
1160
+ RAM disk not working /dev/shm not available Check system RAM disk support
1161
+ Plugins not downloading Network issues Auto-retry in v2.2.3
1162
+ High memory usage RAM disk + worlds Reduce viewDistance or disable RAM disk
1163
+ Java update available Older Java Auto-downloads latest
1164
+ Server OOM killed Memory too high Module auto-reduces to 90% of limit
1232
1165
 
1233
- const server = new MinecraftServer({
1234
- platform: 'java',
1235
- version: '1.21.11',
1236
- type: 'paper',
1237
- usePortableJava: true,
1238
- memory: {
1239
- init: '512M',
1240
- max: '2G'
1241
- }
1242
- });
1166
+ RAM Disk Issues
1243
1167
 
1244
- server.start();
1245
- EOF
1168
+ ```bash
1169
+ # Check if RAM disk is mounted
1170
+ df -h /dev/shm
1246
1171
 
1247
- # Run server
1248
- node server.js
1249
- ```
1172
+ # Check RAM disk usage
1173
+ du -sh /dev/shm/minecraft
1250
1174
 
1251
- Termux Optimizations
1175
+ # Manual backup
1176
+ cp -r /dev/shm/minecraft/* /home/minecraft-master/
1252
1177
 
1253
- ```javascript
1254
- const server = new MinecraftServer({
1255
- version: '1.21.11',
1256
- type: 'paper',
1257
- usePortableJava: true,
1258
- memory: {
1259
- init: '512M',
1260
- max: '2G'
1261
- },
1262
- world: {
1263
- viewDistance: 4,
1264
- simulationDistance: 3,
1265
- maxPlayers: 10
1266
- }
1267
- });
1178
+ # Restore from master
1179
+ cp -r /home/minecraft-master/* /dev/shm/minecraft/
1268
1180
  ```
1269
1181
 
1270
- ---
1271
-
1272
- Troubleshooting
1273
-
1274
- Common Issues
1275
-
1276
- Issue Cause Solution
1277
- Java not found Java not installed Enable usePortableJava: true
1278
- ENOSPC: no space left Disk full Free disk space, reduce memory
1279
- Download failed: 302 URL redirect Automatic in v2.2.2
1280
- Port already in use Another server running Change port number
1281
- Plugin corrupt Bad download Delete plugin and restart
1282
- High CPU usage Too many chunks Reduce viewDistance to 4
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
1286
-
1287
- Disk Space Issues
1182
+ Plugin Verification
1288
1183
 
1289
1184
  ```bash
1290
- # Check disk usage
1291
- df -h
1292
-
1293
- # Clean up old Java files
1294
- rm -rf .java/jre-*
1185
+ # List installed plugins
1186
+ ls -la plugins/
1295
1187
 
1296
- # Clean npm cache
1297
- npm cache clean --force
1188
+ # Check plugin sizes (should be >100KB)
1189
+ du -sh plugins/*.jar
1298
1190
 
1299
- # Remove old backups
1300
- rm -rf backups/*
1191
+ # Check for corrupt plugins
1192
+ find plugins -name "*.jar" -size -100k -delete
1301
1193
  ```
1302
1194
 
1303
- Debug Mode
1195
+ Pterodactyl Memory Logs
1304
1196
 
1305
- ```javascript
1306
- const server = new MinecraftServer({
1307
- silentMode: false, // Disable silent mode to see all logs
1308
- statsInterval: 5000 // Update stats every 5 seconds
1309
- });
1310
- ```
1197
+ Look for this line in startup logs:
1311
1198
 
1312
- Logs Location
1313
-
1314
- ```bash
1315
- # Server logs are piped directly to console
1316
- # Check console output for errors
1317
-
1318
- # Java portable logs
1319
- ls -la .java/
1199
+ ```
1200
+ Adjusted memory to 3686MB (90% of cgroup limit)
1320
1201
  ```
1321
1202
 
1203
+ This confirms the module is protecting your server from OOM killer.
1204
+
1322
1205
  ---
1323
1206
 
1324
1207
  Contributing
@@ -1326,7 +1209,7 @@ Contributing
1326
1209
  Development Setup
1327
1210
 
1328
1211
  ```bash
1329
- git clone https://github.com/Dimzxzzx07/mc-headless.git
1212
+ git clone https://github.com/Dimzxzzx07/Minecraft-Server-Integration-Node.js.git
1330
1213
  cd mc-headless
1331
1214
  npm install
1332
1215
  npm run build
@@ -1351,7 +1234,8 @@ mc-headless/
1351
1234
  │ ├── platforms/
1352
1235
  │ │ ├── GeyserBridge.ts
1353
1236
  │ │ ├── ViaVersion.ts
1354
- │ │ └── SkinRestorer.ts
1237
+ │ │ ├── SkinRestorer.ts
1238
+ │ │ └── PluginManager.ts
1355
1239
  │ └── utils/
1356
1240
  │ ├── Logger.ts
1357
1241
  │ ├── FileUtils.ts
@@ -1361,14 +1245,6 @@ mc-headless/
1361
1245
  └── README.md
1362
1246
  ```
1363
1247
 
1364
- Pull Request Process
1365
-
1366
- 1. Fork the repository
1367
- 2. Create feature branch
1368
- 3. Commit changes
1369
- 4. Push to branch
1370
- 5. Open pull request
1371
-
1372
1248
  ---
1373
1249
 
1374
1250
  License