Fix JVM heap args crashing the server on every real connection

lazymc's command line forwarded -Xms/-Xmx straight to run.sh, which
passes trailing args to Minecraft's own arg parser (not the JVM) —
crashed with "X is not a recognized option" on every wake attempt.
Heap flags now go in user_jvm_args.txt where Forge actually expects
them.
This commit is contained in:
Mykhailo Ivanchenko
2026-10-23 15:43:49 +02:00
parent 8226642be5
commit 43444335f5
+10 -1
View File
@@ -43,6 +43,15 @@ else
echo "==> Forge server already installed, skipping"
fi
# JVM heap flags go in user_jvm_args.txt, NOT on lazymc's command line — run.sh
# forwards any args after "nogui" straight to Minecraft's own arg parser (not
# the JVM), so passing -Xmx/-Xms there crashes with "X is not a recognized option".
cat > "$SERVER_DIR/user_jvm_args.txt" <<EOF
# Managed by setup-server.sh — edit MIN_RAM/MAX_RAM at the top of that script instead.
-Xms${MIN_RAM}
-Xmx${MAX_RAM}
EOF
# server.properties: lazymc will rewrite host/port/rcon itself, we just set gameplay-relevant bits
touch "$SERVER_DIR/server.properties"
for kv in "online-mode=false" "motd=LAN Party - Create & Delight" "difficulty=normal" "max-players=20"; do
@@ -73,7 +82,7 @@ fi
cat > "$BASE_DIR/lazymc.toml" <<EOF
[server]
directory = "$SERVER_DIR"
command = "bash run.sh nogui -Xms${MIN_RAM} -Xmx${MAX_RAM}"
command = "bash run.sh nogui"
address = "127.0.0.1:${MC_INTERNAL_PORT}"
freeze_process = false
wake_whitelist = false