Skip to content

Commit

Permalink
bug fix on destroy not emitting player end
Browse files Browse the repository at this point in the history
  • Loading branch information
achiragaming committed Dec 27, 2023
1 parent b34da2c commit 3aba536
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "damonjs",
"version": "1.4.0",
"version": "1.4.1",
"preview": false,
"description": "A modified Shoukaku wrapper with enhanced queue support.",
"main": "dist/Index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/Index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export * from './DamonJs';
export { DamonJsTrack, DamonJsQueue, DamonJsPlayer, Plugins };
export * from './Modules/Interfaces';

export const version = '1.4.0';
export const version = '1.4.1';
6 changes: 2 additions & 4 deletions src/Managers/DamonJsPlayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,12 @@ export class DamonJsPlayer {
});

this.player.on('end', (data) => {
if (this.state === PlayerState.DESTROYING || this.state === PlayerState.DESTROYED)
return this.emit(Events.Debug, this, `Player ${this.guildId} destroyed from end event`);

this.isTrackPlaying = false;

const playedTrack = this.queue[this.queue.playedTrackId];
if (playedTrack) this.emit(Events.PlayerEnd, this, playedTrack);

if (this.state === PlayerState.DESTROYING || this.state === PlayerState.DESTROYED)
return this.emit(Events.Debug, this, `Player ${this.guildId} destroyed from end event`);
if (data.reason === 'replaced') return this.emit(Events.PlayerEmpty, this);

if (this.loop === LoopState.Track) {
Expand Down

0 comments on commit 3aba536

Please sign in to comment.