diff --git a/MC-Server-Toolkit.sh b/MC-Server-Toolkit.sh new file mode 100755 index 0000000..029efbc --- /dev/null +++ b/MC-Server-Toolkit.sh @@ -0,0 +1,98 @@ +#!/bin/bash + +## Run as Root + + +show_menu(){ + NORMAL=`echo "\033[m"` + MENU=`echo "\033[36m"` #Blue + NUMBER=`echo "\033[33m"` #yellow + FGRED=`echo "\033[41m"` + RED_TEXT=`echo "\033[31m"` + ENTER_LINE=`echo "\033[33m"` + echo -e "${MENU}*********************************************${NORMAL}" + echo -e "Spigot Minecraft Server Toolkit " + echo -e "\t by Phil | https://www.NCLtech.co.uk" + echo -e "${MENU}**${NUMBER} 1)${MENU} Setup a Server ${NORMAL}" + echo -e "${MENU}**${NUMBER} 2)${MENU} Update a Server ${NORMAL}" +## echo -e "${MENU}**${NUMBER} 3)${MENU} Install Standard Edition ${NORMAL}" +## echo -e "${MENU}**${NUMBER} 4)${MENU} Install Full Edition ${NORMAL}" +## echo -e "${MENU}**${NUMBER} 5)${MENU} Install Home Edition ${NORMAL}" +## echo -e "${MENU}**${NUMBER} 6)${MENU} Install Embedded Edition ${NORMAL}" + echo -e "${MENU}*********************************************${NORMAL}" + echo -e "${ENTER_LINE}Choose a menu option and enter or ${RED_TEXT}enter to exit. ${NORMAL}" + read opt +} + +function option_picked() { + COLOR='\033[01;31m' # bold red + RESET='\033[00;00m' # normal white + MESSAGE=${@:-"${RESET}Error: No message passed"} + echo -e "${COLOR}${MESSAGE}${RESET}" +} + + + +function setup_server() { + +} + + +function update_server() { + if [[ -f "/usr/minecraft" ]];then + echo "Updating Server..." + if [[ -f "/home/MC-Builder" ]];then + cd / + else + echo "No Snap Found" + else + echo "No Server Folder Found" +} + +function init_function() { +clear +show_menu +while [ opt != '' ] + do + if [[ $opt = "" ]]; then + exit; + else + case $opt in + 1) clear; + option_picked "Installing Server Instance"; + setup_server; + option_picked "Server Install Complete"; + exit; + ;; + + 2) clear; + option_picked "Updating Server Instance"; + update_server; + option_picked "Server Update Complete"; + exit; + ;; + x)exit; + ;; + + q)exit; + ;; + + \n)exit; + ;; + + *)clear; + option_picked "Choose One of The Options from the Menu"; + show_menu; + ;; + esac +fi +done +} + + +if [ `whoami` == "root" ]; then + init_function; +else + echo "This script needs to be run as root!" +fi +