smodusermc commited on
Commit
d0d82e1
·
verified ·
1 Parent(s): fa6c68c

Update start.sh

Browse files
Files changed (1) hide show
  1. start.sh +111 -135
start.sh CHANGED
@@ -27,14 +27,16 @@ CPU_CORES=$(nproc 2>/dev/null || echo 2)
27
  NETTY_THREADS=4
28
 
29
  TOTAL_MEM_MB=$(free -m | awk '/^Mem:/{print $2}')
30
- BUNGEE_MAX_MB=1024
31
- PAPER_MAX_MB=$(( TOTAL_MEM_MB - BUNGEE_MAX_MB - 768 ))
32
- [ "$PAPER_MAX_MB" -gt 8192 ] && PAPER_MAX_MB=8192
33
  [ "$PAPER_MAX_MB" -lt 1024 ] && PAPER_MAX_MB=1024
34
- PAPER_MIN_MB=8192
 
 
35
 
36
  echo "========================================"
37
- echo " Eaglercraft 1.8.8 PVP Server"
38
  echo " WindSpigot + HuggingFace Buckets"
39
  echo "========================================"
40
  echo ""
@@ -43,27 +45,26 @@ echo " Server: ${PAPER_MIN_MB}-${PAPER_MAX_MB}MB | Bungee: ${BUNGEE_MAX_MB}MB"
43
  echo " Java: $($JAVA -version 2>&1 | head -1)"
44
  echo " Bucket: $HF_BUCKET_HANDLE"
45
  [ -n "$OP_USERNAME" ] && echo " OP Account: $OP_USERNAME"
46
- echo " Plugins synced: WorldEdit, WorldGuard, MineResetLite, Shopkeepers, SafeTrade, Skript, PvPManager"
47
  echo ""
48
 
49
  # =============================================
50
- # JVM FLAGS
51
  # =============================================
52
  PAPER_JVM_FLAGS=(
53
  -Xmx${PAPER_MAX_MB}M
54
  -Xms${PAPER_MIN_MB}M
55
  -XX:+UseG1GC
56
  -XX:+ParallelRefProcEnabled
57
- -XX:MaxGCPauseMillis=25
58
  -XX:+UnlockExperimentalVMOptions
59
  -XX:+DisableExplicitGC
60
- -XX:G1NewSizePercent=40
61
- -XX:G1MaxNewSizePercent=50
62
  -XX:G1HeapRegionSize=8M
63
- -XX:G1ReservePercent=15
64
- -XX:G1HeapWastePercent=10
65
- -XX:G1MixedGCCountTarget=8
66
- -XX:InitiatingHeapOccupancyPercent=60
67
  -XX:G1MixedGCLiveThresholdPercent=90
68
  -XX:G1RSetUpdatingPauseTimePercent=5
69
  -XX:SurvivorRatio=32
@@ -71,21 +72,16 @@ PAPER_JVM_FLAGS=(
71
  -XX:MaxTenuringThreshold=1
72
  -XX:+OptimizeStringConcat
73
  -XX:+UseCompressedOops
74
- -XX:MaxMetaspaceSize=256M
75
- -XX:CompressedClassSpaceSize=128M
76
- -XX:ReservedCodeCacheSize=128M
77
- -XX:-UseCodeCacheFlushing
78
  -Xss256k
79
  -Djline.terminal=jline.UnsupportedTerminal
80
- -Dio.netty.allocator.maxCachedBufferCapacity=524288
81
  -Dio.netty.recycler.maxCapacityPerThread=0
82
  -Dio.netty.eventLoopThreads=${NETTY_THREADS}
83
- -Dio.netty.allocator.numDirectArenas=${NETTY_THREADS}
84
- -Dio.netty.allocator.numHeapArenas=${NETTY_THREADS}
85
  -Dcom.mojang.eula.agree=true
86
  -DIReallyKnowWhatIAmDoingISwear
87
- -Dusing.aikars.flags=https://mcflags.emc.gs
88
- -Daikars.new.flags=true
89
  )
90
 
91
  BUNGEE_JVM_FLAGS=(
@@ -93,25 +89,22 @@ BUNGEE_JVM_FLAGS=(
93
  -Xms128M
94
  -XX:+UseG1GC
95
  -XX:+ParallelRefProcEnabled
96
- -XX:MaxGCPauseMillis=30
97
  -XX:+UnlockExperimentalVMOptions
98
  -XX:+DisableExplicitGC
99
  -XX:+PerfDisableSharedMem
100
  -XX:+OptimizeStringConcat
101
  -XX:+UseCompressedOops
102
- -XX:MaxMetaspaceSize=128M
103
- -XX:ReservedCodeCacheSize=64M
104
  -Xss256k
105
- -Dio.netty.allocator.maxCachedBufferCapacity=524288
106
  -Dio.netty.recycler.maxCapacityPerThread=0
107
  -Dio.netty.eventLoopThreads=${NETTY_THREADS}
108
- -Dio.netty.allocator.numDirectArenas=${NETTY_THREADS}
109
- -Dio.netty.allocator.numHeapArenas=${NETTY_THREADS}
110
  -Deaglerxbungee.stfu=true
111
  )
112
 
113
  # =============================================================
114
- # RCON — each command sent individually to avoid mangling
115
  # =============================================================
116
  RCON_PASS="chunkystart"
117
 
@@ -162,44 +155,29 @@ setup_op_account() {
162
  ]
163
  OPEOF
164
  echo " ops.json written (level 4, UUID: ${V3_UUID})"
165
-
166
- mc_command "op ${OP_USERNAME}"
167
- echo " RCON op command sent"
168
  }
169
 
170
  # =============================================================
171
- # IDLE MODE — safe version that does NOT kill entities
172
  # =============================================================
173
  enter_idle_mode() {
174
  [ "$IDLE_MODE" = true ] && return
175
  IDLE_MODE=true
176
- mc_command "gamerule randomTickSpeed 0"
177
- mc_command "gamerule doMobSpawning false"
178
- mc_command "kill @e[type=Zombie]"
179
- mc_command "kill @e[type=Skeleton]"
180
- mc_command "kill @e[type=Spider]"
181
- mc_command "kill @e[type=Creeper]"
182
- mc_command "kill @e[type=Enderman]"
183
- mc_command "kill @e[type=Witch]"
184
- mc_command "kill @e[type=Slime]"
185
- mc_command "kill @e[type=CaveSpider]"
186
- mc_command "kill @e[type=Silverfish]"
187
- mc_command "kill @e[type=Guardian]"
188
- mc_command "kill @e[type=Endermite]"
189
- mc_command "kill @e[type=Blaze]"
190
- mc_command "kill @e[type=Ghast]"
191
- mc_command "kill @e[type=MagmaCube]"
192
- mc_command "kill @e[type=WitherSkeleton]"
193
- mc_command "kill @e[type=ZombiePigman]"
194
- echo "[IDLE] Active — hostile mobs cleared, ticks paused"
195
  }
196
 
197
  exit_idle_mode() {
198
  [ "$IDLE_MODE" = false ] && return
199
  IDLE_MODE=false
200
- mc_command "gamerule randomTickSpeed 3"
201
- mc_command "gamerule doMobSpawning true"
202
- echo "[IDLE] Gameplay restored"
203
  }
204
 
205
  # =============================================================
@@ -303,6 +281,7 @@ echo "eula=true" > eula.txt
303
 
304
  echo "[2/7] Writing core server configs + starting WindSpigot..."
305
 
 
306
  cat > server.properties << 'EOF'
307
  server-port=25565
308
  server-ip=127.0.0.1
@@ -311,29 +290,30 @@ spawn-protection=0
311
  max-players=20
312
  view-distance=6
313
  gamemode=0
314
- difficulty=1
315
  level-name=world
316
- level-type=FLAT
317
- level-seed=8678942899319966093
318
  generate-structures=true
319
- motd=Vanilla Survival Eaglercraft
320
  pvp=true
321
  allow-flight=false
322
  white-list=false
323
  spawn-npcs=true
324
- spawn-animals=false
325
- spawn-monsters=false
326
  enable-command-block=false
327
  allow-nether=true
328
  use-native-transport=true
329
- network-compression-threshold=-1
330
- entity-broadcast-range-percentage=50
331
- max-tick-time=-1
332
  enable-rcon=true
333
  rcon.port=25575
334
  rcon.password=chunkystart
335
  EOF
336
 
 
337
  cat > bukkit.yml << 'EOF'
338
  settings:
339
  allow-end: true
@@ -342,18 +322,19 @@ settings:
342
  shutdown-message: Server closed
343
  save-user-cache-on-stop-only: true
344
  spawn-limits:
345
- monsters: 30
346
- animals: 6
347
- water-animals: 2
348
- ambient: 1
349
  chunk-gc:
350
- period-in-ticks: 600
351
  ticks-per:
352
- animal-spawns: 600
353
- monster-spawns: 4
354
- autosave: 12000
355
  EOF
356
 
 
357
  cat > spigot.yml << 'EOF'
358
  config-version: 8
359
  settings:
@@ -372,32 +353,34 @@ commands:
372
  world-settings:
373
  default:
374
  verbose: false
375
- view-distance: 4
376
- mob-spawn-range: 3
377
  entity-activation-range:
378
- animals: 12
379
- monsters: 20
380
- misc: 6
381
- tick-inactive-villagers: false
382
- entity-tracking-range:
383
- players: 48
384
- animals: 32
385
  monsters: 32
386
- misc: 16
387
- other: 48
 
 
 
 
 
 
 
388
  ticks-per:
389
  hopper-transfer: 8
390
  hopper-check: 1
391
  hopper-amount: 1
392
- max-entity-collisions: 2
393
  merge-radius:
394
- exp: 6.0
395
- item: 4.0
396
- arrow-despawn-rate: 60
397
- item-despawn-rate: 3000
398
- nerf-spawner-mobs: true
399
- zombie-aggressive-towards-villager: false
400
- enable-zombie-pigmen-portal-spawns: false
 
401
  EOF
402
 
403
  cat > windspigot.yml << 'EOF'
@@ -418,8 +401,7 @@ settings:
418
  reduced-chunk-loads: true
419
  lag-compensated-potions: false
420
  anti-xray:
421
- enabled: true
422
- engine-mode: 2
423
  hit-detection:
424
  enabled: true
425
  threshold: 1.0
@@ -432,8 +414,8 @@ settings:
432
  extra-horizontal: 0.425
433
  extra-vertical: 0.085
434
  chunk:
435
- threads: 1
436
- players-per-thread: 25
437
  EOF
438
 
439
  cat > nacho.yml << 'EOF'
@@ -441,7 +423,7 @@ settings:
441
  stop-notify-bungee: true
442
  anti-malware: true
443
  use-tcp-nodelay: true
444
- brand-name: "PVP"
445
  EOF
446
 
447
  setup_op_account
@@ -483,25 +465,35 @@ echo " ======================"
483
  echo ""
484
 
485
  # =============================================================
486
- # STEP 3: PVP gamerules — each command sent separately
487
  # =============================================================
488
- echo "[3/7] Setting PVP gamerules..."
489
  mc_command "gamerule pvp true"
490
  mc_command "gamerule keepInventory false"
491
  mc_command "gamerule naturalRegeneration true"
492
  mc_command "gamerule doFireTick true"
493
- mc_command "gamerule mobGriefing false"
494
- mc_command "gamerule announceAdvancements false"
 
 
 
 
 
495
  mc_command "difficulty 2"
496
  mc_command "defaultgamemode survival"
497
- echo " PVP gamerules set"
498
  echo ""
499
 
500
  # =============================================================
501
- # STEP 4: Idle mode — safe version
502
  # =============================================================
503
- echo "[4/7] Applying idle mode (no players)..."
504
- enter_idle_mode
 
 
 
 
 
505
  echo ""
506
 
507
  # =============================================================
@@ -509,16 +501,13 @@ echo ""
509
  # =============================================================
510
  echo "[5/7] Writing BungeeCord config..."
511
 
512
- # ===============================
513
- # BUNGEE CONFIG
514
- # ===============================
515
  cd "$BUNGEE_DIR"
516
 
517
  cat > config.yml << 'EOF'
518
  server_connect_timeout: 5000
519
  remote_ping_cache: -1
520
  forge_support: false
521
- player_limit: 10
522
  permissions:
523
  default:
524
  - bungeecord.command.server
@@ -532,12 +521,12 @@ disabled_commands:
532
  - disabledcommandhere
533
  servers:
534
  lobby:
535
- motd: '&aEaglercraft PVP'
536
  address: 127.0.0.1:25565
537
  restricted: false
538
  listeners:
539
  - query_port: 25577
540
- motd: '&6Eaglercraft 1.8.8 PVP'
541
  tab_list: GLOBAL_PING
542
  query_enabled: false
543
  proxy_protocol: false
@@ -547,7 +536,7 @@ listeners:
547
  - lobby
548
  bind_local_address: true
549
  host: 127.0.0.1:25577
550
- max_players: 10
551
  tab_size: 60
552
  force_default_server: true
553
  ip_forward: true
@@ -562,12 +551,6 @@ stats: none
562
  log_pings: false
563
  EOF
564
  echo " BungeeCord config.yml written"
565
-
566
- echo ""
567
- echo " Reloading server via RCON..."
568
- sleep 2
569
- mc_command "reload confirm"
570
- echo " Full server reload done"
571
  echo ""
572
 
573
  # =============================================================
@@ -612,16 +595,12 @@ echo " Starting BungeeCord..."
612
 
613
  patch_eagler_port
614
 
615
- # === NEW: MOTD AND ICON PATCH ===
616
  LISTENERS_NOW=$(find_listeners_yml)
617
  if [ -n "$LISTENERS_NOW" ]; then
618
- # Title: &e&l★ &a&lSURVIVAL &e&l★
619
- # Subtitle: &r&7Survive, craft, explore, and thrive!
620
- sed -i 's/An EaglercraftX server/\&e\&l★ \&a\&lSurvival Server \&e\&l★/g' "$LISTENERS_NOW"
621
- sed -i 's/smodusermc-server.hf.space/\&r\&7Survive, craft and explore!/g' "$LISTENERS_NOW"
622
  fi
623
 
624
-
625
  EAGLER_DIR=$(dirname "$(find_listeners_yml)" 2>/dev/null)
626
 
627
  if [ -n "$EAGLER_DIR" ]; then
@@ -651,9 +630,8 @@ done
651
  if [ "$PORT_READY" = true ]; then
652
  echo ""
653
  echo "============================================"
654
- echo " PVP SERVER READY — EaglerCraft on :7860"
655
  [ -n "$OP_USERNAME" ] && echo " OP: $OP_USERNAME (level 4)"
656
- echo " Plugins Synced via HuggingFace!"
657
  echo "============================================"
658
  else
659
  echo " Port 7860 NOT open!"
@@ -690,21 +668,18 @@ hf_sync_loop &
690
  SYNC_PID=$!
691
 
692
  # =============================================================
693
- # Shutdown — save world properly, then push, then stop processes
694
  # =============================================================
695
  graceful_shutdown() {
696
  echo " Shutting down..."
697
- mc_command "gamerule doMobSpawning true"
698
  mc_command "gamerule randomTickSpeed 3"
699
  mc_command "save-all"
700
  sleep 5
701
  hf_push_saves
702
  kill $SYNC_PID 2>/dev/null
703
- # Stop the MC server gracefully via RCON before killing PIDs
704
  mc_command "stop"
705
  sleep 5
706
  kill $BUNGEE_PID 2>/dev/null
707
- # Only force-kill if still alive
708
  kill -0 $BACKEND_PID 2>/dev/null && kill $BACKEND_PID 2>/dev/null
709
  exit 0
710
  }
@@ -729,7 +704,6 @@ while true; do
729
  IDLE_MODE=false
730
  start_windspigot
731
  sleep 45
732
- # Wait for RCON to be available before sending commands
733
  for i in $(seq 1 30); do
734
  nc -z 127.0.0.1 25575 2>/dev/null && break
735
  sleep 1
@@ -737,10 +711,9 @@ while true; do
737
  if [ -n "$OP_USERNAME" ]; then
738
  mc_command "op ${OP_USERNAME}"
739
  fi
740
- mc_command "gamerule pvp true"
741
- mc_command "gamerule keepInventory false"
742
- mc_command "gamerule mobGriefing false"
743
- enter_idle_mode
744
  fi
745
 
746
  if ! kill -0 $BUNGEE_PID 2>/dev/null; then
@@ -763,6 +736,7 @@ while true; do
763
  fi
764
  fi
765
 
 
766
  if [ $((LOOP_COUNT % 5)) -eq 0 ]; then
767
  CURRENT_LINE=$(wc -l < /tmp/paper.log 2>/dev/null || echo 0)
768
  if [ "$CURRENT_LINE" -gt "$LAST_LOG_LINE" ]; then
@@ -773,6 +747,7 @@ while true; do
773
  fi
774
  fi
775
 
 
776
  if [ $((LOOP_COUNT % 30)) -eq 0 ]; then
777
  for LF in /tmp/paper.log /tmp/bungee.log; do
778
  LS=$(stat -c%s "$LF" 2>/dev/null || echo 0)
@@ -784,6 +759,7 @@ while true; do
784
  LAST_LOG_LINE=$(wc -l < /tmp/paper.log 2>/dev/null || echo 0)
785
  fi
786
 
 
787
  if [ $((LOOP_COUNT % 5)) -eq 0 ]; then
788
  RSS=$(ps -p $BACKEND_PID -o rss= 2>/dev/null | awk '{printf "%.0f", $1/1024}')
789
  echo "[STATUS] Players: ${PLAYER_COUNT:-?} | RAM: ${RSS:-?}MB | $([ "$IDLE_MODE" = true ] && echo IDLE || echo ACTIVE)"
 
27
  NETTY_THREADS=4
28
 
29
  TOTAL_MEM_MB=$(free -m | awk '/^Mem:/{print $2}')
30
+ BUNGEE_MAX_MB=512
31
+ PAPER_MAX_MB=$(( TOTAL_MEM_MB - BUNGEE_MAX_MB - 512 ))
32
+ [ "$PAPER_MAX_MB" -gt 6144 ] && PAPER_MAX_MB=6144
33
  [ "$PAPER_MAX_MB" -lt 1024 ] && PAPER_MAX_MB=1024
34
+ # FIX: Min should be less than or equal to max
35
+ PAPER_MIN_MB=$(( PAPER_MAX_MB / 2 ))
36
+ [ "$PAPER_MIN_MB" -lt 512 ] && PAPER_MIN_MB=512
37
 
38
  echo "========================================"
39
+ echo " Eaglercraft 1.8.8 Survival Server"
40
  echo " WindSpigot + HuggingFace Buckets"
41
  echo "========================================"
42
  echo ""
 
45
  echo " Java: $($JAVA -version 2>&1 | head -1)"
46
  echo " Bucket: $HF_BUCKET_HANDLE"
47
  [ -n "$OP_USERNAME" ] && echo " OP Account: $OP_USERNAME"
 
48
  echo ""
49
 
50
  # =============================================
51
+ # JVM FLAGS - Optimized for limited resources
52
  # =============================================
53
  PAPER_JVM_FLAGS=(
54
  -Xmx${PAPER_MAX_MB}M
55
  -Xms${PAPER_MIN_MB}M
56
  -XX:+UseG1GC
57
  -XX:+ParallelRefProcEnabled
58
+ -XX:MaxGCPauseMillis=50
59
  -XX:+UnlockExperimentalVMOptions
60
  -XX:+DisableExplicitGC
61
+ -XX:G1NewSizePercent=30
62
+ -XX:G1MaxNewSizePercent=40
63
  -XX:G1HeapRegionSize=8M
64
+ -XX:G1ReservePercent=20
65
+ -XX:G1HeapWastePercent=5
66
+ -XX:G1MixedGCCountTarget=4
67
+ -XX:InitiatingHeapOccupancyPercent=15
68
  -XX:G1MixedGCLiveThresholdPercent=90
69
  -XX:G1RSetUpdatingPauseTimePercent=5
70
  -XX:SurvivorRatio=32
 
72
  -XX:MaxTenuringThreshold=1
73
  -XX:+OptimizeStringConcat
74
  -XX:+UseCompressedOops
75
+ -XX:MaxMetaspaceSize=192M
76
+ -XX:CompressedClassSpaceSize=96M
77
+ -XX:ReservedCodeCacheSize=96M
 
78
  -Xss256k
79
  -Djline.terminal=jline.UnsupportedTerminal
80
+ -Dio.netty.allocator.maxCachedBufferCapacity=262144
81
  -Dio.netty.recycler.maxCapacityPerThread=0
82
  -Dio.netty.eventLoopThreads=${NETTY_THREADS}
 
 
83
  -Dcom.mojang.eula.agree=true
84
  -DIReallyKnowWhatIAmDoingISwear
 
 
85
  )
86
 
87
  BUNGEE_JVM_FLAGS=(
 
89
  -Xms128M
90
  -XX:+UseG1GC
91
  -XX:+ParallelRefProcEnabled
92
+ -XX:MaxGCPauseMillis=50
93
  -XX:+UnlockExperimentalVMOptions
94
  -XX:+DisableExplicitGC
95
  -XX:+PerfDisableSharedMem
96
  -XX:+OptimizeStringConcat
97
  -XX:+UseCompressedOops
98
+ -XX:MaxMetaspaceSize=96M
 
99
  -Xss256k
100
+ -Dio.netty.allocator.maxCachedBufferCapacity=262144
101
  -Dio.netty.recycler.maxCapacityPerThread=0
102
  -Dio.netty.eventLoopThreads=${NETTY_THREADS}
 
 
103
  -Deaglerxbungee.stfu=true
104
  )
105
 
106
  # =============================================================
107
+ # RCON
108
  # =============================================================
109
  RCON_PASS="chunkystart"
110
 
 
155
  ]
156
  OPEOF
157
  echo " ops.json written (level 4, UUID: ${V3_UUID})"
 
 
 
158
  }
159
 
160
  # =============================================================
161
+ # IDLE MODE - Reduced tick rate but keeps mob spawning logic
162
  # =============================================================
163
  enter_idle_mode() {
164
  [ "$IDLE_MODE" = true ] && return
165
  IDLE_MODE=true
166
+ # Only reduce tick speed, don't disable spawning entirely
167
+ mc_command "gamerule randomTickSpeed 1"
168
+ # Clear excess hostile mobs to reduce lag when idle
169
+ mc_command "kill @e[type=Zombie,r=200]"
170
+ mc_command "kill @e[type=Skeleton,r=200]"
171
+ mc_command "kill @e[type=Spider,r=200]"
172
+ mc_command "kill @e[type=Creeper,r=200]"
173
+ echo "[IDLE] Low-power mode — reduced ticks, cleared distant mobs"
 
 
 
 
 
 
 
 
 
 
 
174
  }
175
 
176
  exit_idle_mode() {
177
  [ "$IDLE_MODE" = false ] && return
178
  IDLE_MODE=false
179
+ mc_command "gamerule randomTickSpeed 2"
180
+ echo "[IDLE] Normal gameplay restored"
 
181
  }
182
 
183
  # =============================================================
 
281
 
282
  echo "[2/7] Writing core server configs + starting WindSpigot..."
283
 
284
+ # FIX: Enable mobs, use DEFAULT world type for survival
285
  cat > server.properties << 'EOF'
286
  server-port=25565
287
  server-ip=127.0.0.1
 
290
  max-players=20
291
  view-distance=6
292
  gamemode=0
293
+ difficulty=2
294
  level-name=world
295
+ level-type=DEFAULT
296
+ level-seed=
297
  generate-structures=true
298
+ motd=Survival Eaglercraft
299
  pvp=true
300
  allow-flight=false
301
  white-list=false
302
  spawn-npcs=true
303
+ spawn-animals=true
304
+ spawn-monsters=true
305
  enable-command-block=false
306
  allow-nether=true
307
  use-native-transport=true
308
+ network-compression-threshold=256
309
+ entity-broadcast-range-percentage=75
310
+ max-tick-time=60000
311
  enable-rcon=true
312
  rcon.port=25575
313
  rcon.password=chunkystart
314
  EOF
315
 
316
+ # FIX: Balanced mob spawning - not too many, not too few
317
  cat > bukkit.yml << 'EOF'
318
  settings:
319
  allow-end: true
 
322
  shutdown-message: Server closed
323
  save-user-cache-on-stop-only: true
324
  spawn-limits:
325
+ monsters: 50
326
+ animals: 10
327
+ water-animals: 5
328
+ ambient: 3
329
  chunk-gc:
330
+ period-in-ticks: 400
331
  ticks-per:
332
+ animal-spawns: 400
333
+ monster-spawns: 2
334
+ autosave: 6000
335
  EOF
336
 
337
+ # FIX: Better entity activation ranges for survival gameplay
338
  cat > spigot.yml << 'EOF'
339
  config-version: 8
340
  settings:
 
353
  world-settings:
354
  default:
355
  verbose: false
356
+ view-distance: 6
357
+ mob-spawn-range: 6
358
  entity-activation-range:
359
+ animals: 24
 
 
 
 
 
 
360
  monsters: 32
361
+ raiders: 48
362
+ misc: 8
363
+ tick-inactive-villagers: true
364
+ entity-tracking-range:
365
+ players: 64
366
+ animals: 48
367
+ monsters: 48
368
+ misc: 32
369
+ other: 64
370
  ticks-per:
371
  hopper-transfer: 8
372
  hopper-check: 1
373
  hopper-amount: 1
374
+ max-entity-collisions: 4
375
  merge-radius:
376
+ exp: 4.0
377
+ item: 3.5
378
+ arrow-despawn-rate: 300
379
+ item-despawn-rate: 6000
380
+ nerf-spawner-mobs: false
381
+ zombie-aggressive-towards-villager: true
382
+ enable-zombie-pigmen-portal-spawns: true
383
+ max-tnt-per-tick: 20
384
  EOF
385
 
386
  cat > windspigot.yml << 'EOF'
 
401
  reduced-chunk-loads: true
402
  lag-compensated-potions: false
403
  anti-xray:
404
+ enabled: false
 
405
  hit-detection:
406
  enabled: true
407
  threshold: 1.0
 
414
  extra-horizontal: 0.425
415
  extra-vertical: 0.085
416
  chunk:
417
+ threads: 2
418
+ players-per-thread: 10
419
  EOF
420
 
421
  cat > nacho.yml << 'EOF'
 
423
  stop-notify-bungee: true
424
  anti-malware: true
425
  use-tcp-nodelay: true
426
+ brand-name: "Survival"
427
  EOF
428
 
429
  setup_op_account
 
465
  echo ""
466
 
467
  # =============================================================
468
+ # STEP 3: Survival gamerules
469
  # =============================================================
470
+ echo "[3/7] Setting Survival gamerules..."
471
  mc_command "gamerule pvp true"
472
  mc_command "gamerule keepInventory false"
473
  mc_command "gamerule naturalRegeneration true"
474
  mc_command "gamerule doFireTick true"
475
+ mc_command "gamerule mobGriefing true"
476
+ mc_command "gamerule doMobSpawning true"
477
+ mc_command "gamerule doDaylightCycle true"
478
+ mc_command "gamerule doWeatherCycle true"
479
+ mc_command "gamerule randomTickSpeed 2"
480
+ mc_command "gamerule spawnRadius 10"
481
+ mc_command "gamerule maxEntityCramming 12"
482
  mc_command "difficulty 2"
483
  mc_command "defaultgamemode survival"
484
+ echo " Survival gamerules set"
485
  echo ""
486
 
487
  # =============================================================
488
+ # STEP 4: Initial idle mode if no players
489
  # =============================================================
490
+ echo "[4/7] Checking for players..."
491
+ PLAYER_COUNT=$(get_player_count)
492
+ if [ "$PLAYER_COUNT" = "0" ]; then
493
+ enter_idle_mode
494
+ else
495
+ echo " Players online: $PLAYER_COUNT"
496
+ fi
497
  echo ""
498
 
499
  # =============================================================
 
501
  # =============================================================
502
  echo "[5/7] Writing BungeeCord config..."
503
 
 
 
 
504
  cd "$BUNGEE_DIR"
505
 
506
  cat > config.yml << 'EOF'
507
  server_connect_timeout: 5000
508
  remote_ping_cache: -1
509
  forge_support: false
510
+ player_limit: 20
511
  permissions:
512
  default:
513
  - bungeecord.command.server
 
521
  - disabledcommandhere
522
  servers:
523
  lobby:
524
+ motd: '&aEaglercraft Survival'
525
  address: 127.0.0.1:25565
526
  restricted: false
527
  listeners:
528
  - query_port: 25577
529
+ motd: '&6Eaglercraft 1.8.8 Survival'
530
  tab_list: GLOBAL_PING
531
  query_enabled: false
532
  proxy_protocol: false
 
536
  - lobby
537
  bind_local_address: true
538
  host: 127.0.0.1:25577
539
+ max_players: 20
540
  tab_size: 60
541
  force_default_server: true
542
  ip_forward: true
 
551
  log_pings: false
552
  EOF
553
  echo " BungeeCord config.yml written"
 
 
 
 
 
 
554
  echo ""
555
 
556
  # =============================================================
 
595
 
596
  patch_eagler_port
597
 
598
+ # MOTD Patch
599
  LISTENERS_NOW=$(find_listeners_yml)
600
  if [ -n "$LISTENERS_NOW" ]; then
601
+ sed -i 's/An EaglercraftX server/\&a\&lSurvival Server/g' "$LISTENERS_NOW"
 
 
 
602
  fi
603
 
 
604
  EAGLER_DIR=$(dirname "$(find_listeners_yml)" 2>/dev/null)
605
 
606
  if [ -n "$EAGLER_DIR" ]; then
 
630
  if [ "$PORT_READY" = true ]; then
631
  echo ""
632
  echo "============================================"
633
+ echo " SURVIVAL SERVER READY — EaglerCraft :7860"
634
  [ -n "$OP_USERNAME" ] && echo " OP: $OP_USERNAME (level 4)"
 
635
  echo "============================================"
636
  else
637
  echo " Port 7860 NOT open!"
 
668
  SYNC_PID=$!
669
 
670
  # =============================================================
671
+ # Shutdown
672
  # =============================================================
673
  graceful_shutdown() {
674
  echo " Shutting down..."
 
675
  mc_command "gamerule randomTickSpeed 3"
676
  mc_command "save-all"
677
  sleep 5
678
  hf_push_saves
679
  kill $SYNC_PID 2>/dev/null
 
680
  mc_command "stop"
681
  sleep 5
682
  kill $BUNGEE_PID 2>/dev/null
 
683
  kill -0 $BACKEND_PID 2>/dev/null && kill $BACKEND_PID 2>/dev/null
684
  exit 0
685
  }
 
704
  IDLE_MODE=false
705
  start_windspigot
706
  sleep 45
 
707
  for i in $(seq 1 30); do
708
  nc -z 127.0.0.1 25575 2>/dev/null && break
709
  sleep 1
 
711
  if [ -n "$OP_USERNAME" ]; then
712
  mc_command "op ${OP_USERNAME}"
713
  fi
714
+ mc_command "difficulty 2"
715
+ mc_command "gamerule doMobSpawning true"
716
+ mc_command "gamerule randomTickSpeed 2"
 
717
  fi
718
 
719
  if ! kill -0 $BUNGEE_PID 2>/dev/null; then
 
736
  fi
737
  fi
738
 
739
+ # Log monitoring
740
  if [ $((LOOP_COUNT % 5)) -eq 0 ]; then
741
  CURRENT_LINE=$(wc -l < /tmp/paper.log 2>/dev/null || echo 0)
742
  if [ "$CURRENT_LINE" -gt "$LAST_LOG_LINE" ]; then
 
747
  fi
748
  fi
749
 
750
+ # Log trimming
751
  if [ $((LOOP_COUNT % 30)) -eq 0 ]; then
752
  for LF in /tmp/paper.log /tmp/bungee.log; do
753
  LS=$(stat -c%s "$LF" 2>/dev/null || echo 0)
 
759
  LAST_LOG_LINE=$(wc -l < /tmp/paper.log 2>/dev/null || echo 0)
760
  fi
761
 
762
+ # Status output
763
  if [ $((LOOP_COUNT % 5)) -eq 0 ]; then
764
  RSS=$(ps -p $BACKEND_PID -o rss= 2>/dev/null | awk '{printf "%.0f", $1/1024}')
765
  echo "[STATUS] Players: ${PLAYER_COUNT:-?} | RAM: ${RSS:-?}MB | $([ "$IDLE_MODE" = true ] && echo IDLE || echo ACTIVE)"