Skip to content

Commit

Permalink
- Added support for Forge 1.21.1 & Spigot 1.21.1
Browse files Browse the repository at this point in the history
- Reworked a lot of functions related with Forge 1.20.4+ due to Forge changing the way the forge.jar needs to be executed
- Removed forge_script_creator21 because its no longer needed
- Added new clearnup functions for Forge 1.20.4+
  • Loading branch information
BuildTools committed Aug 9, 2024
1 parent 17489ba commit ed5f9f0
Showing 1 changed file with 42 additions and 53 deletions.
95 changes: 42 additions & 53 deletions mcserver_installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1865,7 +1865,8 @@ BACKTITLE="MC-Server Installer by realTM"
TITLE="Versions"
MENU="Select the exact Version you want to install:"

OPTIONS=(1 "1.21")
OPTIONS=(1 "1.21"
2 "1.21.1")

CHOICE=$(dialog --clear \
--backtitle "$BACKTITLE" \
Expand All @@ -1882,6 +1883,11 @@ case $CHOICE in
ver=1.21
forge_custom_version
;;
2)
#1.21.1
ver=1.21.1
forge_custom_version
;;

esac

Expand Down Expand Up @@ -1911,15 +1917,29 @@ function forge_installer_routine {
ram_version_checker
}

function forge_new_init {

mv forge*.jar server.jar
rm run.bat
rm run.sh
rm user_jvm_args.txt

}

function forge_new_installer_routine {
forge_installer
rm *installer.jar
rm *.log
if [[ $ver = "1.17"* ]]
then
ram_version_checker
elif [[ $ver = "1.20.3" ]] || [[ $ver = "1.20.4" ]]
then
forge_new_init
new_select_ram_17
elif [[ $ver = "1.20.6" ]] || [[ $ver = "1.21"* ]]
then
forge_new_init
new_select_ram_21
else
new_select_ram_17
Expand Down Expand Up @@ -2097,12 +2117,12 @@ clear

function decide_script_version {

if [[ $ver = "1.20.3" ]]
if [[ $ver = "1.20.3" ]] || [[ $ver = "1.20.4" ]]
then
script_creator_17
elif [[ $ver = "1.20.6" ]] || [[ $ver = "1.21"* ]]
then
forge_script_creator_21
script_creator_21
else
forge_script_creator_17
fi
Expand Down Expand Up @@ -2137,49 +2157,6 @@ esac

}

function forge_script_creator_21 {
rm run.bat
rm run.sh
touch user_jvm_args.txt
echo 'function compare {' > start.sh
echo ' if [[ $java_version = "21"* ]]' >> start.sh
echo ' then' >> start.sh
echo ' javaversion=21' >> start.sh
echo ' elif [[ $java_version = "17."* ]]' >> start.sh
echo ' then' >> start.sh
echo ' javaversion=17' >> start.sh
echo ' elif [[ $java_version = "16."* ]]' >> start.sh
echo ' then' >> start.sh
echo ' javaversion=16' >> start.sh
echo ' elif [[ $java_version = "1.8"* ]]' >> start.sh
echo ' then' >> start.sh
echo ' javaversion=8' >> start.sh
echo ' fi' >> start.sh
echo '}' >> start.sh
echo '' >> start.sh
echo 'function version_grab {' >> start.sh
echo ' java_version=$(java -version 2>&1 | awk -F[\"_] '\''NR==1{print $2}'\'')' >> start.sh
echo ' compare' >> start.sh
echo '}' >> start.sh
echo '' >> start.sh
echo 'function check_current21 {' >> start.sh
echo '' >> start.sh
echo ' if [[ ! $javaversion -eq 21 ]]' >> start.sh
echo ' then' >> start.sh
echo ' dialog --title '\''MC-Server Installer by realTM'\'' --msgbox '\''You currently have Java '\''$javaversion'\'' selected, but Java 21 is required.\nChange it to Java 21 in the following menu'\'' 10 60' >> start.sh
echo ' sudo update-alternatives --config java' >> start.sh
echo ' fi' >> start.sh
echo '}' >> start.sh
echo '' >> start.sh
echo 'version_grab' >> start.sh
echo 'check_current21' >> start.sh
echo '' >> start.sh
echo "screen -S Minecraft java @user_jvm_args.txt @libraries/net/minecraftforge/forge/$ver-$forge_ex_version_number/unix_args.txt \"\$@"\" >> start.sh
chmod +x start.sh
echo "" >> user_jvm_args.txt
echo "-Xmx$ram_third"G"" >> user_jvm_args.txt
}

function forge_script_creator_17 {
rm run.bat
rm run.sh
Expand Down Expand Up @@ -2248,14 +2225,17 @@ function forge_installer {

function forge_new_version_check {

if [[ $ver = "1.20.3" ]]
if [[ $ver = "1.20.6" ]] || [[ $ver = "1.21"* ]]
then
clear
check_java21
versio#
version_grab
check_current21
normal_forge
elif [[ $ver = "1.17"* ]] || [[ $ver = "1.18"* ]] || [[ $ver = "1.19"* ]] || [[ $ver = "1.20"* ]] || [[ $ver = "1.21"* ]]
folder_creator_forge
cd $dirname
wget https://maven.minecraftforge.net/net/minecraftforge/forge/$ver-$forge_ex_version_number/forge-$ver-$forge_ex_version_number-installer.jar
forge_new_installer_routine
elif [[ $ver = "1.17"* ]] || [[ $ver = "1.18"* ]] || [[ $ver = "1.19"* ]] || [[ $ver = "1.20"* ]]
then
clear
check_java17
Expand Down Expand Up @@ -3052,7 +3032,8 @@ BACKTITLE="MC-Server Installer by realTM"
TITLE="Versions"
MENU="Select the exact Version you want to install:"

OPTIONS=(1 "1.21")
OPTIONS=(1 "1.21"
2 "1.21.1")

CHOICE=$(dialog --clear \
--backtitle "$BACKTITLE" \
Expand All @@ -3072,6 +3053,14 @@ case $CHOICE in
check_current21
spigot_installer_routine
;;
2)
#1.21.1
ver=1.21.1
check_java21
version_grab
check_current21
spigot_installer_routine
;;

esac

Expand Down Expand Up @@ -3130,7 +3119,7 @@ install_spigot () {

setup_spigot_server () {

if [[ $ver = "1.20.6" ]] || [[ $ver = "1.21" ]]
if [[ $ver = "1.20.6" ]] || [[ $ver = "1.21"* ]]
then
select_ram_21
elif [[ $ver = "1.18"* ]] || [[ $ver = "1.19"* ]] || [[ $ver = "1.20"* ]]
Expand Down Expand Up @@ -3641,7 +3630,7 @@ distro_check () {
}

## Script Version
scriptversion="13.2"
scriptversion="14.0"
##

## Latest Version
Expand Down

0 comments on commit ed5f9f0

Please sign in to comment.