Improve support for the queue
This commit is contained in:
parent
e6bb7c8131
commit
4edc486e4b
1 changed files with 15 additions and 1 deletions
|
@ -38,6 +38,7 @@ public class MusicCommand extends Command {
|
||||||
)
|
)
|
||||||
|
|
||||||
.then(literal("stop").executes(this::stop))
|
.then(literal("stop").executes(this::stop))
|
||||||
|
.then(literal("skip").executes(this::skip))
|
||||||
.then(literal("pause").executes(this::pause))
|
.then(literal("pause").executes(this::pause))
|
||||||
.then(literal("list").executes(this::list))
|
.then(literal("list").executes(this::list))
|
||||||
|
|
||||||
|
@ -74,7 +75,20 @@ public class MusicCommand extends Command {
|
||||||
if (songPlayer.currentSong() == null) throw NO_SONG_IS_CURRENTLY_PLAYING.create();
|
if (songPlayer.currentSong() == null) throw NO_SONG_IS_CURRENTLY_PLAYING.create();
|
||||||
|
|
||||||
songPlayer.stopPlaying();
|
songPlayer.stopPlaying();
|
||||||
source.sendOutput(Component.translatable("Stopped playing the current song", NamedTextColor.GREEN));
|
songPlayer.songQueue().clear();
|
||||||
|
source.sendOutput(Component.translatable("Stopped music playback", NamedTextColor.GREEN));
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int skip (CommandContext<CommandSource> context) throws CommandSyntaxException {
|
||||||
|
final CommandSource source = context.getSource();
|
||||||
|
final SongPlayer songPlayer = source.client().songPlayer();
|
||||||
|
|
||||||
|
if (songPlayer.currentSong() == null) throw NO_SONG_IS_CURRENTLY_PLAYING.create();
|
||||||
|
|
||||||
|
songPlayer.stopPlaying();
|
||||||
|
source.sendOutput(Component.translatable("Skipped the current song", NamedTextColor.GREEN));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue