From fb0ef99d8384c9d26da56789caf5ef1c559f88e2 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Mon, 6 Jan 2020 18:40:03 +0100 Subject: [PATCH] Integrate the loop function --- .../java/com/bbn/hadder/commands/music/LoopCommand.java | 8 +++++++- .../resources/Translations/Translations_en.properties | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/bbn/hadder/commands/music/LoopCommand.java b/src/main/java/com/bbn/hadder/commands/music/LoopCommand.java index a47b7a3..86ae1f1 100644 --- a/src/main/java/com/bbn/hadder/commands/music/LoopCommand.java +++ b/src/main/java/com/bbn/hadder/commands/music/LoopCommand.java @@ -14,7 +14,13 @@ public class LoopCommand implements Command { public void executed(String[] args, CommandEvent event) { if (event.getAudioManager().hasPlayer(event.getGuild()) && event.getAudioManager().getPlayer(event.getGuild()).getPlayingTrack() != null) { if (event.getMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().inVoiceChannel() && event.getGuild().getSelfMember().getVoiceState().getChannel().equals(event.getMember().getVoiceState().getChannel())) { - + if (event.getAudioManager().getTrackManager(event.getGuild()).isLoop()) { + event.getAudioManager().getTrackManager(event.getGuild()).setLoop(false); + event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.music.loop.success.loop.title", "commands.music.loop.success.loop.description").build()).queue(); + } else { + event.getAudioManager().getTrackManager(event.getGuild()).setLoop(true); + event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.music.loop.success.unloop.title", "commands.music.loop.success.unloop.description").build()).queue(); + } } else { event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.music.loop.error.connected.title", diff --git a/src/main/resources/Translations/Translations_en.properties b/src/main/resources/Translations/Translations_en.properties index a7a3a61..6e2760e 100644 --- a/src/main/resources/Translations/Translations_en.properties +++ b/src/main/resources/Translations/Translations_en.properties @@ -237,6 +237,10 @@ 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.music.loop.success.loop.title = Successfully activated +commands.music.loop.success.loop.description = I will now repeat the currently played song. +commands.music.loop.success.unloop.title = Successfully deactivated +commands.music.loop.success.unloop.description = I will no longer repeat the currently played song. commands.music.loop.error.connected.title = No channel commands.music.loop.error.connected.description = You have to be in the same voice channel as the bot to set the repeat status. commands.music.loop.help.description = Repeats a song/queue.