Jukebox fixes: check if jukebox exists + blockDJ removes vote.

This commit is contained in:
Cerapter 2018-08-19 08:03:39 +02:00
parent b9f1998c93
commit 457a5e39fc
2 changed files with 7 additions and 0 deletions

View File

@ -115,6 +115,8 @@ class AreaManager:
return True
def add_jukebox_vote(self, client, music_name, length=-1, showname=''):
if not self.jukebox:
return
if length <= 0:
self.remove_jukebox_vote(client, False)
else:
@ -125,6 +127,8 @@ class AreaManager:
self.start_jukebox()
def remove_jukebox_vote(self, client, silent):
if not self.jukebox:
return
for current_vote in self.jukebox_votes:
if current_vote.client.id == client.id:
self.jukebox_votes.remove(current_vote)
@ -132,6 +136,8 @@ class AreaManager:
client.send_host_message('You removed your song from the jukebox.')
def get_jukebox_picked(self):
if not self.jukebox:
return
if len(self.jukebox_votes) == 0:
return None
elif len(self.jukebox_votes) == 1:

View File

@ -812,6 +812,7 @@ def ooc_cmd_blockdj(client, arg):
for target in targets:
target.is_dj = False
target.send_host_message('A moderator muted you from changing the music.')
target.area.remove_jukebox_vote(target, True)
client.send_host_message('blockdj\'d {}.'.format(targets[0].get_char_name()))
def ooc_cmd_unblockdj(client, arg):