@dimzxzzx07/mc-headless 1.6.0 → 1.7.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
@@ -5,11 +5,12 @@
5
5
  </div>
6
6
 
7
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">
8
+ <img src="https://img.shields.io/badge/Version-1.7.0-2563eb?style=for-the-badge&logo=typescript" alt="Version">
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-17%2B-007396?style=for-the-badge&logo=openjdk" alt="Java">
12
12
  <img src="https://img.shields.io/badge/Termux-Friendly-00A98F?style=for-the-badge&logo=termux" alt="Termux">
13
+ <img src="https://img.shields.io/badge/Stable-1.7.0-brightgreen?style=for-the-badge" alt="Stable">
13
14
  </div>
14
15
 
15
16
  <div align="center">
@@ -29,9 +30,10 @@
29
30
 
30
31
  ---
31
32
 
32
- Table of Contents
33
+ Table of Contents
33
34
 
34
35
  · Overview
36
+ · What's New in 1.7.0
35
37
  · Features
36
38
  · Why MC-Headless?
37
39
  · Installation
@@ -50,7 +52,9 @@
50
52
  · Commands
51
53
  · Player Management
52
54
  · Cross-Play (Geyser)
55
+ · ViaVersion Support
53
56
  · Termux Setup
57
+ · Performance Tuning
54
58
  · Troubleshooting
55
59
  · Contributing
56
60
  · License
@@ -65,6 +69,20 @@ Built specifically for developers, sysadmins, and Minecraft enthusiasts who want
65
69
 
66
70
  ---
67
71
 
72
+ What's New in 1.7.0
73
+
74
+ Version 1.7.0 - March 2026
75
+
76
+ · Stable ViaVersion Integration - Fixed download URLs for ViaVersion 5.7.2, ViaBackwards 5.7.2, and ViaRewind 4.0.15
77
+ · Improved Error Handling - Better validation and retry logic for plugin downloads
78
+ · File Corruption Prevention - Automatic detection and cleanup of corrupt JAR files
79
+ · ZIP Header Verification - Ensures downloaded plugins are valid before loading
80
+ · Performance Optimizations - Reduced CPU usage with optimized view distance defaults
81
+ · Better Memory Management - Aikar's flags now properly configured for all server types
82
+ · Enhanced Logging - More detailed logs for debugging
83
+
84
+ ---
85
+
68
86
  Features
69
87
 
70
88
  Category Features
@@ -76,6 +94,7 @@ Memory Management Custom memory allocation, Aikar's flags optimization
76
94
  Backup System Automatic scheduled backups, manual backup triggers
77
95
  Monitoring Real-time CPU/memory usage, player tracking, server events
78
96
  Cross-play Built-in Geyser & Floodgate support for Bedrock clients
97
+ ViaVersion Built-in ViaVersion, ViaBackwards, ViaRewind support
79
98
  Termux Friendly Optimized for Android/Termux environments
80
99
  Headless Ready No GUI required, perfect for servers and automation
81
100
 
@@ -87,7 +106,7 @@ Before (Manual Setup)
87
106
 
88
107
  ```bash
89
108
  # 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
109
+ wget https://api.papermc.io/v2/projects/paper/versions/1.21.11/builds/69/downloads/paper-1.21.11-69.jar
91
110
 
92
111
  # Accept EULA
93
112
  echo "eula=true" > eula.txt
@@ -97,7 +116,10 @@ echo "server-port=25565" > server.properties
97
116
  echo "max-players=20" >> server.properties
98
117
 
99
118
  # Run server with complex Java flags
100
- java -Xms1G -Xmx4G -XX:+UseG1GC -jar paper-1.20.1-196.jar nogui
119
+ java -Xms2G -Xmx4G -XX:+UseG1GC -jar paper-1.21.11-69.jar nogui
120
+
121
+ # Download plugins manually
122
+ wget https://github.com/ViaVersion/ViaVersion/releases/download/5.7.2/ViaVersion-5.7.2.jar -P plugins/
101
123
 
102
124
  # Monitor manually
103
125
  tail -f logs/latest.log
@@ -105,13 +127,13 @@ tail -f logs/latest.log
105
127
 
106
128
  After (MC-Headless)
107
129
 
108
- ```typescript
130
+ ```javascript
109
131
  const server = new MinecraftServer({
110
- version: '1.20.1',
132
+ version: '1.21.11',
111
133
  type: 'paper',
112
- memory: { init: '1G', max: '4G' },
134
+ memory: { init: '2G', max: '4G' },
113
135
  network: { port: 25565 },
114
- world: { maxPlayers: 20 }
136
+ enableViaVersion: true
115
137
  });
116
138
 
117
139
  server.on('ready', () => console.log('Server ready!'));
@@ -149,34 +171,30 @@ Quick Start
149
171
 
150
172
  Basic Java Server
151
173
 
152
- ```typescript
153
- import { MinecraftServer } from '@dimzxzzx07/mc-headless';
174
+ ```javascript
175
+ const { MinecraftServer } = require('@dimzxzzx07/mc-headless');
154
176
 
155
177
  const server = new MinecraftServer({
156
178
  platform: 'java',
157
- version: '1.20.1',
179
+ version: '1.21.11',
158
180
  type: 'paper',
159
181
  memory: {
160
- init: '1G',
182
+ init: '2G',
161
183
  max: '4G'
162
184
  }
163
185
  });
164
186
 
165
187
  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
- `);
188
+ console.log(`Server is ready on port ${info.port}`);
189
+ console.log(`Version: ${info.version} ${info.type}`);
172
190
  });
173
191
 
174
192
  server.on('player-join', (player) => {
175
- console.log(`Player joined: ${player.name}`);
193
+ console.log(`${player.name} joined the game`);
176
194
  });
177
195
 
178
196
  server.on('player-leave', (name) => {
179
- console.log(`Player left: ${name}`);
197
+ console.log(`${name} left the game`);
180
198
  });
181
199
 
182
200
  server.start().catch(console.error);
@@ -184,12 +202,12 @@ server.start().catch(console.error);
184
202
 
185
203
  Basic Bedrock Server
186
204
 
187
- ```typescript
188
- import { MinecraftServer } from '@dimzxzzx07/mc-headless';
205
+ ```javascript
206
+ const { MinecraftServer } = require('@dimzxzzx07/mc-headless');
189
207
 
190
208
  const server = new MinecraftServer({
191
209
  platform: 'bedrock',
192
- version: '1.20.1',
210
+ version: '1.21.11',
193
211
  network: {
194
212
  port: 19132,
195
213
  motd: 'Bedrock Server'
@@ -199,20 +217,32 @@ const server = new MinecraftServer({
199
217
  server.start();
200
218
  ```
201
219
 
202
- Cross-Play Server (Java + Bedrock)
220
+ Cross-Play Server with ViaVersion
203
221
 
204
- ```typescript
205
- import { MinecraftServer } from '@dimzxzzx07/mc-headless';
222
+ ```javascript
223
+ const { MinecraftServer } = require('@dimzxzzx07/mc-headless');
206
224
 
207
225
  const server = new MinecraftServer({
208
226
  platform: 'all',
209
- version: '1.20.1',
227
+ version: '1.21.11',
210
228
  type: 'paper',
229
+ memory: {
230
+ init: '2G',
231
+ max: '4G'
232
+ },
211
233
  network: {
212
234
  port: 25565,
213
235
  bedrockPort: 19132,
214
236
  motd: 'Cross-Play Server'
215
- }
237
+ },
238
+ enableViaVersion: true,
239
+ enableViaBackwards: true,
240
+ enableViaRewind: true
241
+ });
242
+
243
+ server.on('ready', () => {
244
+ console.log('Server ready with ViaVersion support!');
245
+ console.log('Players from 1.7.x to 1.21.x can join');
216
246
  });
217
247
 
218
248
  server.start();
@@ -224,58 +254,64 @@ Configuration Guide
224
254
 
225
255
  Complete Configuration Example
226
256
 
227
- ```typescript
228
- import { MinecraftServer } from '@dimzxzzx07/mc-headless';
257
+ ```javascript
258
+ const { MinecraftServer } = require('@dimzxzzx07/mc-headless');
229
259
 
230
260
  const server = new MinecraftServer({
231
261
  // 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
262
+ platform: 'all',
263
+ version: '1.21.11',
264
+ type: 'paper',
265
+ autoAcceptEula: true,
236
266
 
237
267
  // Resource Management
238
268
  memory: {
239
- init: '1G', // Initial memory allocation
240
- max: '4G', // Maximum memory allocation
241
- useAikarsFlags: true // Use Aikar's optimized GC flags
269
+ init: '2G',
270
+ max: '4G',
271
+ useAikarsFlags: true
242
272
  },
243
273
 
244
274
  // Network Settings
245
275
  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
276
+ port: 25565,
277
+ bedrockPort: 19132,
278
+ ip: '0.0.0.0',
279
+ onlineMode: false,
280
+ motd: 'Minecraft Server'
251
281
  },
252
282
 
253
283
  // World & Difficulty Settings
254
284
  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
285
+ difficulty: 'normal',
286
+ hardcore: false,
287
+ gamemode: 'survival',
288
+ seed: 'my-secret-seed',
289
+ maxPlayers: 20,
290
+ viewDistance: 8,
291
+ simulationDistance: 4,
292
+ levelName: 'world'
262
293
  },
263
294
 
264
295
  // Folder Management
265
296
  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
297
+ addons: './addons',
298
+ mods: './mods',
299
+ plugins: './plugins',
300
+ world: './world'
270
301
  },
271
302
 
272
303
  // Server Behavior
273
- autoRestart: true, // Auto-restart on crash
304
+ autoRestart: true,
274
305
  backup: {
275
- enabled: true, // Enable automatic backups
276
- interval: '24h', // Backup interval (24h, 12h, 6h, 1h, 30m)
277
- path: './backups' // Backup storage path
278
- }
306
+ enabled: true,
307
+ interval: '24h',
308
+ path: './backups'
309
+ },
310
+
311
+ // ViaVersion Support
312
+ enableViaVersion: true,
313
+ enableViaBackwards: true,
314
+ enableViaRewind: true
279
315
  });
280
316
 
281
317
  await server.start();
@@ -287,15 +323,15 @@ Platform Options
287
323
 
288
324
  Option Type Default Description
289
325
  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
326
+ version string '1.21.11' Minecraft version
327
+ type string 'paper' paper, purpur, vanilla, spigot, forge, fabric
292
328
  autoAcceptEula boolean true Automatically accept Minecraft EULA
293
329
 
294
330
  Memory Options
295
331
 
296
332
  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')
333
+ memory.init string '1G' Initial heap size
334
+ memory.max string '2G' Maximum heap size
299
335
  memory.useAikarsFlags boolean true Use Aikar's optimized GC flags
300
336
 
301
337
  Network Options
@@ -315,7 +351,8 @@ world.hardcore boolean false Enable hardcore mode
315
351
  world.gamemode string 'survival' survival, creative, adventure, spectator
316
352
  world.seed string undefined World generation seed
317
353
  world.maxPlayers number 20 Maximum player count
318
- world.viewDistance number 10 Chunk view distance
354
+ world.viewDistance number 8 Chunk view distance
355
+ world.simulationDistance number 4 Simulation distance
319
356
  world.levelName string 'world' World folder name
320
357
 
321
358
  Folder Options
@@ -330,16 +367,23 @@ Backup Options
330
367
 
331
368
  Option Type Default Description
332
369
  backup.enabled boolean false Enable automatic backups
333
- backup.interval string '24h' Backup interval (24h, 12h, 6h, 1h, 30m)
370
+ backup.interval string '24h' Backup interval
334
371
  backup.path string './backups' Backup storage path
335
372
 
373
+ ViaVersion Options
374
+
375
+ Option Type Default Description
376
+ enableViaVersion boolean false Enable ViaVersion plugin
377
+ enableViaBackwards boolean false Enable ViaBackwards plugin
378
+ enableViaRewind boolean false Enable ViaRewind plugin
379
+
336
380
  ---
337
381
 
338
382
  API Reference
339
383
 
340
384
  MinecraftServer Class
341
385
 
342
- ```typescript
386
+ ```javascript
343
387
  class MinecraftServer extends EventEmitter {
344
388
  constructor(config: Partial<MinecraftConfig>);
345
389
 
@@ -362,21 +406,21 @@ class MinecraftServer extends EventEmitter {
362
406
 
363
407
  ServerInfo Interface
364
408
 
365
- ```typescript
409
+ ```javascript
366
410
  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
411
+ pid: number;
412
+ ip: string;
413
+ port: number;
414
+ bedrockPort?: number;
415
+ version: string;
416
+ type: string;
417
+ platform: string;
418
+ players: number;
419
+ maxPlayers: number;
420
+ uptime: number;
377
421
  memory: {
378
- used: number; // Used memory in MB
379
- max: number; // Max memory in MB
422
+ used: number;
423
+ max: number;
380
424
  };
381
425
  status: 'starting' | 'running' | 'stopping' | 'stopped' | 'crashed';
382
426
  }
@@ -384,13 +428,13 @@ interface ServerInfo {
384
428
 
385
429
  Player Interface
386
430
 
387
- ```typescript
431
+ ```javascript
388
432
  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
433
+ name: string;
434
+ uuid: string;
435
+ ip: string;
436
+ ping: number;
437
+ connectedAt: Date;
394
438
  }
395
439
  ```
396
440
 
@@ -400,12 +444,12 @@ Usage Examples
400
444
 
401
445
  Advanced Server Configuration
402
446
 
403
- ```typescript
404
- import { MinecraftServer } from '@dimzxzzx07/mc-headless';
447
+ ```javascript
448
+ const { MinecraftServer } = require('@dimzxzzx07/mc-headless');
405
449
 
406
450
  const server = new MinecraftServer({
407
451
  platform: 'java',
408
- version: '1.20.1',
452
+ version: '1.21.11',
409
453
  type: 'paper',
410
454
 
411
455
  memory: {
@@ -418,16 +462,15 @@ const server = new MinecraftServer({
418
462
  port: 25565,
419
463
  ip: '0.0.0.0',
420
464
  onlineMode: true,
421
- motd: '§6Premium §cMinecraft §aServer'
465
+ motd: 'Premium Minecraft Server'
422
466
  },
423
467
 
424
468
  world: {
425
469
  difficulty: 'hard',
426
- hardcore: false,
427
470
  gamemode: 'survival',
428
- seed: 'my-epic-seed-123',
429
471
  maxPlayers: 50,
430
- viewDistance: 12,
472
+ viewDistance: 8,
473
+ simulationDistance: 4,
431
474
  levelName: 'survival_world'
432
475
  },
433
476
 
@@ -441,25 +484,22 @@ const server = new MinecraftServer({
441
484
  enabled: true,
442
485
  interval: '12h',
443
486
  path: './backups'
444
- }
487
+ },
488
+
489
+ enableViaVersion: true,
490
+ enableViaBackwards: true,
491
+ enableViaRewind: true
445
492
  });
446
493
 
447
494
  server.on('ready', async (info) => {
448
495
  console.log(`Server PID: ${info.pid}`);
449
496
  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);
497
+ console.log('ViaVersion active - all versions welcome!');
457
498
  });
458
499
 
459
500
  server.on('resource', (info) => {
460
501
  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');
502
+ console.log('High memory usage detected');
463
503
  }
464
504
  });
465
505
 
@@ -468,131 +508,57 @@ server.start();
468
508
 
469
509
  Multiple Servers Manager
470
510
 
471
- ```typescript
472
- import { ServerManager } from '@dimzxzzx07/mc-headless';
511
+ ```javascript
512
+ const { ServerManager } = require('@dimzxzzx07/mc-headless');
473
513
 
474
514
  const manager = new ServerManager();
475
515
 
476
516
  // Create survival server
477
517
  const survival = manager.createServer('survival', {
478
- platform: 'java',
479
- version: '1.20.1',
518
+ version: '1.21.11',
480
519
  type: 'paper',
481
- network: { port: 25565 },
482
- world: { levelName: 'survival' }
520
+ network: { port: 25565 }
483
521
  });
484
522
 
485
523
  // Create creative server
486
524
  const creative = manager.createServer('creative', {
487
- platform: 'java',
488
- version: '1.20.1',
525
+ version: '1.21.11',
489
526
  type: 'paper',
490
527
  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 }
528
+ world: { gamemode: 'creative' }
502
529
  });
503
530
 
504
531
  // Start all servers
505
532
  await manager.startServer('survival');
506
533
  await manager.startServer('creative');
507
- await manager.startServer('bedrock');
508
534
 
509
535
  // Broadcast to all servers
510
536
  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
537
  ```
521
538
 
522
539
  Server Control with Commands
523
540
 
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
-
541
+ ```javascript
581
542
  server.on('ready', () => {
582
- console.log('Backup system active: every 6 hours');
543
+ // Send various commands
544
+ server.sendCommand('say Welcome to the server!');
545
+ server.sendCommand('time set day');
546
+ server.sendCommand('weather clear');
547
+ server.sendCommand('difficulty normal');
548
+
549
+ // OP a player
550
+ server.sendCommand('op Dimzxzzx07');
551
+
552
+ // Save world
553
+ server.sendCommand('save-all');
583
554
  });
584
555
 
585
- // Manual backup
556
+ // Get server stats periodically
586
557
  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
558
+ const info = await server.getInfo();
559
+ console.log(`Players: ${info.players}/${info.maxPlayers}`);
560
+ console.log(`Memory: ${info.memory.used}/${info.memory.max} MB`);
561
+ }, 60000);
596
562
  ```
597
563
 
598
564
  ---
@@ -601,65 +567,40 @@ Server Types
601
567
 
602
568
  Paper (Recommended for Performance)
603
569
 
604
- ```typescript
570
+ ```javascript
605
571
  const server = new MinecraftServer({
606
572
  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
573
+ version: '1.21.11',
574
+ memory: { useAikarsFlags: true }
621
575
  });
622
576
  ```
623
577
 
624
578
  Vanilla (Official Mojang)
625
579
 
626
- ```typescript
580
+ ```javascript
627
581
  const server = new MinecraftServer({
628
582
  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'
583
+ version: '1.21.11'
639
584
  });
640
585
  ```
641
586
 
642
587
  Forge (Modded)
643
588
 
644
- ```typescript
589
+ ```javascript
645
590
  const server = new MinecraftServer({
646
591
  type: 'forge',
647
- version: '1.20.1',
648
- folders: {
649
- mods: './mods' // Place your mods here
650
- }
592
+ version: '1.21.11',
593
+ folders: { mods: './mods' }
651
594
  });
652
595
  ```
653
596
 
654
597
  Fabric (Lightweight Modding)
655
598
 
656
- ```typescript
599
+ ```javascript
657
600
  const server = new MinecraftServer({
658
601
  type: 'fabric',
659
- version: '1.20.1',
660
- folders: {
661
- mods: './mods' // Place your Fabric mods here
662
- }
602
+ version: '1.21.11',
603
+ folders: { mods: './mods' }
663
604
  });
664
605
  ```
665
606
 
@@ -669,45 +610,38 @@ Platform Options
669
610
 
670
611
  Java Edition Only
671
612
 
672
- ```typescript
613
+ ```javascript
673
614
  const server = new MinecraftServer({
674
615
  platform: 'java',
675
- version: '1.20.1',
616
+ version: '1.21.11',
676
617
  type: 'paper',
677
- network: {
678
- port: 25565 // Java port only
679
- }
618
+ network: { port: 25565 }
680
619
  });
681
620
  ```
682
621
 
683
622
  Bedrock Edition Only
684
623
 
685
- ```typescript
624
+ ```javascript
686
625
  const server = new MinecraftServer({
687
626
  platform: 'bedrock',
688
- version: '1.20.1',
689
- network: {
690
- port: 19132 // Bedrock port
691
- },
692
- folders: {
693
- addons: './addons' // Bedrock addons
694
- }
627
+ version: '1.21.11',
628
+ network: { port: 19132 },
629
+ folders: { addons: './addons' }
695
630
  });
696
631
  ```
697
632
 
698
633
  Cross-Play (Java + Bedrock)
699
634
 
700
- ```typescript
635
+ ```javascript
701
636
  const server = new MinecraftServer({
702
637
  platform: 'all',
703
- version: '1.20.1',
638
+ version: '1.21.11',
704
639
  type: 'paper',
705
640
  network: {
706
- port: 25565, // Java port
707
- bedrockPort: 19132 // Bedrock port
641
+ port: 25565,
642
+ bedrockPort: 19132
708
643
  }
709
644
  });
710
- // Automatically installs Geyser & Floodgate
711
645
  ```
712
646
 
713
647
  ---
@@ -716,30 +650,24 @@ Memory Management
716
650
 
717
651
  Basic Memory Configuration
718
652
 
719
- ```typescript
653
+ ```javascript
720
654
  memory: {
721
- init: '1G', // Initial heap size
722
- max: '4G', // Maximum heap size
655
+ init: '2G',
656
+ max: '4G',
723
657
  useAikarsFlags: false
724
658
  }
725
659
  ```
726
660
 
727
661
  Aikar's Flags (Optimized)
728
662
 
729
- ```typescript
663
+ ```javascript
730
664
  memory: {
731
665
  init: '2G',
732
666
  max: '8G',
733
- useAikarsFlags: true // Enables optimized GC flags
667
+ useAikarsFlags: true
734
668
  }
735
669
  ```
736
670
 
737
- Memory Units
738
-
739
- Unit Value
740
- M Megabytes (e.g., '512M')
741
- G Gigabytes (e.g., '2G')
742
-
743
671
  Memory Recommendations
744
672
 
745
673
  Players RAM Init Max
@@ -754,7 +682,7 @@ Network Settings
754
682
 
755
683
  Basic Network
756
684
 
757
- ```typescript
685
+ ```javascript
758
686
  network: {
759
687
  port: 25565,
760
688
  ip: '0.0.0.0',
@@ -763,76 +691,50 @@ network: {
763
691
  }
764
692
  ```
765
693
 
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
694
  Cross-Play Network
778
695
 
779
- ```typescript
696
+ ```javascript
780
697
  network: {
781
- port: 25565, // Java port
782
- bedrockPort: 19132, // Bedrock port
698
+ port: 25565,
699
+ bedrockPort: 19132,
783
700
  ip: '0.0.0.0',
784
- onlineMode: false, // Geyser handles auth
785
- motd: '§bCross-Play §fServer'
701
+ onlineMode: false,
702
+ motd: 'Cross-Play Server'
786
703
  }
787
704
  ```
788
705
 
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
706
  ---
796
707
 
797
708
  World Configuration
798
709
 
799
710
  Basic World
800
711
 
801
- ```typescript
712
+ ```javascript
802
713
  world: {
803
714
  difficulty: 'normal',
804
715
  gamemode: 'survival',
805
716
  maxPlayers: 20,
806
- viewDistance: 10,
717
+ viewDistance: 8,
718
+ simulationDistance: 4,
807
719
  levelName: 'world'
808
720
  }
809
721
  ```
810
722
 
811
723
  Hardcore Mode
812
724
 
813
- ```typescript
725
+ ```javascript
814
726
  world: {
815
727
  difficulty: 'hard',
816
- hardcore: true, // Players get banned on death
728
+ hardcore: true,
817
729
  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
730
+ maxPlayers: 10,
731
+ viewDistance: 6
830
732
  }
831
733
  ```
832
734
 
833
735
  Custom Seed
834
736
 
835
- ```typescript
737
+ ```javascript
836
738
  world: {
837
739
  seed: 'my-amazing-seed-12345',
838
740
  levelName: 'custom_world'
@@ -843,65 +745,34 @@ world: {
843
745
 
844
746
  Folder Structure
845
747
 
846
- Java Server Folders
847
-
848
748
  ```
849
749
  server/
850
750
  ├── plugins/ # Paper/Spigot plugins
851
751
  ├── mods/ # Forge/Fabric mods
752
+ ├── addons/ # Bedrock addons
852
753
  ├── world/ # World data
853
754
  ├── logs/ # Server logs
854
755
  └── backups/ # Backup files
855
756
  ```
856
757
 
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
758
  ---
879
759
 
880
760
  Backup System
881
761
 
882
762
  Enable Automatic Backups
883
763
 
884
- ```typescript
764
+ ```javascript
885
765
  backup: {
886
766
  enabled: true,
887
- interval: '24h', // Daily backup
767
+ interval: '24h',
888
768
  path: './backups'
889
769
  }
890
770
  ```
891
771
 
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
772
  Manual Backup
902
773
 
903
- ```typescript
904
- // Full backup (entire server)
774
+ ```javascript
775
+ // Full backup
905
776
  const fullPath = await server.backup('full');
906
777
 
907
778
  // World only backup
@@ -917,7 +788,7 @@ Event System
917
788
 
918
789
  Server Events
919
790
 
920
- ```typescript
791
+ ```javascript
921
792
  server.on('ready', (info) => {
922
793
  console.log('Server ready at', info.port);
923
794
  });
@@ -927,13 +798,13 @@ server.on('stop', ({ code }) => {
927
798
  });
928
799
 
929
800
  server.on('resource', (info) => {
930
- console.log(`CPU/Memory: ${info.memory.used}/${info.memory.max} MB`);
801
+ console.log(`Memory: ${info.memory.used}/${info.memory.max} MB`);
931
802
  });
932
803
  ```
933
804
 
934
805
  Player Events
935
806
 
936
- ```typescript
807
+ ```javascript
937
808
  server.on('player-join', (player) => {
938
809
  console.log(`${player.name} joined from ${player.ip}`);
939
810
  server.sendCommand(`say Welcome ${player.name}!`);
@@ -950,7 +821,7 @@ Commands
950
821
 
951
822
  Built-in Commands
952
823
 
953
- ```typescript
824
+ ```javascript
954
825
  // Send any Minecraft command
955
826
  server.sendCommand('say Hello world');
956
827
  server.sendCommand('time set day');
@@ -961,7 +832,7 @@ server.sendCommand('gamemode creative @a');
961
832
 
962
833
  Console Commands
963
834
 
964
- ```typescript
835
+ ```javascript
965
836
  // Stop server
966
837
  server.sendCommand('stop');
967
838
 
@@ -973,9 +844,6 @@ server.sendCommand('list');
973
844
 
974
845
  // Ban player
975
846
  server.sendCommand('ban Notch');
976
-
977
- // Whitelist
978
- server.sendCommand('whitelist add Dimzxzzx07');
979
847
  ```
980
848
 
981
849
  ---
@@ -984,22 +852,16 @@ Player Management
984
852
 
985
853
  Get Player List
986
854
 
987
- ```typescript
855
+ ```javascript
988
856
  const players = server.getPlayers();
989
857
  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
- `);
858
+ console.log(`${player.name} - Ping: ${player.ping}ms`);
997
859
  });
998
860
  ```
999
861
 
1000
862
  Player Count
1001
863
 
1002
- ```typescript
864
+ ```javascript
1003
865
  const info = await server.getInfo();
1004
866
  console.log(`Players online: ${info.players}/${info.maxPlayers}`);
1005
867
  ```
@@ -1010,10 +872,10 @@ Cross-Play (Geyser)
1010
872
 
1011
873
  Automatic Setup
1012
874
 
1013
- ```typescript
875
+ ```javascript
1014
876
  const server = new MinecraftServer({
1015
- platform: 'all', // Enables Geyser & Floodgate
1016
- version: '1.20.1',
877
+ platform: 'all',
878
+ version: '1.21.11',
1017
879
  type: 'paper',
1018
880
  network: {
1019
881
  port: 25565,
@@ -1022,17 +884,31 @@ const server = new MinecraftServer({
1022
884
  });
1023
885
  ```
1024
886
 
1025
- Manual Geyser Configuration
887
+ ---
888
+
889
+ ViaVersion Support
1026
890
 
1027
- ```typescript
1028
- import { GeyserBridge } from '@dimzxzzx07/mc-headless';
891
+ Enable All ViaVersion Plugins
1029
892
 
1030
- const geyser = new GeyserBridge();
1031
- await geyser.setup({
1032
- folders: { plugins: './plugins' }
893
+ ```javascript
894
+ const server = new MinecraftServer({
895
+ version: '1.21.11',
896
+ type: 'paper',
897
+ enableViaVersion: true,
898
+ enableViaBackwards: true,
899
+ enableViaRewind: true
1033
900
  });
1034
901
  ```
1035
902
 
903
+ What Each Plugin Does
904
+
905
+ Plugin Function
906
+ ViaVersion Allows newer clients to connect to older servers
907
+ ViaBackwards Allows older clients to connect to newer servers
908
+ ViaRewind Adds support for 1.7.x - 1.8.x clients
909
+
910
+ With ViaVersion enabled, your server can accept connections from Minecraft versions 1.7.x through 1.21.x.
911
+
1036
912
  ---
1037
913
 
1038
914
  Termux Setup
@@ -1052,9 +928,11 @@ pkg install openjdk-17
1052
928
  # Install mc-headless
1053
929
  npm install -g @dimzxzzx07/mc-headless
1054
930
 
1055
- # Create server directory
931
+ # Create server
1056
932
  mkdir minecraft-server
1057
933
  cd minecraft-server
934
+ npm init -y
935
+ npm install @dimzxzzx07/mc-headless
1058
936
 
1059
937
  # Create server script
1060
938
  cat > server.js << 'EOF'
@@ -1062,7 +940,7 @@ const { MinecraftServer } = require('@dimzxzzx07/mc-headless');
1062
940
 
1063
941
  const server = new MinecraftServer({
1064
942
  platform: 'java',
1065
- version: '1.20.1',
943
+ version: '1.21.11',
1066
944
  type: 'paper',
1067
945
  memory: {
1068
946
  init: '512M',
@@ -1070,10 +948,6 @@ const server = new MinecraftServer({
1070
948
  }
1071
949
  });
1072
950
 
1073
- server.on('ready', (info) => {
1074
- console.log(`Server running on port ${info.port}`);
1075
- });
1076
-
1077
951
  server.start();
1078
952
  EOF
1079
953
 
@@ -1081,21 +955,57 @@ EOF
1081
955
  node server.js
1082
956
  ```
1083
957
 
1084
- Termux Optimizations
958
+ ---
959
+
960
+ Performance Tuning
1085
961
 
1086
- ```typescript
962
+ Optimized Configuration for Low CPU
963
+
964
+ ```javascript
1087
965
  const server = new MinecraftServer({
1088
- platform: 'java',
1089
- version: '1.20.1',
966
+ version: '1.21.11',
1090
967
  type: 'paper',
1091
968
  memory: {
1092
- init: '512M', // Lower memory for Termux
1093
- max: '2G',
1094
- useAikarsFlags: false // Disable heavy GC flags
969
+ init: '1G',
970
+ max: '3G',
971
+ useAikarsFlags: true
972
+ },
973
+ world: {
974
+ maxPlayers: 20,
975
+ viewDistance: 6,
976
+ simulationDistance: 4
1095
977
  }
1096
978
  });
1097
979
  ```
1098
980
 
981
+ Paper Configuration (paper-global.yml)
982
+
983
+ ```yaml
984
+ chunk-loading:
985
+ global-max-chunk-load-rate: 100
986
+ global-max-chunk-send-rate: 50
987
+
988
+ entities:
989
+ spawn-limits:
990
+ monster: 15
991
+ creature: 10
992
+ ambient: 5
993
+
994
+ player-auto-save: 6000
995
+ ```
996
+
997
+ Bukkit Configuration (bukkit.yml)
998
+
999
+ ```yaml
1000
+ settings:
1001
+ spawn-limits:
1002
+ monsters: 30
1003
+ animals: 10
1004
+ ticks-per:
1005
+ monster-spawns: 200
1006
+ animal-spawns: 400
1007
+ ```
1008
+
1099
1009
  ---
1100
1010
 
1101
1011
  Troubleshooting
@@ -1107,18 +1017,16 @@ Java not found Java not installed Run pkg install openjdk-17 in Termux
1107
1017
  Port already in use Another server running Change port or kill other process
1108
1018
  Out of memory Insufficient RAM Reduce max memory or add more RAM
1109
1019
  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
1020
+ Plugin corrupt Bad download Delete plugin and restart
1021
+ High CPU usage Too many chunks loaded Reduce view distance
1112
1022
 
1113
1023
  Debug Mode
1114
1024
 
1115
- ```typescript
1025
+ ```javascript
1026
+ // Enable debug logging
1116
1027
  const server = new MinecraftServer({
1117
1028
  // ... config
1118
- });
1119
-
1120
- server.on('resource', (info) => {
1121
- console.log('Debug:', info);
1029
+ debug: true
1122
1030
  });
1123
1031
  ```
1124
1032
 
@@ -1134,7 +1042,6 @@ tail -f logs/mc-headless.log
1134
1042
 
1135
1043
  ---
1136
1044
 
1137
-
1138
1045
  Project Structure
1139
1046
 
1140
1047
  ```
@@ -1150,7 +1057,7 @@ mc-headless/
1150
1057
  │ │ └── ...
1151
1058
  │ ├── platforms/
1152
1059
  │ │ ├── GeyserBridge.ts
1153
- │ │ └── ...
1060
+ │ │ └── ViaVersion.ts
1154
1061
  │ └── utils/
1155
1062
  │ ├── Logger.ts
1156
1063
  │ └── FileUtils.ts
@@ -1158,13 +1065,32 @@ mc-headless/
1158
1065
  ├── examples/
1159
1066
  └── README.md
1160
1067
  ```
1068
+
1161
1069
  ---
1162
1070
 
1163
1071
  License
1164
1072
 
1165
- UNLICENSED - Proprietary software. All rights reserved.
1073
+ MIT License
1074
+
1075
+ Copyright (c) 2026 Dimzxzzx07
1076
+
1077
+ Permission is hereby granted, free of charge, to any person obtaining a copy
1078
+ of this software and associated documentation files (the "Software"), to deal
1079
+ in the Software without restriction, including without limitation the rights
1080
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1081
+ copies of the Software, and to permit persons to whom the Software is
1082
+ furnished to do so, subject to the following conditions:
1083
+
1084
+ The above copyright notice and this permission notice shall be included in all
1085
+ copies or substantial portions of the Software.
1166
1086
 
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.
1087
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1088
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1089
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1090
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1091
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1092
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1093
+ SOFTWARE.
1168
1094
 
1169
1095
  ---
1170
1096