@dimzxzzx07/mc-headless 1.0.0 → 1.2.0

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
@@ -0,0 +1,1186 @@
1
+ @dimzxzzx07/mc-headless
2
+
3
+ <div align="center">
4
+ <img src="https://i.imgur.com/LIQuuPL.jpeg" width="800" alt="Minecraft Headless Server">
5
+ </div>
6
+
7
+ <div align="center">
8
+ <img src="https://img.shields.io/badge/Version-1.0.0-2563eb?style=for-the-badge&logo=typescript" alt="Version">
9
+ <img src="https://img.shields.io/badge/License-UNLICENSED-dc2626?style=for-the-badge&logo=licenses" alt="License">
10
+ <img src="https://img.shields.io/badge/Node-18%2B-339933?style=for-the-badge&logo=nodedotjs" alt="Node">
11
+ <img src="https://img.shields.io/badge/Java-17%2B-007396?style=for-the-badge&logo=openjdk" alt="Java">
12
+ <img src="https://img.shields.io/badge/Termux-Friendly-00A98F?style=for-the-badge&logo=termux" alt="Termux">
13
+ </div>
14
+
15
+ <div align="center">
16
+ <a href="https://t.me/Dimzxzzx07">
17
+ <img src="https://img.shields.io/badge/Telegram-Dimzxzzx07-26A5E4?style=for-the-badge&logo=telegram&logoColor=white" alt="Telegram">
18
+ </a>
19
+ <a href="https://github.com/Dimzxzzz">
20
+ <img src="https://img.shields.io/badge/GitHub-Dimzxzzx07-181717?style=for-the-badge&logo=github&logoColor=white" alt="GitHub">
21
+ </a>
22
+ <a href="#">
23
+ <img src="https://img.shields.io/badge/Documentation-Read-8B5CF6?style=for-the-badge&logo=gitbook&logoColor=white" alt="Documentation">
24
+ </a>
25
+ <a href="#">
26
+ <img src="https://img.shields.io/badge/Download-NPM-CB3837?style=for-the-badge&logo=npm&logoColor=white" alt="NPM">
27
+ </a>
28
+ </div>
29
+
30
+ ---
31
+
32
+ Table of Contents
33
+
34
+ · Overview
35
+ · Features
36
+ · Why MC-Headless?
37
+ · Installation
38
+ · Quick Start
39
+ · Configuration Guide
40
+ · API Reference
41
+ · Usage Examples
42
+ · Server Types
43
+ · Platform Options
44
+ · Memory Management
45
+ · Network Settings
46
+ · World Configuration
47
+ · Folder Structure
48
+ · Backup System
49
+ · Event System
50
+ · Commands
51
+ · Player Management
52
+ · Cross-Play (Geyser)
53
+ · Termux Setup
54
+ · Troubleshooting
55
+ · Contributing
56
+ · License
57
+
58
+ ---
59
+
60
+ Overview
61
+
62
+ MC-Headless is a powerful Node.js library that simplifies running Minecraft servers (Java, Bedrock, or Cross-play) with a clean, promise-based API. No more dealing with complex Java commands, server.properties files, or manual downloads - just simple JavaScript methods.
63
+
64
+ Built specifically for developers, sysadmins, and Minecraft enthusiasts who want to automate server management, run headless servers on VPS/Termux, or integrate Minecraft servers into their applications.
65
+
66
+ ---
67
+
68
+ Features
69
+
70
+ Category Features
71
+ Server Types Paper, Purpur, Vanilla, Spigot, Forge, Fabric
72
+ Platforms Java Edition, Bedrock Edition, Cross-play (Geyser)
73
+ Auto Setup Automatic Java detection, EULA acceptance, server.properties generation
74
+ Downloader Automatic download of server jars from official sources
75
+ Memory Management Custom memory allocation, Aikar's flags optimization
76
+ Backup System Automatic scheduled backups, manual backup triggers
77
+ Monitoring Real-time CPU/memory usage, player tracking, server events
78
+ Cross-play Built-in Geyser & Floodgate support for Bedrock clients
79
+ Termux Friendly Optimized for Android/Termux environments
80
+ Headless Ready No GUI required, perfect for servers and automation
81
+
82
+ ---
83
+
84
+ Why MC-Headless?
85
+
86
+ Before (Manual Setup)
87
+
88
+ ```bash
89
+ # Download server jar
90
+ wget https://api.papermc.io/v2/projects/paper/versions/1.20.1/builds/196/downloads/paper-1.20.1-196.jar
91
+
92
+ # Accept EULA
93
+ echo "eula=true" > eula.txt
94
+
95
+ # Create server.properties
96
+ echo "server-port=25565" > server.properties
97
+ echo "max-players=20" >> server.properties
98
+
99
+ # Run server with complex Java flags
100
+ java -Xms1G -Xmx4G -XX:+UseG1GC -jar paper-1.20.1-196.jar nogui
101
+
102
+ # Monitor manually
103
+ tail -f logs/latest.log
104
+ ```
105
+
106
+ After (MC-Headless)
107
+
108
+ ```typescript
109
+ const server = new MinecraftServer({
110
+ version: '1.20.1',
111
+ type: 'paper',
112
+ memory: { init: '1G', max: '4G' },
113
+ network: { port: 25565 },
114
+ world: { maxPlayers: 20 }
115
+ });
116
+
117
+ server.on('ready', () => console.log('Server ready!'));
118
+ server.on('player-join', (player) => console.log(`${player.name} joined`));
119
+
120
+ await server.start();
121
+ ```
122
+
123
+ ---
124
+
125
+ Installation
126
+
127
+ From NPM
128
+
129
+ ```bash
130
+ # Install as dependency
131
+ npm install @dimzxzzx07/mc-headless
132
+
133
+ # Install globally
134
+ npm install -g @dimzxzzx07/mc-headless
135
+ ```
136
+
137
+ Requirements
138
+
139
+ Requirement Minimum Recommended
140
+ Node.js 18.0.0 20.0.0 or higher
141
+ Java 17 17 or 21
142
+ RAM 2 GB 4 GB or more
143
+ Storage 1 GB 5 GB
144
+ OS Linux, macOS, Windows, Termux Linux (production)
145
+
146
+ ---
147
+
148
+ Quick Start
149
+
150
+ Basic Java Server
151
+
152
+ ```typescript
153
+ import { MinecraftServer } from '@dimzxzzx07/mc-headless';
154
+
155
+ const server = new MinecraftServer({
156
+ platform: 'java',
157
+ version: '1.20.1',
158
+ type: 'paper',
159
+ memory: {
160
+ init: '1G',
161
+ max: '4G'
162
+ }
163
+ });
164
+
165
+ server.on('ready', (info) => {
166
+ console.log(`
167
+ MC Headless - Powered By Dimzxzzx07
168
+ Address: ${info.ip}:${info.port}
169
+ Version: ${info.version} ${info.type}
170
+ Players: 0/${info.maxPlayers}
171
+ `);
172
+ });
173
+
174
+ server.on('player-join', (player) => {
175
+ console.log(`Player joined: ${player.name}`);
176
+ });
177
+
178
+ server.on('player-leave', (name) => {
179
+ console.log(`Player left: ${name}`);
180
+ });
181
+
182
+ server.start().catch(console.error);
183
+ ```
184
+
185
+ Basic Bedrock Server
186
+
187
+ ```typescript
188
+ import { MinecraftServer } from '@dimzxzzx07/mc-headless';
189
+
190
+ const server = new MinecraftServer({
191
+ platform: 'bedrock',
192
+ version: '1.20.1',
193
+ network: {
194
+ port: 19132,
195
+ motd: 'Bedrock Server'
196
+ }
197
+ });
198
+
199
+ server.start();
200
+ ```
201
+
202
+ Cross-Play Server (Java + Bedrock)
203
+
204
+ ```typescript
205
+ import { MinecraftServer } from '@dimzxzzx07/mc-headless';
206
+
207
+ const server = new MinecraftServer({
208
+ platform: 'all',
209
+ version: '1.20.1',
210
+ type: 'paper',
211
+ network: {
212
+ port: 25565,
213
+ bedrockPort: 19132,
214
+ motd: 'Cross-Play Server'
215
+ }
216
+ });
217
+
218
+ server.start();
219
+ ```
220
+
221
+ ---
222
+
223
+ Configuration Guide
224
+
225
+ Complete Configuration Example
226
+
227
+ ```typescript
228
+ import { MinecraftServer } from '@dimzxzzx07/mc-headless';
229
+
230
+ const server = new MinecraftServer({
231
+ // Platform Selection
232
+ platform: 'all', // 'java', 'bedrock', 'all'
233
+ version: '1.20.1', // Minecraft version
234
+ type: 'paper', // paper, purpur, vanilla, spigot, forge, fabric
235
+ autoAcceptEula: true, // Auto-accept Minecraft EULA
236
+
237
+ // Resource Management
238
+ memory: {
239
+ init: '1G', // Initial memory allocation
240
+ max: '4G', // Maximum memory allocation
241
+ useAikarsFlags: true // Use Aikar's optimized GC flags
242
+ },
243
+
244
+ // Network Settings
245
+ network: {
246
+ port: 25565, // Java edition port
247
+ bedrockPort: 19132, // Bedrock edition port (for 'all' platform)
248
+ ip: '0.0.0.0', // Bind IP address
249
+ onlineMode: false, // Enable/disable authentication
250
+ motd: 'Minecraft Server' // Server message of the day
251
+ },
252
+
253
+ // World & Difficulty Settings
254
+ world: {
255
+ difficulty: 'normal', // peaceful, easy, normal, hard
256
+ hardcore: false, // Enable hardcore mode
257
+ gamemode: 'survival', // survival, creative, adventure, spectator
258
+ seed: 'my-secret-seed', // World seed (optional)
259
+ maxPlayers: 20, // Maximum player count
260
+ viewDistance: 10, // Chunk view distance
261
+ levelName: 'world' // World folder name
262
+ },
263
+
264
+ // Folder Management
265
+ folders: {
266
+ addons: './addons', // Bedrock addons folder
267
+ mods: './mods', // Forge/Fabric mods folder
268
+ plugins: './plugins', // Paper/Spigot plugins folder
269
+ world: './world' // World data folder
270
+ },
271
+
272
+ // Server Behavior
273
+ autoRestart: true, // Auto-restart on crash
274
+ backup: {
275
+ enabled: true, // Enable automatic backups
276
+ interval: '24h', // Backup interval (24h, 12h, 6h, 1h, 30m)
277
+ path: './backups' // Backup storage path
278
+ }
279
+ });
280
+
281
+ await server.start();
282
+ ```
283
+
284
+ Configuration Options Reference
285
+
286
+ Platform Options
287
+
288
+ Option Type Default Description
289
+ platform string 'java' 'java', 'bedrock', or 'all'
290
+ version string '1.20.1' Minecraft version (e.g., '1.20.1', '1.19.4')
291
+ type string 'paper' Server type: paper, purpur, vanilla, spigot, forge, fabric
292
+ autoAcceptEula boolean true Automatically accept Minecraft EULA
293
+
294
+ Memory Options
295
+
296
+ Option Type Default Description
297
+ memory.init string '1G' Initial heap size (e.g., '512M', '1G', '2G')
298
+ memory.max string '4G' Maximum heap size (e.g., '2G', '4G', '8G')
299
+ memory.useAikarsFlags boolean true Use Aikar's optimized GC flags
300
+
301
+ Network Options
302
+
303
+ Option Type Default Description
304
+ network.port number 25565 Java edition server port
305
+ network.bedrockPort number 19132 Bedrock edition server port
306
+ network.ip string '0.0.0.0' Bind IP address
307
+ network.onlineMode boolean false Enable Mojang authentication
308
+ network.motd string 'Minecraft Server' Message of the day
309
+
310
+ World Options
311
+
312
+ Option Type Default Description
313
+ world.difficulty string 'normal' peaceful, easy, normal, hard
314
+ world.hardcore boolean false Enable hardcore mode
315
+ world.gamemode string 'survival' survival, creative, adventure, spectator
316
+ world.seed string undefined World generation seed
317
+ world.maxPlayers number 20 Maximum player count
318
+ world.viewDistance number 10 Chunk view distance
319
+ world.levelName string 'world' World folder name
320
+
321
+ Folder Options
322
+
323
+ Option Type Default Description
324
+ folders.addons string './addons' Bedrock addons folder
325
+ folders.mods string './mods' Forge/Fabric mods folder
326
+ folders.plugins string './plugins' Paper/Spigot plugins folder
327
+ folders.world string './world' World data folder
328
+
329
+ Backup Options
330
+
331
+ Option Type Default Description
332
+ backup.enabled boolean false Enable automatic backups
333
+ backup.interval string '24h' Backup interval (24h, 12h, 6h, 1h, 30m)
334
+ backup.path string './backups' Backup storage path
335
+
336
+ ---
337
+
338
+ API Reference
339
+
340
+ MinecraftServer Class
341
+
342
+ ```typescript
343
+ class MinecraftServer extends EventEmitter {
344
+ constructor(config: Partial<MinecraftConfig>);
345
+
346
+ // Methods
347
+ async start(): Promise<ServerInfo>;
348
+ async stop(): Promise<void>;
349
+ sendCommand(command: string): void;
350
+ async getInfo(): Promise<ServerInfo>;
351
+ getPlayers(): Player[];
352
+ async backup(type?: 'full' | 'world' | 'plugins'): Promise<string>;
353
+
354
+ // Events
355
+ on(event: 'ready', listener: (info: ServerInfo) => void): this;
356
+ on(event: 'stop', listener: (data: { code: number }) => void): this;
357
+ on(event: 'player-join', listener: (player: Player) => void): this;
358
+ on(event: 'player-leave', listener: (name: string) => void): this;
359
+ on(event: 'resource', listener: (info: ServerInfo) => void): this;
360
+ }
361
+ ```
362
+
363
+ ServerInfo Interface
364
+
365
+ ```typescript
366
+ interface ServerInfo {
367
+ pid: number; // Process ID
368
+ ip: string; // Server IP
369
+ port: number; // Server port
370
+ bedrockPort?: number; // Bedrock port (if enabled)
371
+ version: string; // Minecraft version
372
+ type: ServerType; // Server type
373
+ platform: Platform; // Platform (java/bedrock/all)
374
+ players: number; // Current players
375
+ maxPlayers: number; // Max players
376
+ uptime: number; // Uptime in seconds
377
+ memory: {
378
+ used: number; // Used memory in MB
379
+ max: number; // Max memory in MB
380
+ };
381
+ status: 'starting' | 'running' | 'stopping' | 'stopped' | 'crashed';
382
+ }
383
+ ```
384
+
385
+ Player Interface
386
+
387
+ ```typescript
388
+ interface Player {
389
+ name: string; // Player username
390
+ uuid: string; // Player UUID
391
+ ip: string; // Player IP address
392
+ ping: number; // Player ping in ms
393
+ connectedAt: Date; // Connection time
394
+ }
395
+ ```
396
+
397
+ ---
398
+
399
+ Usage Examples
400
+
401
+ Advanced Server Configuration
402
+
403
+ ```typescript
404
+ import { MinecraftServer } from '@dimzxzzx07/mc-headless';
405
+
406
+ const server = new MinecraftServer({
407
+ platform: 'java',
408
+ version: '1.20.1',
409
+ type: 'paper',
410
+
411
+ memory: {
412
+ init: '2G',
413
+ max: '8G',
414
+ useAikarsFlags: true
415
+ },
416
+
417
+ network: {
418
+ port: 25565,
419
+ ip: '0.0.0.0',
420
+ onlineMode: true,
421
+ motd: '§6Premium §cMinecraft §aServer'
422
+ },
423
+
424
+ world: {
425
+ difficulty: 'hard',
426
+ hardcore: false,
427
+ gamemode: 'survival',
428
+ seed: 'my-epic-seed-123',
429
+ maxPlayers: 50,
430
+ viewDistance: 12,
431
+ levelName: 'survival_world'
432
+ },
433
+
434
+ folders: {
435
+ plugins: './plugins',
436
+ world: './survival_world'
437
+ },
438
+
439
+ autoRestart: true,
440
+ backup: {
441
+ enabled: true,
442
+ interval: '12h',
443
+ path: './backups'
444
+ }
445
+ });
446
+
447
+ server.on('ready', async (info) => {
448
+ console.log(`Server PID: ${info.pid}`);
449
+ console.log(`Memory: ${info.memory.used}/${info.memory.max} MB`);
450
+
451
+ // Schedule daily restart
452
+ setInterval(() => {
453
+ console.log('Scheduled restart...');
454
+ server.sendCommand('say Server restarting in 1 minute');
455
+ setTimeout(() => server.stop(), 60000);
456
+ }, 24 * 60 * 60 * 1000);
457
+ });
458
+
459
+ server.on('resource', (info) => {
460
+ if (info.memory.used > info.memory.max * 0.9) {
461
+ console.log('High memory usage, warning players...');
462
+ server.sendCommand('say Memory usage is high, please restart soon');
463
+ }
464
+ });
465
+
466
+ server.start();
467
+ ```
468
+
469
+ Multiple Servers Manager
470
+
471
+ ```typescript
472
+ import { ServerManager } from '@dimzxzzx07/mc-headless';
473
+
474
+ const manager = new ServerManager();
475
+
476
+ // Create survival server
477
+ const survival = manager.createServer('survival', {
478
+ platform: 'java',
479
+ version: '1.20.1',
480
+ type: 'paper',
481
+ network: { port: 25565 },
482
+ world: { levelName: 'survival' }
483
+ });
484
+
485
+ // Create creative server
486
+ const creative = manager.createServer('creative', {
487
+ platform: 'java',
488
+ version: '1.20.1',
489
+ type: 'paper',
490
+ network: { port: 25566 },
491
+ world: {
492
+ gamemode: 'creative',
493
+ levelName: 'creative'
494
+ }
495
+ });
496
+
497
+ // Create Bedrock server
498
+ const bedrock = manager.createServer('bedrock', {
499
+ platform: 'bedrock',
500
+ version: '1.20.1',
501
+ network: { port: 19132 }
502
+ });
503
+
504
+ // Start all servers
505
+ await manager.startServer('survival');
506
+ await manager.startServer('creative');
507
+ await manager.startServer('bedrock');
508
+
509
+ // Broadcast to all servers
510
+ await manager.broadcastCommand('say Server is running!');
511
+
512
+ // Backup all servers
513
+ await manager.backupAll('world');
514
+
515
+ // Stop all servers on exit
516
+ process.on('SIGINT', async () => {
517
+ await manager.stopAll();
518
+ process.exit();
519
+ });
520
+ ```
521
+
522
+ Server Control with Commands
523
+
524
+ ```typescript
525
+ import { MinecraftServer } from '@dimzxzzx07/mc-headless';
526
+
527
+ const server = new MinecraftServer({
528
+ version: '1.20.1',
529
+ type: 'paper'
530
+ });
531
+
532
+ await server.start();
533
+
534
+ // Send various commands
535
+ server.sendCommand('say Welcome to the server!');
536
+ server.sendCommand('time set day');
537
+ server.sendCommand('weather clear');
538
+ server.sendCommand('difficulty normal');
539
+ server.sendCommand('gamemode survival @a');
540
+
541
+ // OP a player
542
+ server.sendCommand('op Notch');
543
+
544
+ // Give items
545
+ server.sendCommand('give @a minecraft:diamond 1');
546
+
547
+ // Teleport
548
+ server.sendCommand('tp Dimzxzzx07 100 64 100');
549
+
550
+ // Set world spawn
551
+ server.sendCommand('setworldspawn 0 64 0');
552
+
553
+ // Save world
554
+ server.sendCommand('save-all');
555
+
556
+ // List players
557
+ server.sendCommand('list');
558
+
559
+ // Get server stats
560
+ const info = await server.getInfo();
561
+ console.log(`Uptime: ${info.uptime}s`);
562
+ console.log(`Players: ${info.players}/${info.maxPlayers}`);
563
+ console.log(`Memory: ${info.memory.used}/${info.memory.max} MB`);
564
+ ```
565
+
566
+ Automatic Backup System
567
+
568
+ ```typescript
569
+ import { MinecraftServer } from '@dimzxzzx07/mc-headless';
570
+
571
+ const server = new MinecraftServer({
572
+ version: '1.20.1',
573
+ type: 'paper',
574
+ backup: {
575
+ enabled: true,
576
+ interval: '6h',
577
+ path: './backups'
578
+ }
579
+ });
580
+
581
+ server.on('ready', () => {
582
+ console.log('Backup system active: every 6 hours');
583
+ });
584
+
585
+ // Manual backup
586
+ setInterval(async () => {
587
+ console.log('Creating manual backup...');
588
+ const backupPath = await server.backup('full');
589
+ console.log(`Backup saved to: ${backupPath}`);
590
+
591
+ // Check backup size
592
+ const fs = require('fs-extra');
593
+ const stats = await fs.stat(backupPath);
594
+ console.log(`Backup size: ${stats.size / 1024 / 1024} MB`);
595
+ }, 24 * 60 * 60 * 1000); // Daily backup
596
+ ```
597
+
598
+ ---
599
+
600
+ Server Types
601
+
602
+ Paper (Recommended for Performance)
603
+
604
+ ```typescript
605
+ const server = new MinecraftServer({
606
+ type: 'paper',
607
+ version: '1.20.1',
608
+ memory: {
609
+ useAikarsFlags: true // Optimized for Paper
610
+ }
611
+ });
612
+ ```
613
+
614
+ Purpur (Most Features)
615
+
616
+ ```typescript
617
+ const server = new MinecraftServer({
618
+ type: 'purpur',
619
+ version: '1.20.1'
620
+ // Purpur has additional configuration options
621
+ });
622
+ ```
623
+
624
+ Vanilla (Official Mojang)
625
+
626
+ ```typescript
627
+ const server = new MinecraftServer({
628
+ type: 'vanilla',
629
+ version: '1.20.1'
630
+ });
631
+ ```
632
+
633
+ Spigot (Bukkit Compatible)
634
+
635
+ ```typescript
636
+ const server = new MinecraftServer({
637
+ type: 'spigot',
638
+ version: '1.20.1'
639
+ });
640
+ ```
641
+
642
+ Forge (Modded)
643
+
644
+ ```typescript
645
+ const server = new MinecraftServer({
646
+ type: 'forge',
647
+ version: '1.20.1',
648
+ folders: {
649
+ mods: './mods' // Place your mods here
650
+ }
651
+ });
652
+ ```
653
+
654
+ Fabric (Lightweight Modding)
655
+
656
+ ```typescript
657
+ const server = new MinecraftServer({
658
+ type: 'fabric',
659
+ version: '1.20.1',
660
+ folders: {
661
+ mods: './mods' // Place your Fabric mods here
662
+ }
663
+ });
664
+ ```
665
+
666
+ ---
667
+
668
+ Platform Options
669
+
670
+ Java Edition Only
671
+
672
+ ```typescript
673
+ const server = new MinecraftServer({
674
+ platform: 'java',
675
+ version: '1.20.1',
676
+ type: 'paper',
677
+ network: {
678
+ port: 25565 // Java port only
679
+ }
680
+ });
681
+ ```
682
+
683
+ Bedrock Edition Only
684
+
685
+ ```typescript
686
+ const server = new MinecraftServer({
687
+ platform: 'bedrock',
688
+ version: '1.20.1',
689
+ network: {
690
+ port: 19132 // Bedrock port
691
+ },
692
+ folders: {
693
+ addons: './addons' // Bedrock addons
694
+ }
695
+ });
696
+ ```
697
+
698
+ Cross-Play (Java + Bedrock)
699
+
700
+ ```typescript
701
+ const server = new MinecraftServer({
702
+ platform: 'all',
703
+ version: '1.20.1',
704
+ type: 'paper',
705
+ network: {
706
+ port: 25565, // Java port
707
+ bedrockPort: 19132 // Bedrock port
708
+ }
709
+ });
710
+ // Automatically installs Geyser & Floodgate
711
+ ```
712
+
713
+ ---
714
+
715
+ Memory Management
716
+
717
+ Basic Memory Configuration
718
+
719
+ ```typescript
720
+ memory: {
721
+ init: '1G', // Initial heap size
722
+ max: '4G', // Maximum heap size
723
+ useAikarsFlags: false
724
+ }
725
+ ```
726
+
727
+ Aikar's Flags (Optimized)
728
+
729
+ ```typescript
730
+ memory: {
731
+ init: '2G',
732
+ max: '8G',
733
+ useAikarsFlags: true // Enables optimized GC flags
734
+ }
735
+ ```
736
+
737
+ Memory Units
738
+
739
+ Unit Value
740
+ M Megabytes (e.g., '512M')
741
+ G Gigabytes (e.g., '2G')
742
+
743
+ Memory Recommendations
744
+
745
+ Players RAM Init Max
746
+ 1-10 2 GB 1G 2G
747
+ 10-20 4 GB 2G 4G
748
+ 20-50 8 GB 4G 8G
749
+ 50-100 16 GB 8G 16G
750
+
751
+ ---
752
+
753
+ Network Settings
754
+
755
+ Basic Network
756
+
757
+ ```typescript
758
+ network: {
759
+ port: 25565,
760
+ ip: '0.0.0.0',
761
+ onlineMode: false,
762
+ motd: 'My Server'
763
+ }
764
+ ```
765
+
766
+ Public Server with Authentication
767
+
768
+ ```typescript
769
+ network: {
770
+ port: 25565,
771
+ ip: '0.0.0.0',
772
+ onlineMode: true, // Requires Mojang authentication
773
+ motd: '§6Official §cMinecraft §aServer'
774
+ }
775
+ ```
776
+
777
+ Cross-Play Network
778
+
779
+ ```typescript
780
+ network: {
781
+ port: 25565, // Java port
782
+ bedrockPort: 19132, // Bedrock port
783
+ ip: '0.0.0.0',
784
+ onlineMode: false, // Geyser handles auth
785
+ motd: '§bCross-Play §fServer'
786
+ }
787
+ ```
788
+
789
+ Port Forwarding Guide
790
+
791
+ 1. Local Network: Use 192.168.x.x IP
792
+ 2. Public Server: Use 0.0.0.0 and configure router
793
+ 3. Cloud/VPS: Use public IP or domain
794
+
795
+ ---
796
+
797
+ World Configuration
798
+
799
+ Basic World
800
+
801
+ ```typescript
802
+ world: {
803
+ difficulty: 'normal',
804
+ gamemode: 'survival',
805
+ maxPlayers: 20,
806
+ viewDistance: 10,
807
+ levelName: 'world'
808
+ }
809
+ ```
810
+
811
+ Hardcore Mode
812
+
813
+ ```typescript
814
+ world: {
815
+ difficulty: 'hard',
816
+ hardcore: true, // Players get banned on death
817
+ gamemode: 'survival',
818
+ maxPlayers: 10
819
+ }
820
+ ```
821
+
822
+ Creative Server
823
+
824
+ ```typescript
825
+ world: {
826
+ difficulty: 'peaceful',
827
+ gamemode: 'creative',
828
+ maxPlayers: 50,
829
+ viewDistance: 16
830
+ }
831
+ ```
832
+
833
+ Custom Seed
834
+
835
+ ```typescript
836
+ world: {
837
+ seed: 'my-amazing-seed-12345',
838
+ levelName: 'custom_world'
839
+ }
840
+ ```
841
+
842
+ ---
843
+
844
+ Folder Structure
845
+
846
+ Java Server Folders
847
+
848
+ ```
849
+ server/
850
+ ├── plugins/ # Paper/Spigot plugins
851
+ ├── mods/ # Forge/Fabric mods
852
+ ├── world/ # World data
853
+ ├── logs/ # Server logs
854
+ └── backups/ # Backup files
855
+ ```
856
+
857
+ Bedrock Server Folders
858
+
859
+ ```
860
+ server/
861
+ ├── addons/ # Bedrock behavior packs
862
+ ├── world/ # World data
863
+ ├── logs/ # Server logs
864
+ └── backups/ # Backup files
865
+ ```
866
+
867
+ Custom Folder Configuration
868
+
869
+ ```typescript
870
+ folders: {
871
+ addons: './custom_addons',
872
+ mods: './custom_mods',
873
+ plugins: './custom_plugins',
874
+ world: './custom_world'
875
+ }
876
+ ```
877
+
878
+ ---
879
+
880
+ Backup System
881
+
882
+ Enable Automatic Backups
883
+
884
+ ```typescript
885
+ backup: {
886
+ enabled: true,
887
+ interval: '24h', // Daily backup
888
+ path: './backups'
889
+ }
890
+ ```
891
+
892
+ Backup Intervals
893
+
894
+ Interval Cron Equivalent Description
895
+ '24h' 0 */24 * * * Every 24 hours
896
+ '12h' 0 */12 * * * Every 12 hours
897
+ '6h' 0 */6 * * * Every 6 hours
898
+ '1h' 0 * * * * Every hour
899
+ '30m' */30 * * * * Every 30 minutes
900
+
901
+ Manual Backup
902
+
903
+ ```typescript
904
+ // Full backup (entire server)
905
+ const fullPath = await server.backup('full');
906
+
907
+ // World only backup
908
+ const worldPath = await server.backup('world');
909
+
910
+ // Plugins only backup
911
+ const pluginsPath = await server.backup('plugins');
912
+ ```
913
+
914
+ ---
915
+
916
+ Event System
917
+
918
+ Server Events
919
+
920
+ ```typescript
921
+ server.on('ready', (info) => {
922
+ console.log('Server ready at', info.port);
923
+ });
924
+
925
+ server.on('stop', ({ code }) => {
926
+ console.log('Server stopped with code', code);
927
+ });
928
+
929
+ server.on('resource', (info) => {
930
+ console.log(`CPU/Memory: ${info.memory.used}/${info.memory.max} MB`);
931
+ });
932
+ ```
933
+
934
+ Player Events
935
+
936
+ ```typescript
937
+ server.on('player-join', (player) => {
938
+ console.log(`${player.name} joined from ${player.ip}`);
939
+ server.sendCommand(`say Welcome ${player.name}!`);
940
+ });
941
+
942
+ server.on('player-leave', (name) => {
943
+ console.log(`${name} left the game`);
944
+ });
945
+ ```
946
+
947
+ ---
948
+
949
+ Commands
950
+
951
+ Built-in Commands
952
+
953
+ ```typescript
954
+ // Send any Minecraft command
955
+ server.sendCommand('say Hello world');
956
+ server.sendCommand('time set day');
957
+ server.sendCommand('weather clear');
958
+ server.sendCommand('difficulty hard');
959
+ server.sendCommand('gamemode creative @a');
960
+ ```
961
+
962
+ Console Commands
963
+
964
+ ```typescript
965
+ // Stop server
966
+ server.sendCommand('stop');
967
+
968
+ // Save world
969
+ server.sendCommand('save-all');
970
+
971
+ // List players
972
+ server.sendCommand('list');
973
+
974
+ // Ban player
975
+ server.sendCommand('ban Notch');
976
+
977
+ // Whitelist
978
+ server.sendCommand('whitelist add Dimzxzzx07');
979
+ ```
980
+
981
+ ---
982
+
983
+ Player Management
984
+
985
+ Get Player List
986
+
987
+ ```typescript
988
+ const players = server.getPlayers();
989
+ players.forEach(player => {
990
+ console.log(`
991
+ Name: ${player.name}
992
+ UUID: ${player.uuid}
993
+ IP: ${player.ip}
994
+ Ping: ${player.ping}ms
995
+ Connected: ${player.connectedAt}
996
+ `);
997
+ });
998
+ ```
999
+
1000
+ Player Count
1001
+
1002
+ ```typescript
1003
+ const info = await server.getInfo();
1004
+ console.log(`Players online: ${info.players}/${info.maxPlayers}`);
1005
+ ```
1006
+
1007
+ ---
1008
+
1009
+ Cross-Play (Geyser)
1010
+
1011
+ Automatic Setup
1012
+
1013
+ ```typescript
1014
+ const server = new MinecraftServer({
1015
+ platform: 'all', // Enables Geyser & Floodgate
1016
+ version: '1.20.1',
1017
+ type: 'paper',
1018
+ network: {
1019
+ port: 25565,
1020
+ bedrockPort: 19132
1021
+ }
1022
+ });
1023
+ ```
1024
+
1025
+ Manual Geyser Configuration
1026
+
1027
+ ```typescript
1028
+ import { GeyserBridge } from '@dimzxzzx07/mc-headless';
1029
+
1030
+ const geyser = new GeyserBridge();
1031
+ await geyser.setup({
1032
+ folders: { plugins: './plugins' }
1033
+ });
1034
+ ```
1035
+
1036
+ ---
1037
+
1038
+ Termux Setup
1039
+
1040
+ Install in Termux
1041
+
1042
+ ```bash
1043
+ # Update packages
1044
+ pkg update && pkg upgrade
1045
+
1046
+ # Install Node.js
1047
+ pkg install nodejs
1048
+
1049
+ # Install Java
1050
+ pkg install openjdk-17
1051
+
1052
+ # Install mc-headless
1053
+ npm install -g @dimzxzzx07/mc-headless
1054
+
1055
+ # Create server directory
1056
+ mkdir minecraft-server
1057
+ cd minecraft-server
1058
+
1059
+ # Create server script
1060
+ cat > server.js << 'EOF'
1061
+ const { MinecraftServer } = require('@dimzxzzx07/mc-headless');
1062
+
1063
+ const server = new MinecraftServer({
1064
+ platform: 'java',
1065
+ version: '1.20.1',
1066
+ type: 'paper',
1067
+ memory: {
1068
+ init: '512M',
1069
+ max: '2G'
1070
+ }
1071
+ });
1072
+
1073
+ server.on('ready', (info) => {
1074
+ console.log(`Server running on port ${info.port}`);
1075
+ });
1076
+
1077
+ server.start();
1078
+ EOF
1079
+
1080
+ # Run server
1081
+ node server.js
1082
+ ```
1083
+
1084
+ Termux Optimizations
1085
+
1086
+ ```typescript
1087
+ const server = new MinecraftServer({
1088
+ platform: 'java',
1089
+ version: '1.20.1',
1090
+ type: 'paper',
1091
+ memory: {
1092
+ init: '512M', // Lower memory for Termux
1093
+ max: '2G',
1094
+ useAikarsFlags: false // Disable heavy GC flags
1095
+ }
1096
+ });
1097
+ ```
1098
+
1099
+ ---
1100
+
1101
+ Troubleshooting
1102
+
1103
+ Common Issues
1104
+
1105
+ Issue Cause Solution
1106
+ Java not found Java not installed Run pkg install openjdk-17 in Termux
1107
+ Port already in use Another server running Change port or kill other process
1108
+ Out of memory Insufficient RAM Reduce max memory or add more RAM
1109
+ Connection refused Firewall blocking Check firewall settings
1110
+ EULA not accepted autoAcceptEula: false Set to true or accept manually
1111
+ Server crash on start Wrong Java version Install Java 17
1112
+
1113
+ Debug Mode
1114
+
1115
+ ```typescript
1116
+ const server = new MinecraftServer({
1117
+ // ... config
1118
+ });
1119
+
1120
+ server.on('resource', (info) => {
1121
+ console.log('Debug:', info);
1122
+ });
1123
+ ```
1124
+
1125
+ Logs Location
1126
+
1127
+ ```bash
1128
+ # Server logs
1129
+ tail -f logs/latest.log
1130
+
1131
+ # MC-Headless logs
1132
+ tail -f logs/mc-headless.log
1133
+ ```
1134
+
1135
+ ---
1136
+
1137
+
1138
+ Project Structure
1139
+
1140
+ ```
1141
+ mc-headless/
1142
+ ├── src/
1143
+ │ ├── core/
1144
+ │ │ ├── MinecraftServer.ts
1145
+ │ │ ├── ConfigHandler.ts
1146
+ │ │ └── JavaChecker.ts
1147
+ │ ├── engines/
1148
+ │ │ ├── PaperEngine.ts
1149
+ │ │ ├── VanillaEngine.ts
1150
+ │ │ └── ...
1151
+ │ ├── platforms/
1152
+ │ │ ├── GeyserBridge.ts
1153
+ │ │ └── ...
1154
+ │ └── utils/
1155
+ │ ├── Logger.ts
1156
+ │ └── FileUtils.ts
1157
+ ├── tests/
1158
+ ├── examples/
1159
+ └── README.md
1160
+ ```
1161
+ ---
1162
+
1163
+ License
1164
+
1165
+ UNLICENSED - Proprietary software. All rights reserved.
1166
+
1167
+ This software and its source code are the exclusive property of Dimzxzzx07. Unauthorized copying, modification, distribution, or use of this software is strictly prohibited without express written permission.
1168
+
1169
+ ---
1170
+
1171
+ <div align="center">
1172
+ <img src="https://i.imgur.com/aPSNrKE.png" alt="Dimzxzzx07 Logo" width="200">
1173
+ <br>
1174
+ <strong>Powered By Dimzxzzx07</strong>
1175
+ <br>
1176
+ <br>
1177
+ <a href="https://t.me/Dimzxzzx07">
1178
+ <img src="https://img.shields.io/badge/Telegram-Contact-26A5E4?style=for-the-badge&logo=telegram" alt="Telegram">
1179
+ </a>
1180
+ <a href="https://github.com/Dimzxzzz">
1181
+ <img src="https://img.shields.io/badge/GitHub-Follow-181717?style=for-the-badge&logo=github" alt="GitHub">
1182
+ </a>
1183
+ <br>
1184
+ <br>
1185
+ <small>Copyright © 2026 Dimzxzzx07. All rights reserved.</small>
1186
+ </div>