File size: 1,984 Bytes
facd5fe | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | #!/bin/bash
set -e
echo "==== Server Initialization ===="
# --- Server Configuration ---
echo ">> Setting up server environment..."
if [ -f "server.properties" ]; then
sed -i "s/^server-port=.*/server-port=7860/" server.properties
sed -i "s/^query.port=.*/query.port=7860/" server.properties
echo "✅ Port configured: 7860"
else
echo "⚠️ Using default configuration"
fi
# --- Data Setup ---
echo ">> Loading world data..."
if command -v python3 >/dev/null 2>&1 && [ -f "download_world.py" ]; then
python3 download_world.py || echo "⚠️ Using default world"
else
echo "ℹ️ No custom data found"
fi
chmod -R 777 /app/world* 2>/dev/null || true
chmod -R 777 /app/plugins 2>/dev/null || true
echo "Available data folders:"
ls -la /app/ | grep world || echo "No custom data - generating new"
# --- Start Main Service ---
echo ">> Starting main service on port 7860..."
echo ">> Java: $(java -version 2>&1 | head -n 1)"
echo ">> Memory: 8GB allocated"
echo ">> CPU: Optimized for 2 cores with fast world generation"
exec java -server -Xmx8G -Xms8G \
-XX:+UseG1GC \
-XX:+ParallelRefProcEnabled \
-XX:ParallelGCThreads=2 \
-XX:ConcGCThreads=1 \
-XX:MaxGCPauseMillis=50 \
-XX:+UnlockExperimentalVMOptions \
-XX:+DisableExplicitGC \
-XX:+AlwaysPreTouch \
-XX:G1NewSizePercent=30 \
-XX:G1MaxNewSizePercent=50 \
-XX:G1HeapRegionSize=16M \
-XX:G1ReservePercent=15 \
-XX:G1HeapWastePercent=5 \
-XX:G1MixedGCCountTarget=3 \
-XX:InitiatingHeapOccupancyPercent=10 \
-XX:G1MixedGCLiveThresholdPercent=90 \
-XX:G1RSetUpdatingPauseTimePercent=5 \
-XX:SurvivorRatio=32 \
-XX:+PerfDisableSharedMem \
-XX:MaxTenuringThreshold=1 \
-XX:G1SATBBufferEnqueueingThresholdPercent=30 \
-XX:G1ConcMarkStepDurationMillis=5 \
-XX:G1ConcRSHotCardLimit=16 \
-XX:+UseStringDeduplication \
-Dfile.encoding=UTF-8 \
-Dcom.mojang.eula.agree=true \
-jar purpur.jar --nogui |