Fix some issues with restore points in SubCreator

This commit is contained in:
ME1312 2020-08-22 22:11:05 -04:00
parent 6e60138a79
commit d3e6d3e579
No known key found for this signature in database
GPG Key ID: FEFFE2F698E88FA8
4 changed files with 50 additions and 31 deletions

View File

@ -18,6 +18,20 @@ function __DL() {
curl -o "$1" "$2"; return $?
fi
}
function __Restore() {
if [[ -f "Forge.old.jar.x" ]]; then
if [[ -f "Forge.jar" ]]; then
rm -Rf Forge.jar
fi
mv Forge.old.jar.x Forge.jar
fi
if [[ -f "mods/Sponge.old.jar.x" ]]; then
if [[ -f "mods/Sponge.jar" ]]; then
rm -Rf mods/Sponge.jar
fi
mv mods/Sponge.old.jar.x mods/Sponge.jar
fi
}
echo Downloading the Minecraft Forge Installer...
__DL "forge-$mcf_version-installer.jar" "http://files.minecraftforge.net/maven/net/minecraftforge/forge/$mcf_version/forge-$mcf_version-installer.jar"; __RETURN=$?
if [[ $__RETURN -eq 0 ]]; then
@ -25,12 +39,6 @@ if [[ $__RETURN -eq 0 ]]; then
"$java" -jar "forge-$mcf_version-installer.jar" --installServer; __RETURN=$?
if [[ $__RETURN -eq 0 ]]; then
echo Cleaning Up...
if [[ -f "Forge.jar" ]]; then
if [[ -f "Forge.old.jar.x" ]]; then
rm -Rf Forge.old.jar.x
fi
mv Forge.jar Forge.old.jar.x
fi
if [[ ! -d "mods" ]]; then
mkdir mods
fi
@ -51,23 +59,13 @@ if [[ $__RETURN -eq 0 ]]; then
exit 0
else
echo ERROR: Failed downloading Sponge. Is SpongePowered.org down?
if [[ -f "mods/Sponge.old.jar.x" ]]; then
if [[ -f "mods/Sponge.jar" ]]; then
rm -Rf mods/Sponge.jar
fi
mv mods/Sponge.old.jar.x mods/Sponge.jar
fi
if [[ -f "Forge.old.jar.x" ]]; then
if [[ -f "Forge.jar" ]]; then
rm -Rf Forge.jar
fi
mv Forge.old.jar.x Forge.jar
fi
__Restore
rm -Rf "$0"
exit 5
fi
else
echo ERROR: The Installer exited with an error. Please try again
__Restore
rm -Rf "forge-$mcf_version-installer.jar"
rm -Rf "forge-$mcf_version-installer.jar.log"
rm -Rf "$0"

View File

@ -14,6 +14,14 @@ function __DL() {
curl -o "$1" "$2"; return $?
fi
}
function __Restore() {
if [[ -f "Paper.old.jar.x" ]]; then
if [[ -f "Paper.jar" ]]; then
rm -Rf Paper.jar
fi
mv Paper.old.jar.x Paper.jar
fi
}
echo Downloading Paper...
if [[ -f "Paper.jar" ]]; then
if [[ -f "Paper.old.jar.x" ]]; then
@ -23,12 +31,22 @@ if [[ -f "Paper.jar" ]]; then
fi
__DL Paper.jar "https://papermc.io/api/v1/paper/$version/latest/download"; __RETURN=$?
if [[ $__RETURN -eq 0 ]]; then
echo Cleaning Up...
rm -Rf "$0"
exit 0
if [[ $(stat -c%s "Paper.jar") -ge 1000000 ]]; then
echo Cleaning Up...
rm -Rf "$0"
exit 0
else
echo ERROR: Received invalid jarfile when requesting Paper version $version:
cat Paper.jar
printf "\n"
__Restore
rm -Rf "$0"
exit 4
fi
else
echo ERROR: Failed downloading Paper. Is PaperMC.io down?
rm -Rf "$0"
exit 3
echo ERROR: Failed downloading Paper. Is PaperMC.io down?
__Restore
rm -Rf "$0"
exit 3
fi
exit 2

View File

@ -14,6 +14,14 @@ function __DL() {
curl -o "$1" "$2"; return $?
fi
}
function __Restore() {
if [[ -f "Sponge.old.jar.x" ]]; then
if [[ -f "Sponge.jar" ]]; then
rm -Rf Sponge.jar
fi
mv Sponge.old.jar.x Sponge.jar
fi
}
echo Downloading SpongeVanilla...
if [[ -f "Sponge.jar" ]]; then
if [[ -f "Sponge.old.jar.x" ]]; then
@ -28,12 +36,7 @@ if [[ $__RETURN -eq 0 ]]; then
exit 0
else
echo ERROR: Failed downloading Sponge. Is SpongePowered.org down?
if [[ -f "Sponge.old.jar.x" ]]; then
if [[ -f "Sponge.jar" ]]; then
rm -Rf Sponge.jar
fi
mv Sponge.old.jar.x Sponge.jar
fi
__Restore
rm -Rf "$0"
exit 3
fi

View File

@ -779,7 +779,7 @@ public class SubCommand {
sender.sendMessage("Invalid port number");
break;
case 0:
sender.sendMessage("Creating subserver " + args[1]);
sender.sendMessage("Creating subserver " + args[0]);
break;
}
}));