Skip to content

Instantly share code, notes, and snippets.

@inertia186
Created February 17, 2013 20:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inertia186/4973141 to your computer and use it in GitHub Desktop.
Save inertia186/4973141 to your computer and use it in GitHub Desktop.
[Minecraft, SMP] Tells uptime to all ops who are logged in.
MC="/Users/steve/Minecraft"
for player in `cat $MC/ops.txt`
do
query=`$MC/scripts/Dinnerbone-mcstatus-a24e563/cli.py localhost | grep -i $player | wc -l`
query=$(sed -e 's/^[[:space:]]*//' <<<"$query")
if [ $query -eq 0 ]; then
echo Skipping $player, not logged in.
else
cmd="tell $player `uptime`"
echo $cmd
bash -c "screen -p 0 -S minecraft -X eval 'stuff \"$cmd\"\015'"
fi
done
@inertia186
Copy link
Author

The query is performed by: https://github.com/Dinnerbone/mcstatus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment