Create start.sh
Browse files1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465#!/bin/bash
# 1. Move to the Hugging Face Bucket (Persistent Storage)if [ -d "/data" ]; then echo "[System] Bucket found! Moving to /data..." cd /dataelse echo "[Warning] No /data bucket found. World will reset on restart!" mkdir -p /app/server cd /app/serverfi
# 2. Download Paper 1.12.2if [ ! -f "server.jar" ]; then echo "[System] Downloading Paper 1.12.2..." curl -s -o server.jar https://api.papermc.io/v2/projects/paper/versions/1.12.2/builds/1620/downloads/paper-1.12.2-1620.jarfi
mkdir -p plugins/EaglercraftXServer
# 3. Auto-Download EaglerXServer (Latest Release)if [ ! -f "plugins/EaglerXServer.jar" ]; then echo "[System] Fetching latest EaglerXServer..." EAGLER_URL=$(curl -s https://api.github.com/repos/lax1dude/eaglerxserver/releases/latest | jq -r '.assets[] | select(.name | startswith("EaglerXServer") and endswith(".jar")) | .browser_download_url' | head -n 1) # Fallback to 1.0.8 if GitHub API rate-limits us if [ -z "$EAGLER_URL" ] || [ "$EAGLER_URL" == "null" ]; then EAGLER_URL="https://github.com/lax1dude/eaglerxserver/releases/download/v1.0.8/EaglerXServer-1.0.8.jar" fi curl -L -s -o plugins/EaglerXServer.jar "$EAGLER_URL"fi
# 4. Auto-Download ViaVersion & ViaBackwards (Allows 1.8 Eagler clients to join 1.12.2)if [ ! -f "plugins/ViaVersion.jar" ]; then echo "[System] Fetching ViaVersion..." VIA_URL=$(curl -s "https://api.modrinth.com/v2/project/viaversion/version" | jq -r '[.[] | select(.loaders[] | contains("paper"))][0].files[0].url') curl -L -s -o plugins/ViaVersion.jar "$VIA_URL"fiif [ ! -f "plugins/ViaBackwards.jar" ]; then echo "[System] Fetching ViaBackwards..." VIAB_URL=$(curl -s "https://api.modrinth.com/v2/project/viabackwards/version" | jq -r '[.[] | select(.loaders[] | contains("paper"))][0].files[0].url') curl -L -s -o plugins/ViaBackwards.jar "$VIAB_URL"fi
# 5. Accept EULA and Set Base Propertiesecho "eula=true" > eula.txtecho "server-port=25565" > server.propertiesecho "online-mode=false" >> server.properties
# 6. Configure EaglerXServer to listen on Hugging Face Port 7860# (Hugging Face ONLY exposes 7860, so Eaglercraft must use it)cat << 'EOF' > plugins/EaglercraftXServer/listeners.ymllisteners:- address: 0.0.0.0:7860 motd: "&dEaglercraftX on Hugging Face\n&ePowered by EaglerXServer" max_players: 60 online_mode: falseEOF
echo "========================================="echo " Starting EaglerXServer "echo "========================================="
# 7. Start the Serverexec java -Xms2G -Xmx2G -jar server.jar noguistart.shAdded+65