mirror of
https://github.com/parkervcp/eggs.git
synced 2024-11-23 04:52:52 +08:00
2ab04193ee
Add option to select custom Forge version with SpongeForge. Also checkes if custom Forge version is compatible with version of SpongeForge. Fixed output with undefined variable
71 lines
9.3 KiB
JSON
71 lines
9.3 KiB
JSON
{
|
|
"_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO",
|
|
"meta": {
|
|
"version": "PTDL_v2",
|
|
"update_url": null
|
|
},
|
|
"exported_at": "2023-11-03T15:54:30+01:00",
|
|
"name": "SpongeForge",
|
|
"author": "parker@parkervcp.com",
|
|
"description": "A community-driven open source Minecraft: Java Edition modding platform.",
|
|
"features": [
|
|
"eula",
|
|
"java_version",
|
|
"pid_limit"
|
|
],
|
|
"docker_images": {
|
|
"Java 8": "ghcr.io\/pterodactyl\/yolks:java_8",
|
|
"Java 11": "ghcr.io\/pterodactyl\/yolks:java_11",
|
|
"Java 16": "ghcr.io\/pterodactyl\/yolks:java_16",
|
|
"Java 17": "ghcr.io\/pterodactyl\/yolks:java_17",
|
|
"Java 18": "ghcr.io\/pterodactyl\/yolks:java_18"
|
|
},
|
|
"file_denylist": [],
|
|
"startup": "java -Xms128M -Xmx{{SERVER_MEMORY}}M -jar {{SERVER_JARFILE}}",
|
|
"config": {
|
|
"files": "{\r\n \"server.properties\": {\r\n \"parser\": \"properties\",\r\n \"find\": {\r\n \"server-ip\": \"0.0.0.0\",\r\n \"server-port\": \"{{server.build.default.port}}\",\r\n \"query.port\": \"{{server.build.default.port}}\"\r\n }\r\n }\r\n}",
|
|
"startup": "{\r\n \"done\": \")! For help, type \",\r\n \"userInteraction\": [\r\n \"Go to eula.txt for more info.\"\r\n ]\r\n}",
|
|
"logs": "{}",
|
|
"stop": "stop"
|
|
},
|
|
"scripts": {
|
|
"installation": {
|
|
"script": "#!\/bin\/bash\r\n# SpongeForge Installation Script\r\n#\r\n# Server Files: \/mnt\/server\r\napt update\r\napt install -y jq curl\r\n\r\nmkdir -p \/mnt\/server\r\ncd \/mnt\/server\r\n\r\n#Function to Compare Strings in Dot-Separated Version Format (can comapre Versions with unequal lengths)\r\n#returns 1 if version 1 is less than version 2, and 0 if version 1 is greater than version 2\r\nvercomp() {\r\n if [[ $1 == $2 ]]\r\n then\r\n return 1\r\n fi\r\n local IFS=.\r\n local i ver1=($1) ver2=($2)\r\n # fill empty fields in ver1 with zeros\r\n for ((i=${#ver1[@]}; i<${#ver2[@]}; i++))\r\n do\r\n ver1[i]=0\r\n done\r\n for ((i=0; i<${#ver1[@]}; i++))\r\n do\r\n if [[ -z ${ver2[i]} ]]\r\n then\r\n # fill empty fields in ver2 with zeros\r\n ver2[i]=0\r\n fi\r\n if ((10#${ver1[i]} > 10#${ver2[i]}))\r\n then\r\n return 0\r\n fi\r\n if ((10#${ver1[i]} < 10#${ver2[i]}))\r\n then\r\n return 1\r\n fi\r\n done\r\n return 1\r\n}\r\n\r\n# Remove spaces from the version number to avoid issues with curl\r\nFORGE_VERSION=\"$(echo \"$FORGE_VERSION\" | tr -d ' ')\"\r\n\r\n#Adding .jar when not ending by SERVER_JARFILE\r\nif [[ ! ${SERVER_JARFILE} = *\\.jar ]]; then\r\n SERVER_JARFILE=\"${SERVER_JARFILE}.jar\"\r\nfi\r\n\r\n\r\nif [ -z ${SF_VERSION} ] || [ \"$(curl -s https:\/\/dl-api.spongepowered.org\/v1\/org.spongepowered\/spongeforge\/downloads\/${SF_VERSION})\" == \"Unknown version\" ]; then\r\n echo -e \"defaulting to recommended\"\r\n SF_VERSION=\"recommended\"\r\nfi\r\n\r\nif [ \"${SF_VERSION}\" == \"recommended\" ]; then\r\n echo -e \"using recommended SpongeForge version\"\r\n SF_VERSION=$(curl -s https:\/\/dl-api.spongepowered.org\/v1\/org.spongepowered\/spongeforge\/downloads\/recommended | jq -r '.version')\r\n echo -e \"found SpongeForge Version ${SF_VERSION}\"\r\n SF_DL_LINK=$(curl -s https:\/\/dl-api.spongepowered.org\/v1\/org.spongepowered\/spongeforge\/downloads\/recommended | jq -r '.artifacts.\"\".url')\r\n FORGE_DOWNLOAD_VERSION=$(curl -s https:\/\/dl-api.spongepowered.org\/v1\/org.spongepowered\/spongeforge\/downloads\/recommended | jq -r '.dependencies.forge')\r\n echo -e \"found Forge Version ${FORGE_DOWNLOAD_VERSION}\"\r\n MC_VERSION=$(curl -s https:\/\/dl-api.spongepowered.org\/v1\/org.spongepowered\/spongeforge\/downloads\/${SF_VERSION} | jq -r '.dependencies.minecraft')\r\nelif [ \"${SF_VERSION}\" == \"latest\" ]; then\r\n echo -e \"using latest SpongForge version\"\r\n SF_VERSION=$(curl -s https:\/\/dl-api.spongepowered.org\/v1\/org.spongepowered\/spongeforge | jq -r '.buildTypes.stable.latest.version')\r\n echo -e \"found SpongeForge Version ${SF_VERSION}\"\r\n SF_DL_LINK=$(curl -s https:\/\/dl-api.spongepowered.org\/v1\/org.spongepowered\/spongeforge\/downloads\/${SF_VERSION} | jq -r '.artifacts.\"\".url')\r\n FORGE_DOWNLOAD_VERSION=$(curl -s https:\/\/dl-api.spongepowered.org\/v1\/org.spongepowered\/spongeforge\/downloads\/${SF_VERSION} | jq -r '.dependencies.forge')\r\n MC_VERSION=$(curl -s https:\/\/dl-api.spongepowered.org\/v1\/org.spongepowered\/spongeforge\/downloads\/${SF_VERSION} | jq -r '.dependencies.minecraft')\r\nelse\r\n echo -e \"found SpongeForge Version ${SF_VERSION}\"\r\n SF_DL_LINK=$(curl -s https:\/\/dl-api.spongepowered.org\/v1\/org.spongepowered\/spongeforge\/downloads\/${SF_VERSION} | jq -r '.artifacts.\"\".url')\r\n FORGE_DOWNLOAD_VERSION=$(curl -s https:\/\/dl-api.spongepowered.org\/v1\/org.spongepowered\/spongeforge\/downloads\/${SF_VERSION} | jq -r '.dependencies.forge')\r\n echo -e \"found Forge Version ${FORGE_DOWNLOAD_VERSION}\"\r\n MC_VERSION=$(curl -s https:\/\/dl-api.spongepowered.org\/v1\/org.spongepowered\/spongeforge\/downloads\/${SF_VERSION} | jq -r '.dependencies.minecraft')\r\nfi\r\n\r\nif [[ ! -z ${FORGE_VERSION} ]]; then\r\n if curl --output \/dev\/null --silent --head --fail https:\/\/maven.minecraftforge.net\/net\/minecraftforge\/forge\/${FORGE_VERSION}\/forge-${FORGE_VERSION}-installer.jar; then\r\n echo -e \"Custom Forge Version found.\"\r\n if [ ${MC_VERSION} != ${FORGE_VERSION%%-*} ]; then\r\n echo -e \"You need Forge Minecraft Version ${MC_VERSION}. Exiting now!\"\r\n exit 1\r\n elif vercomp ${FORGE_DOWNLOAD_VERSION} ${FORGE_VERSION##*-}; then\r\n echo -e \"Forge Build Version must be greater than ${FORGE_DOWNLOAD_VERSION}. Exiting now!\"\r\n exit 1\r\n else\r\n FORGE_DOWNLOAD_VERSION=${FORGE_VERSION##*-}\r\n fi\r\n else\r\n echo -e \"Forge Version not found. Check if Version is spelled right. Exiting now!\"\r\n exit 1\r\n fi\r\nfi\r\n\r\nFORGE_DL_LINK=https:\/\/maven.minecraftforge.net\/net\/minecraftforge\/forge\/${MC_VERSION}-${FORGE_DOWNLOAD_VERSION}\/forge-${MC_VERSION}-${FORGE_DOWNLOAD_VERSION}\r\n\r\nif [ -f server.jar ] && [ $(sha1sum server.jar | awk '{ print $1 }') == $(curl -s ${FORGE_DL_LINK}-universal.jar.sha1) ]; then\r\n echo -e \"Already have the correct forge version\"\r\nelse\r\n echo -e \"Downloading forge version ${MC_VERSION} - ${FORGE_DOWNLOAD_VERSION}\"\r\n echo -e \"running: curl -s -o installer.jar -o ${FORGE_DL_LINK}-installer.jar\"\r\n curl -s -o installer.jar ${FORGE_DL_LINK}-installer.jar\r\n echo -e \"running: curl -s -o ${SERVER_JARFILE} -o ${FORGE_DL_LINK}-universal.jar\"\r\n curl -s -o ${SERVER_JARFILE} ${FORGE_DL_LINK}-universal.jar\r\n java -jar installer.jar --installServer\r\n rm installer.jar forge-${MC_VERSION}-${FORGE_DOWNLOAD_VERSION}-universal.jar forge-${MC_VERSION}-${FORGE_DOWNLOAD_VERSION}.jar\r\nfi\r\n\r\nif [ ! -d \/mnt\/server\/mods\/ ]; then\r\n echo -e \"making mods directory\"\r\n mkdir -p \/mnt\/server\/mods\/\r\nfi\r\n\r\nif [ -f \/mnt\/server\/mods\/spongeforge*.jar ]; then\r\n mkdir -p \/mnt\/server\/mods\/old\/\r\n mv -f \/mnt\/server\/mods\/spongeforge*.jar \/mnt\/server\/mods\/old\/spongeforge*.jar\r\nfi \r\n\r\necho -e \"running: curl -s ${SF_DL_LINK} -o \/mnt\/server\/mods\/spongeforge-${SF_VERSION}.jar\"\r\ncurl -s ${SF_DL_LINK} -o \/mnt\/server\/mods\/spongeforge-${SF_VERSION}.jar\r\n\r\nif [ ! -f server.properties ]; then\r\n echo -e \"Downloading MC server.properties\"\r\n curl -o server.properties https:\/\/raw.githubusercontent.com\/parkervcp\/eggs\/master\/game_eggs\/minecraft\/java\/server.properties\r\nfi\r\n\r\necho -e \"Install for SpongeForge is complete\"",
|
|
"container": "openjdk:8-jre-slim",
|
|
"entrypoint": "bash"
|
|
}
|
|
},
|
|
"variables": [
|
|
{
|
|
"name": "Server Jar File",
|
|
"description": "The name of the Jarfile to use when running Forge Mod.",
|
|
"env_variable": "SERVER_JARFILE",
|
|
"default_value": "server.jar",
|
|
"user_viewable": true,
|
|
"user_editable": true,
|
|
"rules": "required|regex:\/^([\\w\\d._-]+)(\\.jar)$\/",
|
|
"field_type": "text"
|
|
},
|
|
{
|
|
"name": "SpongeForge Version",
|
|
"description": "Example 1.12.2-2825-7.1.6\r\n\r\nIf the version fails it defaults to recommended",
|
|
"env_variable": "SF_VERSION",
|
|
"default_value": "recommended",
|
|
"user_viewable": true,
|
|
"user_editable": true,
|
|
"rules": "required|string",
|
|
"field_type": "text"
|
|
},
|
|
{
|
|
"name": "Forge Version",
|
|
"description": "Optional, only needed for custom Forge Version with Sponge.\r\n\r\nThe full exact version.\r\nEx. 1.15.2-31.2.4\r\n\r\nIf it fails to download the server files or to verify compatibility to the Sponge Version it will fail to install.",
|
|
"env_variable": "FORGE_VERSION",
|
|
"default_value": "",
|
|
"user_viewable": true,
|
|
"user_editable": true,
|
|
"rules": "nullable|regex:\/^[0-9\\.\\-]+$\/",
|
|
"field_type": "text"
|
|
}
|
|
]
|
|
}
|