mirror of
https://github.com/msmhq/msm.git
synced 2024-08-30 18:12:35 +00:00
Added server "jar" command which sets for use a server jar.
Also when creating a new server, the latest minecraft jar is used by default (not currently overridable.)
This commit is contained in:
parent
adccec2f24
commit
856eedfade
45
msm
45
msm
@ -632,6 +632,12 @@ server_create() {
|
||||
as_user "$USERNAME" "touch '$SERVER_STORAGE_PATH/$1/$DEFAULT_OPS'"
|
||||
as_user "$USERNAME" "touch '$SERVER_STORAGE_PATH/$1/$DEFAULT_PROPERTIES'"
|
||||
echo "Done."
|
||||
|
||||
# Now that the new server has been created, we must call init again
|
||||
# to ensure it is recognised.
|
||||
init
|
||||
|
||||
server_set_jar $(server_get_id "$1") "minecraft"
|
||||
fi
|
||||
else
|
||||
return 1
|
||||
@ -927,6 +933,38 @@ server_backup() {
|
||||
echo "Done."
|
||||
}
|
||||
|
||||
# Sets a server's jar file
|
||||
# $1: The ID of the server
|
||||
# $2: The name of the jar group
|
||||
# $3: Optionally, a specific jar to use.
|
||||
server_set_jar() {
|
||||
if [ -e "$JAR_STORAGE_PATH/$3" ]; then
|
||||
|
||||
if [ -z "$3" ]; then
|
||||
# If a specific jar file is not mentioned
|
||||
|
||||
# Download the latest version
|
||||
jargroup_getlatest "$2"
|
||||
local jar=$(get_latest_file "$JAR_STORAGE_PATH/$2")
|
||||
else
|
||||
# If a specific jar IS mentioned use that
|
||||
local jar="$JAR_STORAGE_PATH/$2/$3"
|
||||
|
||||
if [[ ! -e "$jar" ]]; then
|
||||
echo "There is no jar named \"$3\" in jargroup \"$2\"."
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ! -z "$jar" ]]; then
|
||||
as_user "${server_user[$1]}" "ln -sf $jar ${server_jar[$1]}"
|
||||
echo "Server \"${server_name[$1]}\" is now using \"$jar\"."
|
||||
fi
|
||||
else
|
||||
echo "There is no jargorup named \"$2\"."
|
||||
fi
|
||||
}
|
||||
|
||||
# Lists the players currently connected to a server
|
||||
# $1: The ID of the server
|
||||
server_connected() {
|
||||
@ -1620,6 +1658,13 @@ main() {
|
||||
server_eval $id "say ${server_complete_backup_finished[$id]}"
|
||||
fi
|
||||
;;
|
||||
jar)
|
||||
if [ -z "$3" ]; then
|
||||
echo "Invalid command."
|
||||
else
|
||||
server_set_jar $id "$3"
|
||||
fi
|
||||
;;
|
||||
whitelist|wl)
|
||||
case "$3" in
|
||||
on)
|
||||
|
Loading…
x
Reference in New Issue
Block a user