From 4791f843560cf7e73438779261233f4046dd93e1 Mon Sep 17 00:00:00 2001 From: jomo Date: Fri, 4 Jul 2014 01:50:36 +0200 Subject: add motd.py --- motd.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 motd.py (limited to 'motd.py') diff --git a/motd.py b/motd.py new file mode 100644 index 0000000..915fa63 --- /dev/null +++ b/motd.py @@ -0,0 +1,29 @@ +#pylint: disable=F0401 +from helpers import * + +motd = server.getMotd() + +@hook.command("getmotd") +def onGetMotdCommand(sender, args): + plugHeader("MOTD") + msg(sender, motd, usecolor=False) + + +@hook.command("setmotd") +def onSetMotdCommand(sender, args): + global motd + plugHeader("MOTD") + if sender.hasPermission("utils.setmotd"): + if not checkargs(sender, args, 1, -1): + return True + + motd = colorify(" ".join(args)) + broadcast(plugHeader(name="MOTD")) + broadcast("&aNew MOTD:&r\n%s" % motd) + else: + noperm(sender) + return True + +@hook.event("server.ServerListPingEvent") +def onServerPing(event): + event.setMotd(motd) \ No newline at end of file -- cgit v1.2.3