Auto unpause after leader is removed

This commit is contained in:
calzoneman 2014-10-07 23:01:36 -05:00
parent e13e695077
commit 4505ca19da
1 changed files with 10 additions and 4 deletions

View File

@ -235,6 +235,7 @@ PlaylistModule.prototype.onUserPart = function (user) {
if (!this._leadInterval) {
this._lastUpdate = Date.now();
this._leadInterval = setInterval(this._leadLoop.bind(this), 1000);
this._leadLoop();
}
}
}
@ -720,17 +721,22 @@ PlaylistModule.prototype.handleAssignLeader = function (user, data) {
name: old.getName(),
rank: old.account.effectiveRank
});
this.channel.logger.log("[mod] " + user.getName() + " removed leader from " + old.getName());
}
if (!name) {
this.channel.broadcastAll("setLeader", "");
this.channel.logger.log("[playlist] Resuming autolead");
if (!this._leadInterval) {
this._lastUpdate = Date.now();
this._leadInterval = setInterval(this._leadLoop.bind(this), 1000);
}
if (this.current !== null) {
this.current.media.paused = false;
if (!this._leadInterval) {
this._lastUpdate = Date.now();
this._leadInterval = setInterval(this._leadLoop.bind(this), 1000);
this._leadLoop();
}
}
return;
}