-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvement: Combine start and download scripts. Improve and expand file-checks. #81
Comments
This works as expected. It's a marriage of dos and PowerShell, which is what you're clearly doing. IF NOT EXIST minecraft_server.1.16.5.jar powershell -Command "(New-Object Net.WebClient).DownloadFile('https://launcher.mojang.com/v1/objects/1b557e7b033b583cd9f66746b7a9ab1ec1673ced/server.jar', 'minecraft_server.1.16.5.jar')" Meaning, you can slide it right into the top of your start-forge.bat script. And the other thing I provided for the start-forge.sh. |
So, update start-forge.sh script would look like this: if [ ! -e "minecraft_server.1.16.5.jar" ]; then
wget -O minecraft_server.1.16.5.jar https://launcher.mojang.com/v1/objects/1b557e7b033b583cd9f66746b7a9ab1ec1673ced/server.jar
fi
java -Xmx8G -Xms8G -jar forge.jar --nogui and the updated start-forge.bat like this: IF NOT EXIST minecraft_server.1.16.5.jar powershell -Command "(New-Object Net.WebClient).DownloadFile('https://launcher.mojang.com/v1/objects/1b557e7b033b583cd9f66746b7a9ab1ec1673ced/server.jar', 'minecraft_server.1.16.5.jar')"
java -Xmx8G -Xms8G -jar forge.jar --nogui
pause |
Heya Kreezxil, thanks for putting in so much work on this issue! I'm definitely going to take a closer look at this. Currently busy with #80 🙂 I'll let you know when I start working on this. Cheers, |
Yep. Might as well check for the existence of eula.txt too and if it doesn't exist create a file with one line
Right before running the server. Basically, what the Minecraft server hosting companies do. === Thus ===Linux (start-forge.sh)if [ ! -e "minecraft_server.1.16.5.jar" ]; then
wget -O minecraft_server.1.16.5.jar https://launcher.mojang.com/v1/objects/1b557e7b033b583cd9f66746b7a9ab1ec1673ced/server.jar
fi
if [ ! -e "eula.txt" ]; then
echo "eula=true" > eula.txt
fi
java -Xmx8G -Xms8G -jar forge.jar --nogui Dos/PS (start-forge.bat)IF NOT EXIST minecraft_server.1.16.5.jar powershell -Command "(New-Object Net.WebClient).DownloadFile('https://launcher.mojang.com/v1/objects/1b557e7b033b583cd9f66746b7a9ab1ec1673ced/server.jar', 'minecraft_server.1.16.5.jar')"
IF NOT EXIST eula.txt echo "eula=true" > eula.txt
java -Xmx8G -Xms8G -jar forge.jar --nogui
pause |
Right, that's all I can think of, implementing these on my side manually on each new server pack release. |
Might also be a good idea to add a check for the forge/fabric jars, so if a user does not let ServerPackCreator install the server, the script can handle that, too. |
yep, I was just concentrating on what I know.
…On Fri, Oct 1, 2021 at 2:29 PM Griefed ***@***.***> wrote:
Might also be a good idea to add a check for the forge/fabric jars, so if
a user does not let ServerPackCreator install the server, the script can
handle that, too.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#81 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA5TJCFWA3WFXGQJXM2GBIDUEYDZZANCNFSM5FDAA2WA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
So, for the bash-script for Forge I've now got this: #!/usr/bin/env bash
# Start script generated by ServerPackCreator.
# This script checks for the Minecraft and Forge JAR-files, and if they are not found, they are downloaded.
# If everything is in order, the server is started.
MINECRAFT="1.16.5"
FORGE="36.2.4"
SERVER="1b557e7b033b583cd9f66746b7a9ab1ec1673ced"
ARGS="-Xmx8192M -Xms1024M -XX:+UseG1GC -Dsun.rmi.dgc.server.gcInterval=2147483646 -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=51 -XX:G1HeapRegionSize=32M -XX:InitiatingHeapOccupancyPercent=10 -XX:G1MixedGCLiveThresholdPercent=50"
if [[ ! -s "forge.jar" ]];then
echo "Forge Server JAR-file not found. Downloading installer...";
wget -O forge-installer.jar https://files.minecraftforge.net/maven/net/minecraftforge/forge/$MINECRAFT-$FORGE/forge-$MINECRAFT-$FORGE-installer.jar;
if [[ -s "forge-installer.jar" ]]; then
echo "Installer downloaded. Installing...";
java -jar forge-installer.jar --installServer;
mv forge-$MINECRAFT-$FORGE.jar forge.jar;
if [[ -s "forge.jar" ]];then
rm -f forge-installer.jar;
echo "Installation complete. forge-installer.jar deleted.";
fi
else
echo "forge-installer.jar not found. Maybe the Forges servers are having trouble.";
echo "Please try again in a couple of minutes.";
fi
else
echo "forge.jar present. Moving on..."
fi
if [[ ! -s "minecraft_server.$MINECRAFT.jar" ]];then
echo "Minecraft Server JAR-file not found. Downloading...";
wget -O minecraft_server.$MINECRAFT.jar https://launcher.mojang.com/v1/objects/$SERVER/server.jar;
else
echo "minecraft_server.$MINECRAFT.jar present. Moving on..."
fi
if [[ ! -s "eula.txt" ]];then
echo "eula.txt not found. Creating...";
echo "#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula)." > eula.txt;
echo "eula=true" >> eula.txt;
else
echo "eula.txt present. Moving on...";
fi
echo "Starting server...";
echo "Minecraft version: $MINECRAFT";
echo "Forge version: $FORGE";
echo "Java args: $ARGS";
java $ARGS -jar forge.jar --nogui
Now for the batch/ps script. |
Batch script for Forge: :: Start script generated by ServerPackCreator.
:: This script checks for the Minecraft and Forge JAR-files, and if they are not found, they are downloaded.
:: If everything is in order, the server is started.
@ECHO off
SET MINECRAFT="1.16.5"
SET FORGE="36.2.4"
SET SERVER="1b557e7b033b583cd9f66746b7a9ab1ec1673ced"
SET ARGS=-Xmx8192M -Xms1024M -XX:+UseG1GC -Dsun.rmi.dgc.server.gcInterval=2147483646 -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=51 -XX:G1HeapRegionSize=32M -XX:InitiatingHeapOccupancyPercent=10 -XX:G1MixedGCLiveThresholdPercent=50
IF NOT EXIST forge.jar (
ECHO "Forge Server JAR-file not found. Downloading installer..."
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://files.minecraftforge.net/maven/net/minecraftforge/forge/%MINECRAFT%-%FORGE%/forge-%MINECRAFT%-%FORGE%-installer.jar', 'forge-installer.jar')"
IF EXIST forge-installer.jar (
ECHO "Installer downloaded. Installing..."
java -jar forge-installer.jar --installServer
MOVE forge-%MINECRAFT%-%FORGE%.jar forge.jar
IF EXIST forge.jar (
DEL forge-installer.jar
ECHO "Installation complete. forge-installer.jar deleted."
)
) ELSE (
ECHO "forge-installer.jar not found. Maybe the Forges servers are having trouble."
ECHO "Please try again in a couple of minutes."
)
) ELSE (
ECHO "forge.jar present. Moving on..."
)
IF NOT EXIST minecraft_server.%MINECRAFT%.jar (
ECHO "Minecraft Server JAR-file not found. Downloading..."
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://launcher.mojang.com/v1/objects/%SERVER%/server.jar', 'minecraft_server.%MINECRAFT%.jar')"
) ELSE (
ECHO "minecraft_server.%MINECRAFT%.jar present. Moving on..."
)
IF NOT EXIST eula.txt (
ECHO "eula.txt not found. Creating..."
ECHO #By changing the setting below to TRUE you are indicating your agreement to our EULA ^(https://account.mojang.com/documents/minecraft_eula^).> eula.txt
ECHO eula=true>> eula.txt
) ELSE (
ECHO "eula.txt present. Moving on..."
)
ECHO "Starting server..."
ECHO "Minecraft version: %MINECRAFT%"
ECHO "Forge version: %FORGE%"
ECHO "Java args: %ARGS%"
java %ARGS% -jar forge.jar --nogui
PAUSE |
Needless to say the Java args will be set by ServerPackCreator. That's just a placeholder, much like the download links, Minecraft and Forge versions. |
Looking good, EPIC attribute has increased by 10 |
That's the Forge Windows and Linux script templates pretty much done. Also, question: Since we are combining the scripts, thus replacing the download scripts. it would make sense to remove the option "Generate start-scripts" and have ServerPackCreator always generate said scripts for every server pack. |
sounds good. and yeah I tested what MDS pointed out and that was definitely
a thing about the args and what not for 1.17.1
…On Tue, Oct 5, 2021 at 12:38 PM Griefed ***@***.***> wrote:
That's the Forge Windows and Linux script templates pretty much done.
Now we're just missing the Fabric Windows and Linux templates and finally
the implementation of these new scripts in ServerPackCreator.
Also, question: Since we are combining the scripts, thus replacing the
download scripts. it would make sense to remove the option "Generate
start-scripts" and have ServerPackCreator always generate said scripts for
every server pack.
Otherwise we run into the issue of people not knowing how to get their
Minecraft server-jar when download a server pack zip-archive generated by
ServerPackCreator.
Thoughts?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#81 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA5TJCBSJCBPMMYQDHLLPWLUFMZ2NANCNFSM5FDAA2WA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Fabric batch script: :: Start script generated by ServerPackCreator.
:: This script checks for the Minecraft and Fabric JAR-files, and if they are not found, they are downloaded.
:: If everything is in order, the server is started.
@ECHO off
SET MINECRAFT="1.16.5"
SET FABRIC="0.12.1"
SET INSTALLER="0.8.0"
SET SERVER="1b557e7b033b583cd9f66746b7a9ab1ec1673ced"
SET ARGS=-Xmx8192M -Xms1024M -XX:+UseG1GC -Dsun.rmi.dgc.server.gcInterval=2147483646 -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=51 -XX:G1HeapRegionSize=32M -XX:InitiatingHeapOccupancyPercent=10 -XX:G1MixedGCLiveThresholdPercent=50
IF NOT EXIST fabric-server-launch.jar (
ECHO "Fabric Server JAR-file not found. Downloading installer..."
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://maven.fabricmc.net/net/fabricmc/fabric-installer/%INSTALLER%/fabric-installer-%INSTALLER%.jar', 'fabric-installer.jar')"
IF EXIST fabric-installer.jar (
ECHO "Installer downloaded. Installing..."
java -jar fabric-installer.jar server -mcversion %MINECRAFT% -loader %FABRIC% -downloadMinecraft
IF EXIST fabric-server-launch.jar (
RMDIR /S /Q .fabric-installer
DEL fabric-installer.jar
ECHO "Installation complete. fabric-installer.jar and installation files deleted."
)
) ELSE (
ECHO "fabric-installer.jar not found. Maybe the Fabric servers are having trouble."
ECHO "Please try again in a couple of minutes."
)
) ELSE (
ECHO "fabric-server-launch.jar present. Moving on..."
)
IF NOT EXIST server.jar (
ECHO "Minecraft Server JAR-file not found. Downloading..."
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://launcher.mojang.com/v1/objects/%SERVER%/server.jar', 'server.jar')"
) ELSE (
ECHO "server.jar present. Moving on..."
)
IF NOT EXIST eula.txt (
ECHO "eula.txt not found. Creating..."
ECHO #By changing the setting below to TRUE you are indicating your agreement to our EULA ^(https://account.mojang.com/documents/minecraft_eula^).> eula.txt
ECHO eula=true>> eula.txt
) ELSE (
ECHO "eula.txt present. Moving on..."
)
ECHO "Starting server..."
ECHO "Minecraft version: %MINECRAFT%"
ECHO "Fabric version: %FABRIC%"
ECHO "Java args: %ARGS%"
java %ARGS% -jar fabric-server-launch.jar --nogui
PAUSE |
Fabric shell: #!/usr/bin/env bash
# Start script generated by ServerPackCreator.
# This script checks for the Miencraft and Forge JAR-Files, and if they are not found, they are downloaded.
# If everything is in order, the server is started.
MINECRAFT="1.16.5"
FABRIC="0.12.1"
INSTALLER="0.8.0"
SERVER="1b557e7b033b583cd9f66746b7a9ab1ec1673ced"
ARGS="-Xmx8192M -Xms1024M -XX:+UseG1GC -Dsun.rmi.dgc.server.gcInterval=2147483646 -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMil>
if [[ ! -s "fabric-server-launch.jar" ]];then
echo "Fabric Server JAR-file not found. Downloading installer...";
wget -O fabric-installer.jar https://maven.fabricmc.net/net/fabricmc/fabric-installer/$INSTALLER/fabric-installer-$INSTALLER.jar;
if [[ -s "fabric-installer.jar" ]];then
echo "Installer downloaded. Installing...";
java -jar fabric-installer.jar server -mcversion $MINECRAFT -loader $FABRIC -downloadMinecraft;
if [[ -s "fabric-server-launch.jar" ]];then
rm -rf .fabric-installer;
rm -f fabric-installer.jar;
echo "Installation complete. fabric-installer.jar deleted.";
fi
else
echo "fabric-installer.jar not found. Maybe the Fabric server are having trouble.";
echo "Please try again in a couple of minutes.";
fi
else
echo "fabric-server-launch.jar present. Moving on...";
fi
if [[ ! -s "server.jar" ]];then
echo "Minecraft Server JAR-file not found. Downloading...";
wget -O server.jar https://launcher.mojang.com/v1/objects/$SERVER/server.jar;
else
echo "server.jar present. Moving on...";
fi
if [[ ! -s "eula.txt" ]];then
echo "eula.txt not found. Creating...";
echo "#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula)." > eula.txt;
echo "eula=true" >> eula.txt;
else
echo "eula.txt present. Moving on...";
fi
echo "Starting server...";
echo "Minecraft version: $MINECRAFT";
echo "Fabric version: $FABRIC";
echo "Java args: $ARGS";
java $ARGS -jar fabric-server-launch.jar --nogui |
looking good
…On Sun, Oct 10, 2021 at 7:05 AM Griefed ***@***.***> wrote:
Fabric shell:
#!/usr/bin/env bash# Start script generated by ServerPackCreator.# This script checks for the Miencraft and Forge JAR-Files, and if they are not found, they are downloaded.# If everything is in order, the server is started.
MINECRAFT="1.16.5"
FABRIC="0.12.1"
INSTALLER="0.8.0"
SERVER="1b557e7b033b583cd9f66746b7a9ab1ec1673ced"
ARGS="-Xmx8192M -Xms1024M -XX:+UseG1GC -Dsun.rmi.dgc.server.gcInterval=2147483646 -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMil>if [[ ! -s "fabric-server-launch.jar" ]];then echo "Fabric Server JAR-file not found. Downloading installer..."; wget -O fabric-installer.jar https://maven.fabricmc.net/net/fabricmc/fabric-installer/$INSTALLER/fabric-installer-$INSTALLER.jar; if [[ -s "fabric-installer.jar" ]];then echo "Installer downloaded. Installing..."; java -jar fabric-installer.jar server -mcversion $MINECRAFT -loader $FABRIC -downloadMinecraft; if [[ -s "fabric-server-launch.jar" ]];then rm -rf .fabric-installer; rm -f fabric-installer.jar; echo "Installation complete. fabric-installer.jar deleted."; fi else echo "fabric-installer.jar not found. Maybe the Fabric server are having trouble."; echo "Please try again in a couple of minutes."; fielse echo "fabric-server-launch.jar present. Moving on...";fiif [[ ! -s "server.jar" ]];then echo "Minecraft Server JAR-file not found. Downloading..."; wget -O server.jar https://launcher.mojang.com/v1/objects/$SERVER/server.jar;else echo "server.jar present. Moving on...";fiif [[ ! -s "eula.txt" ]];then echo "eula.txt not found. Creating..."; echo "#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula)." > eula.txt;
echo "eula=true" >> eula.txt;else
echo "eula.txt present. Moving on...";fi
echo "Starting server...";echo "Minecraft version: $MINECRAFT";echo "Fabric version: $FABRIC";echo "Java args: $ARGS";
java $ARGS -jar fabric-server-launch.jar --nogui
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#81 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA5TJCHEVAZBZZ4NAFFDJRLUGF6PHANCNFSM5FDAA2WA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
… scripts. Removes option to generate scripts and generates them always instead. Closes issue #81
Will be available in the next alpha release (or from the test pipeline if you so desire). scripts will no longer be called |
nice
…On Sun, Oct 10, 2021 at 11:55 AM Griefed ***@***.***> wrote:
Will be available in the next alpha release (or from the test pipeline if
you so desire). scripts will no longer be called start-<modloader>.bat|sh
but rather start.bat|sh instead, now.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#81 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA5TJCHMGCSC4LRD3W27TKTUGHARPANCNFSM5FDAA2WA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
See alpha.7 |
When the pack is created there are two scripts. one to start the forge and another to download minecraft server jar.
Use only start-forge and if the minecraft server jar is missing, then the batch coded needed to retrieve it is run.
Someone requested it on my discord. I've also had code like this before in my own scripts.
For example this is my script to download and install forge server which in it's own function will down the minecraft server jar.
I have
settings.sh
file that contains the following, so that the script after will make sense:My main start forge wrapper that I actually use, yours is good for testing tho.
So this last one, if the forge jar is missing, it will install the server so that it won't be missing. This is also why I renamed the forge server.jar to the name of the current folder, so I don't have to edit this wrapper all the time.
I'm not sure how to do this in MS DOS batch, but it can be done relatively easily in PowerShell. Which is what every Windows user should be using now.
The text was updated successfully, but these errors were encountered: