Compare commits
No commits in common. "b9e82b96e30daeb60115eb3bac9c70bba218ba22" and "193045bd4066374d6810d6d44339375883af8c74" have entirely different histories.
b9e82b96e3
...
193045bd40
53
configure.sh
53
configure.sh
@ -1,13 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Constants
|
|
||||||
|
|
||||||
# port of the server in standalone mode, aka the open port
|
# port of the server in standalone mode, aka the open port
|
||||||
STANDALONE_PORT=25565
|
STANDALONE_PORT=25565
|
||||||
# port of the server in proxy mode, aka the internal port
|
# port of the server in proxy mode, aka the internal port
|
||||||
PROXY_PORT=25566
|
PROXY_PORT=25566
|
||||||
# installs ViaVersion on BungeeCord and standalone mode, removes it in Velocity mode
|
# installs ViaVersion on BungeeCord and standalone mode, removes it in Velocity mode
|
||||||
MANAGE_VIA_VERSION=false
|
MANAGE_VIA_VERSION=true
|
||||||
# installs ViaBackwards on BungeeCord and standalone mode, removes it in Velocity mode
|
# installs ViaBackwards on BungeeCord and standalone mode, removes it in Velocity mode
|
||||||
MANAGE_VIA_BACKWARDS=$MANAGE_VIA_VERSION
|
MANAGE_VIA_BACKWARDS=$MANAGE_VIA_VERSION
|
||||||
|
|
||||||
@ -20,11 +18,6 @@ VIA_VERSION_REPO="ViaVersion/ViaVersion"
|
|||||||
# Github repo of ViaBackwards project
|
# Github repo of ViaBackwards project
|
||||||
VIA_BACKWARDS_REPO="ViaVersion/ViaBackwards"
|
VIA_BACKWARDS_REPO="ViaVersion/ViaBackwards"
|
||||||
|
|
||||||
# Runtime variables
|
|
||||||
|
|
||||||
quiet=false
|
|
||||||
|
|
||||||
|
|
||||||
function main {
|
function main {
|
||||||
|
|
||||||
# parse arguments
|
# parse arguments
|
||||||
@ -39,33 +32,33 @@ function main {
|
|||||||
"velocity")
|
"velocity")
|
||||||
velocity=true
|
velocity=true
|
||||||
if $bungeecord || $standalone; then
|
if $bungeecord || $standalone; then
|
||||||
err "argument velocity can't be used together with bungeecord or standalone"
|
echo "argument velocity can't be used together with bungeecord or standalone"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
"bungeecord")
|
"bungeecord")
|
||||||
bungeecord=true
|
bungeecord=true
|
||||||
if $velocity || $standalone; then
|
if $velocity || $standalone; then
|
||||||
err "argument bungeecord can't be used together with velocity or standalone"
|
echo "argument bungeecord can't be used together with velocity or standalone"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
"standalone")
|
"standalone")
|
||||||
standalone=true
|
standalone=true
|
||||||
if $bungeecord || $velocity; then
|
if $bungeecord || $velocity; then
|
||||||
err "argument standalone can't be used together with bungeecord or velocity"
|
echo "argument standalone can't be used together with bungeecord or velocity"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
"--fetch")
|
"--fetch")
|
||||||
fetch=true
|
fetch=true
|
||||||
quiet=true
|
|
||||||
;;
|
|
||||||
"--quiet" | "-q")
|
|
||||||
quiet=true
|
|
||||||
;;
|
;;
|
||||||
"--help")
|
"--help")
|
||||||
help=true
|
help=true
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
err "Unknown argument: $arg"
|
echo "Unknown argument: $arg"
|
||||||
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@ -83,7 +76,6 @@ function main {
|
|||||||
echo "OPTIONS:"
|
echo "OPTIONS:"
|
||||||
echo " --fetch - print the current mode before reconfiguring the server. Nothing else will be printed."
|
echo " --fetch - print the current mode before reconfiguring the server. Nothing else will be printed."
|
||||||
echo " --help - show this message"
|
echo " --help - show this message"
|
||||||
echo " -q --quiet - Dont print any output, except for output which is caused by --fetch"
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -102,7 +94,6 @@ function main {
|
|||||||
|
|
||||||
# Velocity
|
# Velocity
|
||||||
if $velocity; then
|
if $velocity; then
|
||||||
info "Configuring for Velocity"
|
|
||||||
enable_online_mode false
|
enable_online_mode false
|
||||||
set_port "$PROXY_PORT"
|
set_port "$PROXY_PORT"
|
||||||
enable_velocity true
|
enable_velocity true
|
||||||
@ -116,7 +107,6 @@ function main {
|
|||||||
|
|
||||||
# BungeeCord
|
# BungeeCord
|
||||||
elif $bungeecord; then
|
elif $bungeecord; then
|
||||||
info "Configuring for BungeeCord"
|
|
||||||
enable_online_mode false
|
enable_online_mode false
|
||||||
set_port "$PROXY_PORT"
|
set_port "$PROXY_PORT"
|
||||||
enable_velocity false
|
enable_velocity false
|
||||||
@ -130,7 +120,6 @@ function main {
|
|||||||
|
|
||||||
# standalone
|
# standalone
|
||||||
elif $standalone; then
|
elif $standalone; then
|
||||||
info "Configuring for standalone mode"
|
|
||||||
enable_online_mode true
|
enable_online_mode true
|
||||||
set_port "$STANDALONE_PORT"
|
set_port "$STANDALONE_PORT"
|
||||||
enable_velocity false
|
enable_velocity false
|
||||||
@ -188,7 +177,6 @@ function update_plugin {
|
|||||||
local plugin_name=$1
|
local plugin_name=$1
|
||||||
local repo=$2
|
local repo=$2
|
||||||
remove_plugin $plugin_name
|
remove_plugin $plugin_name
|
||||||
info "Downloading latest version of $plugin_name..."
|
|
||||||
download_jar_from_github $repo "plugins/"
|
download_jar_from_github $repo "plugins/"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,28 +187,7 @@ function download_jar_from_github {
|
|||||||
local repo=$1
|
local repo=$1
|
||||||
local dst=$2
|
local dst=$2
|
||||||
local url=$(curl -s "https://api.github.com/repos/$repo/releases/latest" | jq -r '.assets[] | select(.name | endswith(".jar")) | .browser_download_url')
|
local url=$(curl -s "https://api.github.com/repos/$repo/releases/latest" | jq -r '.assets[] | select(.name | endswith(".jar")) | .browser_download_url')
|
||||||
if $quiet; then
|
wget -qP "$dst" "$url"
|
||||||
wget -qP "$dst" "$url"
|
|
||||||
else
|
|
||||||
wget -P "$dst" "$url"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Print something unless quiet flag has been set
|
|
||||||
#
|
|
||||||
# Usage: info <msg>
|
|
||||||
function info {
|
|
||||||
if ! $quiet; then
|
|
||||||
echo "$1"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Shows ans error message and exits the program with code 1
|
|
||||||
#
|
|
||||||
# Usage: err <msg>
|
|
||||||
function err {
|
|
||||||
echo "$1"
|
|
||||||
exit 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user