Jukebox fixes: check if jukebox exists + blockDJ removes vote.
This commit is contained in:
		
							parent
							
								
									b9f1998c93
								
							
						
					
					
						commit
						457a5e39fc
					
				@ -115,6 +115,8 @@ class AreaManager:
 | 
				
			|||||||
            return True
 | 
					            return True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        def add_jukebox_vote(self, client, music_name, length=-1, showname=''):
 | 
					        def add_jukebox_vote(self, client, music_name, length=-1, showname=''):
 | 
				
			||||||
 | 
					            if not self.jukebox:
 | 
				
			||||||
 | 
					                return
 | 
				
			||||||
            if length <= 0:
 | 
					            if length <= 0:
 | 
				
			||||||
                self.remove_jukebox_vote(client, False)
 | 
					                self.remove_jukebox_vote(client, False)
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
@ -125,6 +127,8 @@ class AreaManager:
 | 
				
			|||||||
                    self.start_jukebox()
 | 
					                    self.start_jukebox()
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        def remove_jukebox_vote(self, client, silent):
 | 
					        def remove_jukebox_vote(self, client, silent):
 | 
				
			||||||
 | 
					            if not self.jukebox:
 | 
				
			||||||
 | 
					                return
 | 
				
			||||||
            for current_vote in self.jukebox_votes:
 | 
					            for current_vote in self.jukebox_votes:
 | 
				
			||||||
                if current_vote.client.id == client.id:
 | 
					                if current_vote.client.id == client.id:
 | 
				
			||||||
                    self.jukebox_votes.remove(current_vote)
 | 
					                    self.jukebox_votes.remove(current_vote)
 | 
				
			||||||
@ -132,6 +136,8 @@ class AreaManager:
 | 
				
			|||||||
                client.send_host_message('You removed your song from the jukebox.')
 | 
					                client.send_host_message('You removed your song from the jukebox.')
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        def get_jukebox_picked(self):
 | 
					        def get_jukebox_picked(self):
 | 
				
			||||||
 | 
					            if not self.jukebox:
 | 
				
			||||||
 | 
					                return
 | 
				
			||||||
            if len(self.jukebox_votes) == 0:
 | 
					            if len(self.jukebox_votes) == 0:
 | 
				
			||||||
                return None
 | 
					                return None
 | 
				
			||||||
            elif len(self.jukebox_votes) == 1:
 | 
					            elif len(self.jukebox_votes) == 1:
 | 
				
			||||||
 | 
				
			|||||||
@ -812,6 +812,7 @@ def ooc_cmd_blockdj(client, arg):
 | 
				
			|||||||
    for target in targets:
 | 
					    for target in targets:
 | 
				
			||||||
        target.is_dj = False
 | 
					        target.is_dj = False
 | 
				
			||||||
        target.send_host_message('A moderator muted you from changing the music.')
 | 
					        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()))
 | 
					    client.send_host_message('blockdj\'d {}.'.format(targets[0].get_char_name()))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def ooc_cmd_unblockdj(client, arg):
 | 
					def ooc_cmd_unblockdj(client, arg):
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user