Last active
December 27, 2015 20:39
-
-
Save nicklozon/7386482 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
players=($(ls /home/unhinged/world/players | gawk '{ print $0 }' | gawk -F . '{ print $1 }')) | |
case $1 in | |
config) | |
cat <<'EOM' | |
graph_title Minecraft Players | |
graph_args --base 1000 -l 0 | |
graph_vlabel Players | |
graph_scale no | |
graph_category Minecraft | |
graph_printf %3.0lf | |
EOM | |
for player in "${players[@]}" | |
do | |
: | |
echo $player.label $player | |
echo $player.draw AREASTACK | |
color=`echo $player | sha1sum | cut -c 8-13` | |
echo $player.colour $color | |
done | |
exit 0;; | |
esac | |
for player in "${players[@]}" | |
do | |
: | |
export var_name="${player}_value" | |
export ${var_name}=0 | |
done | |
online_players_string="$(/etc/minecraft/unhinged command list | tail -n 1 | cut -c 28-)" | |
IFS=', ' read -ra online_players <<< "$online_players_string" | |
for player in "${online_players[@]}" | |
do | |
: | |
export var_name="${player}_value" | |
export ${var_name}=1 | |
done | |
for player in "${players[@]}" | |
do | |
: | |
export var_name="${player}_value" | |
echo $player.value ${!var_name} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment