smodusermc commited on
Commit
ccb173e
·
verified ·
1 Parent(s): d4f98d4

Update start.sh

Browse files
Files changed (1) hide show
  1. start.sh +495 -23
start.sh CHANGED
@@ -14,13 +14,14 @@ PLUGIN_DIR="$BACKEND_DIR/plugins"
14
  mkdir -p "$PLUGIN_DIR"
15
 
16
  HF_BUCKET_HANDLE="hf://buckets/smodusermc/digpvp"
17
- SAVE_DIRS="world world_nether world_the_end players banned-ips.json banned-players.json ops.json whitelist.json"
 
18
  SYNC_INTERVAL="${SYNC_INTERVAL:-300}"
19
 
20
  IDLE_MODE=false
21
 
22
  # =============================================
23
- # OP ACCOUNT — set your username here
24
  # =============================================
25
  OP_USERNAME="CreppyBitch"
26
 
@@ -35,7 +36,7 @@ PAPER_MAX_MB=$(( TOTAL_MEM_MB - BUNGEE_MAX_MB - 768 ))
35
  PAPER_MIN_MB=8192
36
 
37
  echo "========================================"
38
- echo " Eaglercraft 1.8.8 Survival"
39
  echo " WindSpigot + HuggingFace Buckets"
40
  echo "========================================"
41
  echo ""
@@ -44,10 +45,11 @@ echo " Server: ${PAPER_MIN_MB}-${PAPER_MAX_MB}MB | Bungee: ${BUNGEE_MAX_MB}MB"
44
  echo " Java: $($JAVA -version 2>&1 | head -1)"
45
  echo " Bucket: $HF_BUCKET_HANDLE"
46
  [ -n "$OP_USERNAME" ] && echo " OP Account: $OP_USERNAME"
 
47
  echo ""
48
 
49
  # =============================================
50
- # JVM FLAGS — no GC thread limits
51
  # =============================================
52
  PAPER_JVM_FLAGS=(
53
  -Xmx${PAPER_MAX_MB}M
@@ -235,7 +237,10 @@ hf_push_saves() {
235
  local STAGING="/tmp/hf-staging"
236
  rm -rf "$STAGING" && mkdir -p "$STAGING"
237
  for item in $SAVE_DIRS; do
238
- [ -e "$BACKEND_DIR/$item" ] && cp -a "$BACKEND_DIR/$item" "$STAGING/$item"
 
 
 
239
  done
240
  hf buckets sync "$STAGING" "${HF_BUCKET_HANDLE}/game-data" --delete 2>&1 | tail -3
241
  [ $? -eq 0 ] && echo "[SYNC] OK $(date '+%H:%M:%S')" \
@@ -253,7 +258,7 @@ hf_sync_loop() {
253
  # =============================================================
254
  # STEP 0: Bucket
255
  # =============================================================
256
- echo "[0/6] Bucket setup..."
257
  hf_authenticate
258
  hf_ensure_bucket
259
  hf_restore_saves
@@ -262,7 +267,7 @@ echo ""
262
  # =============================================================
263
  # STEP 1: World size
264
  # =============================================================
265
- echo "[1/6] World analysis..."
266
  for WORLD_DIR in world world_nether world_the_end; do
267
  if [ -d "$BACKEND_DIR/$WORLD_DIR" ]; then
268
  SIZE=$(du -sh "$BACKEND_DIR/$WORLD_DIR" 2>/dev/null | awk '{print $1}')
@@ -273,11 +278,14 @@ done
273
  echo ""
274
 
275
  # =============================================================
276
- # STEP 2: Start WindSpigot
277
  # =============================================================
278
  cd "$BACKEND_DIR"
279
  echo "eula=true" > eula.txt
280
 
 
 
 
281
  cat > server.properties << 'EOF'
282
  server-port=25565
283
  server-ip=127.0.0.1
@@ -291,7 +299,7 @@ level-name=world
291
  level-type=DEFAULT
292
  level-seed=8678942899319966093
293
  generate-structures=true
294
- motd=Eaglercraft Server
295
  pvp=true
296
  allow-flight=false
297
  white-list=false
@@ -309,6 +317,7 @@ rcon.port=25575
309
  rcon.password=chunkystart
310
  EOF
311
 
 
312
  cat > bukkit.yml << 'EOF'
313
  settings:
314
  allow-end: true
@@ -329,6 +338,7 @@ ticks-per:
329
  autosave: 12000
330
  EOF
331
 
 
332
  cat > spigot.yml << 'EOF'
333
  config-version: 8
334
  settings:
@@ -375,6 +385,7 @@ world-settings:
375
  enable-zombie-pigmen-portal-spawns: false
376
  EOF
377
 
 
378
  cat > windspigot.yml << 'EOF'
379
  settings:
380
  async:
@@ -410,18 +421,467 @@ settings:
410
  players-per-thread: 25
411
  EOF
412
 
 
413
  cat > nacho.yml << 'EOF'
414
  settings:
415
  stop-notify-bungee: true
416
  anti-malware: true
417
  use-tcp-nodelay: true
418
- brand-name: "Survival"
419
  EOF
420
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
421
  # Write ops.json before server starts
422
  setup_op_account
423
 
424
- echo "[2/6] Starting WindSpigot (--noconsole to fix CPU bug)..."
425
  > /tmp/paper.log
426
 
427
  start_windspigot
@@ -461,23 +921,32 @@ echo " ==============="
461
  echo ""
462
 
463
  # =============================================================
464
- # STEP 3: Skip CPU check (removed)
465
  # =============================================================
466
- echo "[3/6] Skipping CPU check..."
 
 
 
 
 
 
 
 
 
467
  echo ""
468
 
469
  # =============================================================
470
- # STEP 4: Apply idle mode
471
  # =============================================================
472
- echo "[4/6] Applying idle mode (no players)..."
473
  mc_command "gamerule randomTickSpeed 0" "gamerule doMobSpawning false" "kill @e[type=!Player]"
474
  IDLE_MODE=true
475
  echo ""
476
 
477
  # =============================================================
478
- # STEP 5: BungeeCord
479
  # =============================================================
480
- echo "[5/6] BungeeCord config..."
481
  cd "$BUNGEE_DIR"
482
 
483
  cat > config.yml << 'EOF'
@@ -498,12 +967,12 @@ disabled_commands:
498
  - disabledcommandhere
499
  servers:
500
  lobby:
501
- motd: '&aEaglercraft Survival'
502
  address: 127.0.0.1:25565
503
  restricted: false
504
  listeners:
505
  - query_port: 25577
506
- motd: '&6Eaglercraft 1.8.8'
507
  tab_list: GLOBAL_PING
508
  query_enabled: false
509
  proxy_protocol: false
@@ -531,7 +1000,7 @@ EOF
531
  LISTENERS_FILE=$(find_listeners_yml)
532
 
533
  if [ -z "$LISTENERS_FILE" ]; then
534
- echo "[6/6] Generating EaglerXBungee config..."
535
  cd "$BUNGEE_DIR"
536
  $JAVA "${BUNGEE_JVM_FLAGS[@]}" \
537
  -cp "sqlite-jdbc.jar:BungeeCord.jar" \
@@ -560,7 +1029,7 @@ if [ -z "$LISTENERS_FILE" ]; then
560
  done
561
  sleep 2
562
  else
563
- echo "[6/6] EaglerXBungee config exists"
564
  fi
565
 
566
  echo " Starting BungeeCord..."
@@ -595,8 +1064,9 @@ done
595
  if [ "$PORT_READY" = true ]; then
596
  echo ""
597
  echo "============================================"
598
- echo " SERVER READY — EaglerCraft on :7860"
599
  [ -n "$OP_USERNAME" ] && echo " OP: $OP_USERNAME (level 4)"
 
600
  echo "============================================"
601
  else
602
  echo " Port 7860 NOT open!"
@@ -653,10 +1123,12 @@ while true; do
653
  IDLE_MODE=false
654
  start_windspigot
655
  sleep 45
656
- # Re-OP after restart
657
  if [ -n "$OP_USERNAME" ]; then
658
  mc_command "op ${OP_USERNAME}" 2>/dev/null
659
  fi
 
 
 
660
  enter_idle_mode
661
  fi
662
 
 
14
  mkdir -p "$PLUGIN_DIR"
15
 
16
  HF_BUCKET_HANDLE="hf://buckets/smodusermc/digpvp"
17
+ # Plugin data directories included for persistence
18
+ SAVE_DIRS="world world_nether world_the_end players banned-ips.json banned-players.json ops.json whitelist.json plugins/WorldGuard plugins/Shopkeepers plugins/MineResetLite plugins/SafeTrade plugins/Skript plugins/WorldEdit"
19
  SYNC_INTERVAL="${SYNC_INTERVAL:-300}"
20
 
21
  IDLE_MODE=false
22
 
23
  # =============================================
24
+ # OP ACCOUNT
25
  # =============================================
26
  OP_USERNAME="CreppyBitch"
27
 
 
36
  PAPER_MIN_MB=8192
37
 
38
  echo "========================================"
39
+ echo " Eaglercraft 1.8.8 PVP 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 " Plugins: WorldEdit, WorldGuard, MineResetLite, Shopkeepers, SafeTrade, Skript"
49
  echo ""
50
 
51
  # =============================================
52
+ # JVM FLAGS
53
  # =============================================
54
  PAPER_JVM_FLAGS=(
55
  -Xmx${PAPER_MAX_MB}M
 
237
  local STAGING="/tmp/hf-staging"
238
  rm -rf "$STAGING" && mkdir -p "$STAGING"
239
  for item in $SAVE_DIRS; do
240
+ if [ -e "$BACKEND_DIR/$item" ]; then
241
+ mkdir -p "$STAGING/$(dirname "$item")"
242
+ cp -a "$BACKEND_DIR/$item" "$STAGING/$item"
243
+ fi
244
  done
245
  hf buckets sync "$STAGING" "${HF_BUCKET_HANDLE}/game-data" --delete 2>&1 | tail -3
246
  [ $? -eq 0 ] && echo "[SYNC] OK $(date '+%H:%M:%S')" \
 
258
  # =============================================================
259
  # STEP 0: Bucket
260
  # =============================================================
261
+ echo "[0/7] Bucket setup..."
262
  hf_authenticate
263
  hf_ensure_bucket
264
  hf_restore_saves
 
267
  # =============================================================
268
  # STEP 1: World size
269
  # =============================================================
270
+ echo "[1/7] World analysis..."
271
  for WORLD_DIR in world world_nether world_the_end; do
272
  if [ -d "$BACKEND_DIR/$WORLD_DIR" ]; then
273
  SIZE=$(du -sh "$BACKEND_DIR/$WORLD_DIR" 2>/dev/null | awk '{print $1}')
 
278
  echo ""
279
 
280
  # =============================================================
281
+ # STEP 2: Write ALL configs + plugin configs before boot
282
  # =============================================================
283
  cd "$BACKEND_DIR"
284
  echo "eula=true" > eula.txt
285
 
286
+ echo "[2/7] Writing all server + plugin configs..."
287
+
288
+ # ---- server.properties (PVP) ----
289
  cat > server.properties << 'EOF'
290
  server-port=25565
291
  server-ip=127.0.0.1
 
299
  level-type=DEFAULT
300
  level-seed=8678942899319966093
301
  generate-structures=true
302
+ motd=Eaglercraft PVP Server
303
  pvp=true
304
  allow-flight=false
305
  white-list=false
 
317
  rcon.password=chunkystart
318
  EOF
319
 
320
+ # ---- bukkit.yml ----
321
  cat > bukkit.yml << 'EOF'
322
  settings:
323
  allow-end: true
 
338
  autosave: 12000
339
  EOF
340
 
341
+ # ---- spigot.yml (PVP tuned) ----
342
  cat > spigot.yml << 'EOF'
343
  config-version: 8
344
  settings:
 
385
  enable-zombie-pigmen-portal-spawns: false
386
  EOF
387
 
388
+ # ---- windspigot.yml (PVP combat tuned) ----
389
  cat > windspigot.yml << 'EOF'
390
  settings:
391
  async:
 
421
  players-per-thread: 25
422
  EOF
423
 
424
+ # ---- nacho.yml ----
425
  cat > nacho.yml << 'EOF'
426
  settings:
427
  stop-notify-bungee: true
428
  anti-malware: true
429
  use-tcp-nodelay: true
430
+ brand-name: "PVP"
431
  EOF
432
 
433
+ # =============================================================
434
+ # PLUGIN CONFIGS — written before server starts so plugins
435
+ # find them on first boot and don't overwrite with defaults
436
+ # =============================================================
437
+
438
+ # ---- WorldEdit ----
439
+ mkdir -p "$PLUGIN_DIR/WorldEdit"
440
+ cat > "$PLUGIN_DIR/WorldEdit/config.yml" << 'WEEOF'
441
+ limits:
442
+ allow-extra-data-values: false
443
+ max-blocks-changed:
444
+ default: 5000
445
+ maximum: 50000
446
+ max-polygonal-points:
447
+ default: -1
448
+ maximum: 20
449
+ max-radius: -1
450
+ max-super-pickaxe-size: 5
451
+ max-brush-radius: 6
452
+ butcher-radius:
453
+ default: -1
454
+ maximum: -1
455
+ disallowed-blocks: []
456
+ use-inventory:
457
+ enable: false
458
+ allow-override: true
459
+ creative-mode-overrides: false
460
+ logging:
461
+ log-commands: false
462
+ file: worldedit.log
463
+ super-pickaxe:
464
+ drop-items: true
465
+ many-drop-items: true
466
+ snapshots:
467
+ directory:
468
+ navigation-wand:
469
+ item: 345
470
+ max-distance: 100
471
+ scripting:
472
+ timeout: 3000
473
+ dir: craftscripts
474
+ saving:
475
+ dir: schematics
476
+ files:
477
+ allow-symbolic-links: false
478
+ history:
479
+ size: 15
480
+ expiration: 10
481
+ wand-item: 271
482
+ no-double-slash: false
483
+ no-op-permissions: false
484
+ debug: false
485
+ show-help-on-first-use: true
486
+ server-side-cui: true
487
+ WEEOF
488
+ echo " WorldEdit config written"
489
+
490
+ # ---- WorldGuard ----
491
+ mkdir -p "$PLUGIN_DIR/WorldGuard"
492
+ cat > "$PLUGIN_DIR/WorldGuard/config.yml" << 'WGEOF'
493
+ op-permissions: true
494
+ summary-on-start: true
495
+ auto-invincible: false
496
+ auto-invincible-group: false
497
+ auto-no-drowning-group: false
498
+ use-player-move-event: true
499
+ use-player-teleport-event: true
500
+ regions:
501
+ enable: true
502
+ wand: 287
503
+ max-region-count-per-player:
504
+ default: 7
505
+ claim-only-inside-existing-regions: false
506
+ max-claim-volume: 30000
507
+ cancel-chat-without-recipients: false
508
+ npc-flag-handling: RELATIONSHIP_API
509
+ use-creature-spawn-event: true
510
+ invincibility-removes-mobs: false
511
+ high-frequency-flags: true
512
+ protect-against-liquid-flow: false
513
+ sql:
514
+ use: false
515
+ dsn: jdbc:mysql://localhost/worldguard
516
+ username: worldguard
517
+ password: worldguard
518
+ table-prefix: ''
519
+ driver: ''
520
+ build-permission-nodes:
521
+ enable: false
522
+ deny-message: '&cSorry, you cannot build here!'
523
+ event-handling:
524
+ block-entity-spawns-with-mob-reasons: false
525
+ interaction-whitelist: []
526
+ security:
527
+ deop-everyone-on-join: false
528
+ block-in-game-op-command: false
529
+ mobs:
530
+ block-creeper-explosions: false
531
+ block-creeper-block-damage: true
532
+ block-wither-explosions: false
533
+ block-wither-block-damage: true
534
+ block-wither-skull-explosions: false
535
+ block-wither-skull-block-damage: true
536
+ block-enderdragon-block-damage: true
537
+ block-enderdragon-portal-creation: false
538
+ block-fireball-explosions: false
539
+ block-fireball-block-damage: true
540
+ anti-wolf-dumbness: false
541
+ allow-tamed-spawns: true
542
+ disable-enderman-griefing: true
543
+ block-painting-destroy: false
544
+ block-item-frame-destroy: false
545
+ block-plugin-spawning: true
546
+ block-above-ground-slimes: false
547
+ block-other-explosions: false
548
+ block-zombie-door-destruction: true
549
+ block-vehicle-entry: false
550
+ block-creature-spawn: []
551
+ player-damage:
552
+ disable-fall-damage: false
553
+ disable-lava-damage: false
554
+ disable-fire-damage: false
555
+ disable-lightning-damage: false
556
+ disable-drowning-damage: false
557
+ disable-suffocation-damage: false
558
+ disable-contact-damage: false
559
+ disable-void-damage: false
560
+ teleport-on-void-falling: false
561
+ disable-explosion-damage: false
562
+ disable-mob-damage: false
563
+ disable-death-messages: false
564
+ ignition:
565
+ block-tnt: false
566
+ block-tnt-block-damage: false
567
+ block-lighter: false
568
+ fire:
569
+ disable-lava-fire-spread: false
570
+ disable-all-fire-spread: false
571
+ disable-fire-spread-blocks: []
572
+ lava-spread-blocks: []
573
+ weather:
574
+ prevent-lightning-strike-fire: false
575
+ disable-lightning-strike-fire: false
576
+ disable-thunderstorm: false
577
+ disable-weather: false
578
+ disable-pig-zombification: false
579
+ disable-powered-creepers: false
580
+ always-raining: false
581
+ always-thundering: false
582
+ dynamics:
583
+ disable-mushroom-spread: false
584
+ disable-ice-melting: false
585
+ disable-snow-melting: false
586
+ disable-snow-formation: false
587
+ disable-ice-formation: false
588
+ disable-leaf-decay: false
589
+ disable-grass-growth: false
590
+ disable-mycelium-spread: false
591
+ disable-vine-growth: false
592
+ disable-crop-growth: false
593
+ disable-soil-dehydration: false
594
+ chest-protection:
595
+ enable: false
596
+ disable-off-check: false
597
+ blacklist:
598
+ use: false
599
+ override-wildcard: true
600
+ log:
601
+ console: false
602
+ database: false
603
+ file: false
604
+ file-path: worldguard/logs/%Y-%m-%d.log
605
+ WGEOF
606
+
607
+ mkdir -p "$PLUGIN_DIR/WorldGuard/worlds/world"
608
+ cat > "$PLUGIN_DIR/WorldGuard/worlds/world/config.yml" << 'WGWEOF'
609
+ regions:
610
+ enable: true
611
+ invincibility-removes-mobs: false
612
+ mobs:
613
+ block-creeper-block-damage: true
614
+ block-enderdragon-block-damage: true
615
+ block-wither-block-damage: true
616
+ disable-enderman-griefing: true
617
+ block-zombie-door-destruction: true
618
+ player-damage:
619
+ disable-fall-damage: false
620
+ disable-void-damage: false
621
+ fire:
622
+ disable-all-fire-spread: false
623
+ weather:
624
+ disable-weather: false
625
+ WGWEOF
626
+ echo " WorldGuard config written"
627
+
628
+ # ---- MineResetLite ----
629
+ mkdir -p "$PLUGIN_DIR/MineResetLite"
630
+ mkdir -p "$PLUGIN_DIR/MineResetLite/mines"
631
+ cat > "$PLUGIN_DIR/MineResetLite/config.yml" << 'MRLEOF'
632
+ broadcast-in-world-only: false
633
+ broadcast-nearby-only: false
634
+ default-mine-reset-delay: 15
635
+ MRLEOF
636
+ echo " MineResetLite config written"
637
+
638
+ # ---- Shopkeepers ----
639
+ mkdir -p "$PLUGIN_DIR/Shopkeepers"
640
+ cat > "$PLUGIN_DIR/Shopkeepers/config.yml" << 'SKEOF'
641
+ debug: false
642
+ enable-metrics: false
643
+ bypass-spawn-blocking: true
644
+ bypass-shop-interaction-blocking: false
645
+ save-instantly: true
646
+ enable-living-shops: true
647
+ disable-living-shops: false
648
+ enable-sign-shops: true
649
+ enable-citizen-shops: false
650
+ name-regex: "[A-Za-z0-9 ]{3,25}"
651
+ max-shops-per-player: 0
652
+ require-creation-permission: false
653
+ create-player-shop-with-command: false
654
+ currency-item: EMERALD
655
+ currency-item-spawn-egg-entity-type: ''
656
+ zero-currency-item: AIR
657
+ high-currency-item: EMERALD_BLOCK
658
+ high-currency-value: 9
659
+ high-currency-min-cost: 20
660
+ zero-high-currency-item: AIR
661
+ disable-other-villagers: true
662
+ block-villager-spawns: false
663
+ hire-other-villagers: false
664
+ tax-rate: 0
665
+ tax-round-up: false
666
+ protect-chests: true
667
+ prevent-item-movement: true
668
+ delete-shopkeeper-on-break-chest: false
669
+ editor-max-column: 8
670
+ enable-villager-shops: true
671
+ enable-sign-shops-only: false
672
+ enable-witch-shops: true
673
+ msg-creation-item-selected: "&aShop creation item selected."
674
+ msg-shop-create-fail: "&cCannot create shop."
675
+ msg-button-name: "&aNaming"
676
+ msg-button-type: "&aType"
677
+ msg-button-delete: "&4Delete"
678
+ msg-button-hire: "&aHire"
679
+ SKEOF
680
+ echo " Shopkeepers config written"
681
+
682
+ # ---- SafeTrade ----
683
+ mkdir -p "$PLUGIN_DIR/SafeTrade"
684
+ cat > "$PLUGIN_DIR/SafeTrade/config.yml" << 'STEOF'
685
+ enabled: true
686
+ prefix: "&8[&6Trade&8] "
687
+ allow-cross-world: true
688
+ request-timeout: 30
689
+ gui-title: "&8Safe Trade"
690
+ money-trading: false
691
+ log-trades: true
692
+ log-file: "trades.log"
693
+ sounds:
694
+ trade-request: true
695
+ trade-complete: true
696
+ trade-cancel: true
697
+ messages:
698
+ trade-request-sent: "&aTrade request sent to &e%player%&a!"
699
+ trade-request-received: "&e%player% &awants to trade! Use &e/trade accept &ato accept."
700
+ trade-accepted: "&aTrade accepted!"
701
+ trade-denied: "&cTrade denied."
702
+ trade-cancelled: "&cTrade cancelled."
703
+ trade-complete: "&aTrade complete!"
704
+ no-pending-request: "&cYou have no pending trade requests."
705
+ already-trading: "&cYou are already in a trade."
706
+ cannot-trade-self: "&cYou cannot trade with yourself."
707
+ player-not-found: "&cPlayer not found."
708
+ player-busy: "&c%player% is busy."
709
+ request-expired: "&cTrade request expired."
710
+ STEOF
711
+ echo " SafeTrade config written"
712
+
713
+ # ---- Skript ----
714
+ mkdir -p "$PLUGIN_DIR/Skript"
715
+ mkdir -p "$PLUGIN_DIR/Skript/scripts"
716
+ cat > "$PLUGIN_DIR/Skript/config.sk" << 'SKRIPTEOF'
717
+ language: english
718
+ color codes: true
719
+ script loader:
720
+ use new script loader: true
721
+ databases:
722
+ database 1:
723
+ type: CSV
724
+ pattern: .*
725
+ file: ./plugins/Skript/variables.csv
726
+ backup interval: 2 hours
727
+ log:
728
+ verbosity: NORMAL
729
+ enable effect commands: true
730
+ allow function calls from expressions: true
731
+ disable variable will not be saved warnings: false
732
+ disable missing and/or warnings: false
733
+ disable variable conflict warnings: false
734
+ date format: default
735
+ SKRIPTEOF
736
+ echo " Skript config written"
737
+
738
+ # ---- PVP Skript: core ----
739
+ cat > "$PLUGIN_DIR/Skript/scripts/pvp-core.sk" << 'PVPSKEOF'
740
+ # ============================
741
+ # PVP Core — kills, streaks
742
+ # ============================
743
+
744
+ on death of player:
745
+ attacker is a player
746
+ add 1 to {kills::%attacker%}
747
+ add 1 to {deaths::%victim%}
748
+ set {lastKill::%attacker%} to now
749
+ send "&c&l☠ &e%victim% &7was slain by &c%attacker% &7(&e%{kills::%attacker%}% kills&7)" to all players
750
+
751
+ on death of player:
752
+ attacker is a player
753
+ add 1 to {streak::%attacker%}
754
+ if {streak::%attacker%} is 5:
755
+ send "&6&l⚔ %attacker% &eis on a &c&l5 KILL STREAK!" to all players
756
+ if {streak::%attacker%} is 10:
757
+ send "&6&l⚔ %attacker% &eis on a &4&l10 KILL STREAK!" to all players
758
+
759
+ on death of player:
760
+ set {streak::%victim%} to 0
761
+
762
+ command /stats [<player>]:
763
+ trigger:
764
+ if arg-1 is set:
765
+ set {_target} to arg-1
766
+ else:
767
+ set {_target} to player
768
+ set {_k} to {kills::%{_target}%} ? 0
769
+ set {_d} to {deaths::%{_target}%} ? 0
770
+ send "&8&m "
771
+ send "&6&l⚔ &ePVP Stats for &c%{_target}%"
772
+ send "&7Kills: &a%{_k}%"
773
+ send "&7Deaths: &c%{_d}%"
774
+ send "&7Streak: &e%{streak::%{_target}%} ? 0%"
775
+ send "&8&m "
776
+
777
+ on respawn:
778
+ wait 1 tick
779
+ give player iron sword named "&7PVP Sword"
780
+ give player 16 of cooked beef named "&6Steak"
781
+ give player iron helmet
782
+ give player iron chestplate
783
+ give player iron leggings
784
+ give player iron boots
785
+
786
+ on first join:
787
+ give player iron sword named "&7PVP Sword"
788
+ give player 16 of cooked beef named "&6Steak"
789
+ give player iron helmet
790
+ give player iron chestplate
791
+ give player iron leggings
792
+ give player iron boots
793
+ give player wooden pickaxe
794
+ send "&a&lWelcome to the PVP Server!" to player
795
+ send "&7Use &e/stats &7to check your kills and deaths." to player
796
+ send "&7Use &e/trade <player> &7to trade items safely." to player
797
+
798
+ on join:
799
+ set join message to "&8[&a+&8] &7%player%"
800
+
801
+ on quit:
802
+ set quit message to "&8[&c-&8] &7%player%"
803
+
804
+ command /spawn:
805
+ trigger:
806
+ teleport player to spawn of world "world"
807
+ send "&aTeleported to spawn!"
808
+ PVPSKEOF
809
+ echo " Skript pvp-core.sk written"
810
+
811
+ # ---- PVP Skript: spawn protection ----
812
+ cat > "$PLUGIN_DIR/Skript/scripts/spawn-protect.sk" << 'SPAWNEOF'
813
+ on damage of player:
814
+ attacker is a player
815
+ distance between victim's location and spawn of world "world" is less than 20
816
+ cancel event
817
+ send "&cNo PVP in spawn area!" to attacker
818
+ SPAWNEOF
819
+ echo " Skript spawn-protect.sk written"
820
+
821
+ # ---- PVP Skript: combat tag ----
822
+ cat > "$PLUGIN_DIR/Skript/scripts/combat-tag.sk" << 'COMBATEOF'
823
+ on damage of player:
824
+ attacker is a player
825
+ set {combatTag::%victim%} to now
826
+ set {combatTag::%attacker%} to now
827
+ send "&c&l⚔ You are now in combat! Don't log out!" to victim
828
+ send "&c&l⚔ You are now in combat! Don't log out!" to attacker
829
+
830
+ on quit:
831
+ {combatTag::%player%} is set
832
+ difference between now and {combatTag::%player%} is less than 15 seconds
833
+ kill player
834
+ broadcast "&c%player% combat logged and was killed!"
835
+
836
+ every 1 second:
837
+ loop all players:
838
+ {combatTag::%loop-player%} is set
839
+ difference between now and {combatTag::%loop-player%} is greater than 15 seconds
840
+ delete {combatTag::%loop-player%}
841
+ COMBATEOF
842
+ echo " Skript combat-tag.sk written"
843
+
844
+ # ---- PVP Skript: emerald economy ----
845
+ cat > "$PLUGIN_DIR/Skript/scripts/economy.sk" << 'ECONEOF'
846
+ command /balance [<player>]:
847
+ aliases: /bal, /money
848
+ trigger:
849
+ if arg-1 is set:
850
+ set {_target} to arg-1
851
+ else:
852
+ set {_target} to player
853
+ set {_emeralds} to number of emeralds in {_target}'s inventory
854
+ send "&8&m "
855
+ send "&6&l$ &eBalance for &c%{_target}%"
856
+ send "&7Emeralds: &a%{_emeralds}%"
857
+ send "&8&m "
858
+
859
+ command /pay <player> <integer>:
860
+ trigger:
861
+ if arg-2 is less than 1:
862
+ send "&cAmount must be at least 1!"
863
+ stop
864
+ if arg-1 is player:
865
+ send "&cYou can't pay yourself!"
866
+ stop
867
+ set {_has} to number of emeralds in player's inventory
868
+ if {_has} is less than arg-2:
869
+ send "&cYou don't have enough emeralds!"
870
+ stop
871
+ remove arg-2 of emerald from player's inventory
872
+ give arg-2 of emerald to arg-1
873
+ send "&aSent &e%arg-2% emeralds &ato &e%arg-1%&a!"
874
+ send "&a%player% &esent you &a%arg-2% emeralds&e!" to arg-1
875
+ ECONEOF
876
+ echo " Skript economy.sk written"
877
+
878
+ echo " All configs written!"
879
+ echo ""
880
+
881
  # Write ops.json before server starts
882
  setup_op_account
883
 
884
+ echo "[3/7] Starting WindSpigot (--noconsole to fix CPU bug)..."
885
  > /tmp/paper.log
886
 
887
  start_windspigot
 
921
  echo ""
922
 
923
  # =============================================================
924
+ # STEP 4: PVP gamerules via RCON
925
  # =============================================================
926
+ echo "[4/7] Setting PVP gamerules..."
927
+ mc_command "gamerule pvp true"
928
+ mc_command "gamerule keepInventory false"
929
+ mc_command "gamerule naturalRegeneration true"
930
+ mc_command "gamerule doFireTick true"
931
+ mc_command "gamerule mobGriefing false"
932
+ mc_command "gamerule announceAdvancements false"
933
+ mc_command "difficulty 2"
934
+ mc_command "defaultgamemode survival"
935
+ echo " PVP gamerules set"
936
  echo ""
937
 
938
  # =============================================================
939
+ # STEP 5: Apply idle mode (no players initially)
940
  # =============================================================
941
+ echo "[5/7] Applying idle mode (no players)..."
942
  mc_command "gamerule randomTickSpeed 0" "gamerule doMobSpawning false" "kill @e[type=!Player]"
943
  IDLE_MODE=true
944
  echo ""
945
 
946
  # =============================================================
947
+ # STEP 6: BungeeCord
948
  # =============================================================
949
+ echo "[6/7] BungeeCord config..."
950
  cd "$BUNGEE_DIR"
951
 
952
  cat > config.yml << 'EOF'
 
967
  - disabledcommandhere
968
  servers:
969
  lobby:
970
+ motd: '&aEaglercraft PVP'
971
  address: 127.0.0.1:25565
972
  restricted: false
973
  listeners:
974
  - query_port: 25577
975
+ motd: '&6Eaglercraft 1.8.8 PVP'
976
  tab_list: GLOBAL_PING
977
  query_enabled: false
978
  proxy_protocol: false
 
1000
  LISTENERS_FILE=$(find_listeners_yml)
1001
 
1002
  if [ -z "$LISTENERS_FILE" ]; then
1003
+ echo "[7/7] Generating EaglerXBungee config..."
1004
  cd "$BUNGEE_DIR"
1005
  $JAVA "${BUNGEE_JVM_FLAGS[@]}" \
1006
  -cp "sqlite-jdbc.jar:BungeeCord.jar" \
 
1029
  done
1030
  sleep 2
1031
  else
1032
+ echo "[7/7] EaglerXBungee config exists"
1033
  fi
1034
 
1035
  echo " Starting BungeeCord..."
 
1064
  if [ "$PORT_READY" = true ]; then
1065
  echo ""
1066
  echo "============================================"
1067
+ echo " PVP SERVER READY — EaglerCraft on :7860"
1068
  [ -n "$OP_USERNAME" ] && echo " OP: $OP_USERNAME (level 4)"
1069
+ echo " Plugins: WE, WG, MRL, Shopkeepers, SafeTrade, Skript"
1070
  echo "============================================"
1071
  else
1072
  echo " Port 7860 NOT open!"
 
1123
  IDLE_MODE=false
1124
  start_windspigot
1125
  sleep 45
 
1126
  if [ -n "$OP_USERNAME" ]; then
1127
  mc_command "op ${OP_USERNAME}" 2>/dev/null
1128
  fi
1129
+ mc_command "gamerule pvp true"
1130
+ mc_command "gamerule keepInventory false"
1131
+ mc_command "gamerule mobGriefing false"
1132
  enter_idle_mode
1133
  fi
1134