Skip to content

Commit 5b86f6f

Browse files
author
Hubert
authored
Created in v1.10
1 parent bde6f93 commit 5b86f6f

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

CronTasks/CronDetectCheaters

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/sh
2+
3+
# This script is intended to be used as a CRON command
4+
# On my server, I use the following configuration in /etc/crontab to run it every 5 minutes:
5+
#
6+
# #minute hour mday month wday who command
7+
# */5 * * * * minecraft /usr/bin/nice /home/minecraft/CronTasks/CronDetectCheaters
8+
#
9+
# And the minecraft account home directory is the Minecraft server root.
10+
11+
. .minecraft-library
12+
13+
TEMPBAN_DURATION=3d
14+
15+
GetOnlinePlayers \
16+
| while read PLAYER
17+
do
18+
MODS=`GetForbiddenModsForPlayer $PLAYER`
19+
if [ "${MODS}" != "" ]
20+
then echo "${MODS}" \
21+
| tr ',' '\n' \
22+
| while read MOD
23+
do
24+
MOD_DETAILS=`grep "^${MOD} " ${FORBIDDEN_MODS_DETAILS}`
25+
MOD_NAME=`echo "${MOD_DETAILS}" | cut -d" " -f2`
26+
SENTENCE=`echo "${MOD_DETAILS}" | cut -d" " -f4`
27+
AddToChat "${PLAYER} is using a forbidden mod: ${MOD_NAME}"
28+
case ${SENTENCE} in
29+
"tempban") ExecuteCommand "tempban ${PLAYER} ${TEMPBAN_DURATION}" ;;
30+
"ban") ExecuteCommand "ban ${PLAYER} for cheating" ;;
31+
"kick") ExecuteCommand "kick ${PLAYER} for using a forbidden mod" ;;
32+
*) LogError "CronDetectCheaters - unknown sentence"
33+
esac
34+
done
35+
fi
36+
done

0 commit comments

Comments
 (0)