Solidify imbusy blocking pms, tpas, etc. #42

Merged
Dico200 merged 8 commits from imbusy-reply-patch into dev 2016-05-28 20:22:01 +00:00
Showing only changes of commit 8629b39ce1 - Show all commits

View File

@ -40,34 +40,44 @@ def on_busy_command(sender, cmd, label, args):
noperm(sender) noperm(sender)
return True return True
if len(args) == 0: sender_name = sender.getName()
msg(sender, "This plugin allows being busy, and when turned on you will not receive any direct messages or tpa requests.")
msg(sender, "\nCommands:")
msg(sender, "/busy on: turns on busy mode")
msg(sender, "/busy off: turns off busy mode")
msg(sender, "/busy status [player]: shows your or [player]'s current busy status.")
elif len(args) == 1: if len(args) == 0:
if args[0] == "on": if sender_name in busy_players:
if sender.getName() in busy_players: busy_players.remove(sender_name)
msg(sender, "You cannot be even more focused than this without being a jedi!") msg(sender, "Your busy status was removed, you can be bothered again")
else: else:
busy_players.append(sender.getName()) busy_players.append(sender_name)
broadcast(None, "&c[&2Busy&c] %s&r is now busy, don't even TRY bothering them!" % sender.getDisplayName()) broadcast(None, "&c[&2Busy&c] %s&r is now busy, don't even TRY bothering them!" % sender.getDisplayName())
elif args[0] == "off": elif len(args) == 1:
if args[0].lower() == "on":
if sender_name in busy_players:
msg(sender, "You cannot be even more focused than this without being a jedi!")
else:
busy_players.append(sender_name)
broadcast(None, "&c[&2Busy&c] %s&r is now busy, don't even TRY bothering them!" % sender.getDisplayName())
elif args[0].lower() == "off":
try: try:
busy_players.remove(sender.getName()) busy_players.remove(sender_name)
msg(sender, "Master has sent /busy command, %s&r is freeee of bothering!" % sender.getDisplayName()) msg(sender, "Your busy status was removed, you can be bothered again")
except ValueError: except ValueError:
msg(sender, "You are not busy! You cannot be even less busy! Are you perhaps bored?") msg(sender, "You are not busy! You cannot be even less busy! Are you perhaps bored?")
elif args[0] == "status": elif args[0].lower() == "status":
if sender.getName() in busy_players: if sender_name in busy_players:
msg(sender, "You are super-duper busy and concentrated right now. Think, think, think!") msg(sender, "You are super-duper busy and concentrated right now. Think, think, think!")
else: else:
msg(sender, "You are completely unable to focus right now.") msg(sender, "You are completely unable to focus right now.")
elif args[0].lower() in ("?", "help"):
msg(sender, "Let's you put yourself in busy status, preventing pms and tpa requests from other players")
msg(sender, "\nCommands:")
msg(sender, "/busy: toggles busy status")
msg(sender, "/busy on: turns on busy status")
msg(sender, "/busy off: turns off busy status")
msg(sender, "/busy status [player]: shows your or [player]'s current busy status.")
else: else:
unclear(sender) unclear(sender)
return False return False
@ -75,7 +85,7 @@ def on_busy_command(sender, cmd, label, args):
elif len(args) == 2 and args[0] == "status": elif len(args) == 2 and args[0] == "status":
target = server.getPlayer(args[1]) target = server.getPlayer(args[1])
if target is None: if target is None:
msg(sender, "That player is not online, I doubt they are busy.") msg(sender, "That player is not online, they may be busy IRL, we never know")
elif target.getName() in busy_players: elif target.getName() in busy_players:
msg(sender, "Yes, %s&r is busy. Shhh..." % target.getDisplayName()) msg(sender, "Yes, %s&r is busy. Shhh..." % target.getDisplayName())
else: else: