From 3af62f2f25fcc88d5eb5d76b1eb7f3c83a184e58 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Sun, 5 Jan 2020 01:36:26 +0100 Subject: [PATCH] Unpause feature --- .../com/bbn/hadder/commands/music/PlayCommand.java | 13 +++++++++++++ .../Translations/Translations_en.properties | 11 +++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/main/java/com/bbn/hadder/commands/music/PlayCommand.java b/src/main/java/com/bbn/hadder/commands/music/PlayCommand.java index 55808e1..1646769 100644 --- a/src/main/java/com/bbn/hadder/commands/music/PlayCommand.java +++ b/src/main/java/com/bbn/hadder/commands/music/PlayCommand.java @@ -43,6 +43,19 @@ public class PlayCommand implements Command { "commands.music.join.error.channel.description") .build()).queue(); } + } else if (event.getAudioManager().getPlayer(event.getGuild()).isPaused()) { + if (event.getMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().getChannel().equals(event.getMember().getVoiceState().getChannel())) { + event.getAudioManager().getPlayer(event.getGuild()).setPaused(false); + event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, + "commands.music.play.success.unpause.title", + "commands.music.play.success.unpause.description") + .build()).queue(); + } else { + event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, + "commands.music.play.error.connected.title", + "commands.music.play.error.connected.description") + .build()).queue(); + } } else event.getHelpCommand().sendHelp(this, event); } diff --git a/src/main/resources/Translations/Translations_en.properties b/src/main/resources/Translations/Translations_en.properties index 50da52a..edd9925 100644 --- a/src/main/resources/Translations/Translations_en.properties +++ b/src/main/resources/Translations/Translations_en.properties @@ -199,6 +199,10 @@ commands.music.play.error.load.title = %extra% Load failed %extra% commands.music.play.error.load.description = Unfortunately I can not load the given song commands.music.play.error.match.title = %extra% No matches %extra% commands.music.play.error.match.description = I can not find a song named this on YouTube +commands.music.play.success.unpause.title = Successfully continued +commands.music.play.success.unpause.description = I successfully continued playing the song. +commands.music.play.error.connected.title = No channel +commands.music.play.error.connected.description = You have to be in the same voice channel as the bot to continue the song. commands.music.play.help.description = Plays the specified song. commands.music.stop.success.title = Successfully stopped commands.music.stop.success.description = I successfully stopped the song. @@ -226,6 +230,13 @@ commands.music.volume.error.int.description = The volume have to be between 1 an commands.music.volume.error.connected.title = No channel commands.music.volume.error.connected.description = You have to be in the same voice channel as the bot to change the volume. commands.music.volume.help.description = Change the volume of the music. +commands.music.pause.success.title = Successfully paused +commands.music.pause.success.description = I successfully paused the played song. +commands.music.pause.error.paused.title = Already paused +commands.music.pause.error.paused.description = The song is already paused. +commands.music.pause.error.connected.title = No channel +commands.music.pause.error.connected.description = You have to be in the same voice channel as the bot to pause the song. +commands.music.pause.help.description = Pause the playing song. commands.nsfw.gif.error.title = GIF not showing? Click here commands.nsfw.img.error.title = Image not showing? Click here