autocommit

This commit is contained in:
LinuxSquare 2024-04-21 16:23:16 +02:00
parent cd3a75d324
commit 92a8cfc9b7
4 changed files with 20 additions and 25 deletions

View file

@ -1,16 +0,0 @@
#!/usr/bin/env bash
function broadcast() {
local dir="$(getValueByKey 'PODMAN_DIRECTORY')/${1}"
podman exec -it "$1" rcon -m -H 127.0.0.1 -p 25575 -P $(grep -E "^rcon.password" $dir/data/server.properties | cut -d= -f2)\
tellraw @a [{\"text\":\"[SYSTEM] \",\"color\":\"red\",\"bold\":true},{\"text\": \"$2\",\"color\":\"light_purple\",\"bold\":false}]
}
function countdown() {
local dir="$(getValueByKey 'PODMAN_DIRECTORY')/${1}"
for i in {10..1}; do
podman exec -it "$1" rcon -m -H 127.0.0.1 -p 25575 -P $(grep -E "^rcon.password" $dir/data/server.properties | cut -d= -f2)\
tellraw @a [{\"text\": \"$i\",\"color\":\"light_purple\",\"bold\":false}]
done
}

View file

@ -0,0 +1,18 @@
#!/usr/bin/env bash
function help() {
echo -e "usage: $(basename ${0}) --server $1 <operation>
operations:
$(basename ${0}) --server $1 broadcast \"[message]\""
}
function restart_announcement() {
for count in {10..1}; do
broadcast "$1" "Server restarting in $count"
done
}
function broadcast() {
local dir="$(getValueByKey 'PODMAN_DIRECTORY')/${1}"
podman exec -it "$1" rcon -m -H 127.0.0.1 -p 25575 -P $(grep -E "^rcon.password" $dir/data/server.properties | cut -d= -f2) tellraw @a [{\"text\":\"[SYSTEM] \",\"color\":\"red\",\"bold\":true},{\"text\": \"$2\",\"color\":\"light_purple\",\"bold\":false}]
}

View file

@ -1,7 +0,0 @@
#!/usr/bin/env bash
function help() {
echo -e "usage: $(basename ${0}) --server $1 <operation>
operations:
$(basename ${0}) --server $1 broadcast \"[message]\""
}

View file

@ -16,9 +16,9 @@ function server() {
shift
broadcast "$server" "$2"
;;
"countdown")
"restart")
shift
countdown "$server"
restart_announcement "$server"
;;
*)
help "$server"