diff options
author | jomo <github@jomo.tv> | 2015-01-06 22:19:06 +0100 |
---|---|---|
committer | jomo <github@jomo.tv> | 2015-01-06 22:19:06 +0100 |
commit | 7d7d5e16e1ef7ec3678da8c8fc8c76f7f7f053f9 (patch) | |
tree | 3e6f3a053e2e5f12b5c136d5cb4c2f4f15f51bd4 /helpers.py | |
parent | fb4aff2e04ecf69bc5bb3bb8fecb79370ef2b7a0 (diff) |
remove junk in toggle()
Diffstat (limited to 'helpers.py')
-rw-r--r-- | helpers.py | 28 |
1 files changed, 7 insertions, 21 deletions
@@ -198,28 +198,14 @@ def save_json_file(filename, obj): error("Failed to write to %s: %s" % (filename, e)) -def toggle(player, ls, add = None, name = "Toggle", on = "&a%s now on!", off = "&c%s now off!", already = "&c%s was already %s"): +def toggle(player, ls): """ - Toggle presence of a player's UUID in a list (ls) - 'add' controls if a player should be added(True) or removed(False) - if 'add' is None, ls will simply be toggled for that player. - %s in on, off, and already is replaced with the name - when 'add' is given, but won't change anything, %s in 'already' is replaced with "ON" or "OFF" + Toggles presence of a player's UUID in a list """ - - pid = uid(player) - enabled = pid in ls - - # Do some checks and remove pid. - if enabled: #and add == False: + pid = uid(player) + if pid in ls: ls.remove(pid) - msg(player, on % name) - - # Do some checks and append pid. - elif not enabled: # and add == True: #Sorry i fail to see the relevance of that if we want to just toggle, since if its none, none of these statements will go thru - ls.append(pid) - msg(player, off % name) - - # Already on/off (optional) + msg(player, "&a%s turned off!" % name) else: - msg(player, already % (name, " ON" if add else " OFF"))
\ No newline at end of file + ls.append(pid) + msg(player, "&a%s turned on!" % name)
\ No newline at end of file |