Skip to content

Instantly share code, notes, and snippets.

@inertia186
Created March 20, 2013 23:18
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inertia186/5209427 to your computer and use it in GitHub Desktop.
Save inertia186/5209427 to your computer and use it in GitHub Desktop.
[Minecraft, SMP] Planet Minecraft
#!/bin/bash
MC="/Users/steve/Minecraft"
LOG="$MC/server.log"
MESSAGE="We are not falling for it. This is not the server you are looking for. Move along."
for player in `tail -50 $LOG | grep -i "i'm\|im\|i am" | grep -i from | grep -i planet | grep -i minecraft | cut -f 4 -d " " | cut -f 2 -d \< | cut -f 1 -d \> | sort | uniq`
do
if [ -n "`tail -100000 $LOG | grep "Kicked $player from the game: '$MESSAGE'"`" ]; then
echo Skipping $player, already kicked.
else
query=`$MC/scripts/Dinnerbone-mcstatus-a24e563/cli.py uniblab.local | grep -i $player | wc -l`
query=$(sed -e 's/^[[:space:]]*//' <<<"$query")
if [ $query -eq 0 ]; then
echo Skipping $player \(logged out?\).
else
cmd="kick $player $MESSAGE"
bash -c "screen -p 0 -S minecraft -X eval 'stuff \"$cmd\"\015'"
echo $cmd
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment