Add plugin function

This commit is contained in:
LinuxSquare 2025-04-03 22:06:28 +02:00
parent 70b205cf8e
commit 9490c876e6
2 changed files with 18 additions and 2 deletions

View file

@ -23,6 +23,7 @@ operations:
$(basename ${0}) {-v --verbose}
$(basename ${0}) {--init} [servername] [network name]
$(basename ${0}) {--datapack} [servername] [datapack dl url]
$(basename ${0}) {--plugin} [servername] [plugin dl url]
$(basename ${0}) {--start} [servername] [port] (ip)
$(basename ${0}) {--stop} [servername]
$(basename ${0}) {--restart} [servername] [port] (ip)
@ -33,8 +34,8 @@ operations:
function version() {
echo -e "Minecraft Podman Server v${PKGVER}
Copyright (C) 2024 Noveria Network
Copyright (C) 2025 Noveria Network
This program may be freely redistributed under
the terms of the ${LICENSE}"
}
@ -75,6 +76,10 @@ while true; do
shift
datapack "${1}" "${3}"
;;
--plugin)
shift
plugin "${1}" "${3}"
;;
--start)
shift
start "${1}" "${3}" "${4}"

11
utils/plugin Normal file
View file

@ -0,0 +1,11 @@
#!/usr/bin/env bash
function plugin() {
if [[ ! -d "$(getValueByKey 'PODMAN_DIRECTORY')/${1}" ]]; then
log e "Directory '${1}' does not exist!"
exit 1
fi
local dir="$(getValueByKey 'PODMAN_DIRECTORY')/${1}/data/plugins"
curl -L "${2}" -o "${dir}/($(echo ${2} | awk -F/ '{print $NF}')"
}