From 1eb970fca4c0caef3e261ade6281353284d63562 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Sat, 28 Dec 2019 15:11:24 +0100 Subject: [PATCH] Skip and Stop Command --- .../com/bbn/hadder/audio/AudioManager.java | 8 ---- .../hadder/commands/music/SkipCommand.java | 14 +++++- .../hadder/commands/music/StopCommand.java | 6 ++- .../Translations/Translations_en.properties | 43 ++++++++++--------- 4 files changed, 39 insertions(+), 32 deletions(-) diff --git a/src/main/java/com/bbn/hadder/audio/AudioManager.java b/src/main/java/com/bbn/hadder/audio/AudioManager.java index a2f5757..7bff815 100644 --- a/src/main/java/com/bbn/hadder/audio/AudioManager.java +++ b/src/main/java/com/bbn/hadder/audio/AudioManager.java @@ -136,14 +136,6 @@ public class AudioManager { return getTrackManager(member.getGuild()).getTrackInfo(getPlayer(member.getGuild()).getPlayingTrack()).getAuthor().equals(member); } - public boolean isIdle(CommandEvent event) { - if (!hasPlayer(event.getGuild()) || getPlayer(event.getGuild()).getPlayingTrack() == null) { - event.getTextChannel().sendMessage(" Idle no song lul :D").queue(); - return true; - } - return false; - } - public void forceSkipTrack(CommandEvent event) { getPlayer(event.getGuild()).stopTrack(); event.getTextChannel().sendMessage("Skipped boyy :D").queue(); diff --git a/src/main/java/com/bbn/hadder/commands/music/SkipCommand.java b/src/main/java/com/bbn/hadder/commands/music/SkipCommand.java index 8d7671c..5b54f6f 100644 --- a/src/main/java/com/bbn/hadder/commands/music/SkipCommand.java +++ b/src/main/java/com/bbn/hadder/commands/music/SkipCommand.java @@ -2,6 +2,7 @@ package com.bbn.hadder.commands.music; import com.bbn.hadder.commands.Command; import com.bbn.hadder.commands.CommandEvent; +import com.bbn.hadder.utils.MessageEditor; /** * @author Skidder / GregTCLTK @@ -11,7 +12,16 @@ public class SkipCommand implements Command { @Override public void executed(String[] args, CommandEvent event) { - event.getAudioManager().forceSkipTrack(event); + if (!event.getAudioManager().hasPlayer(event.getGuild()) || event.getAudioManager().getPlayer(event.getGuild()).getPlayingTrack() == null) { + event.getAudioManager().forceSkipTrack(event); + event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, + "commands.music.skip.success.title", + "commands.music.skip.success.description").build()).queue(); + } else { + event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, + "commands.music.info.error.title", + "commands.music.info.error.description").build()).queue(); + } } @Override @@ -21,7 +31,7 @@ public class SkipCommand implements Command { @Override public String description() { - return "Skips the song"; + return "commands.music.skip.help.description"; } @Override diff --git a/src/main/java/com/bbn/hadder/commands/music/StopCommand.java b/src/main/java/com/bbn/hadder/commands/music/StopCommand.java index 95fe6f9..4377929 100644 --- a/src/main/java/com/bbn/hadder/commands/music/StopCommand.java +++ b/src/main/java/com/bbn/hadder/commands/music/StopCommand.java @@ -12,7 +12,7 @@ public class StopCommand implements Command { @Override public void executed(String[] args, CommandEvent event) { - if (event.getAudioManager().hasPlayer(event.getGuild())) { + if (event.getAudioManager().hasPlayer(event.getGuild()) && event.getAudioManager().getPlayer(event.getGuild()).getPlayingTrack() == null) { event.getAudioManager().players.remove(event.getGuild().getId()); event.getAudioManager().getPlayer(event.getGuild()).destroy(); event.getAudioManager().getTrackManager(event.getGuild()).purgeQueue(); @@ -21,7 +21,9 @@ public class StopCommand implements Command { "commands.music.stop.success.title", "commands.music.stop.success.description").build()).queue(); } else { - event.getTextChannel().sendMessage("I love you <3").queue(); + event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, + "commands.music.info.error.title", + "commands.music.info.error.description").build()).queue(); } } diff --git a/src/main/resources/Translations/Translations_en.properties b/src/main/resources/Translations/Translations_en.properties index b0bc477..d9f7d84 100644 --- a/src/main/resources/Translations/Translations_en.properties +++ b/src/main/resources/Translations/Translations_en.properties @@ -179,9 +179,9 @@ commands.moderation.editrules.help.description = Edits the rules message. commands.music.join.success.title = Successfully connected commands.music.join.success.description = I successfully connected to %extra%. commands.music.join.error.connecting.already.title = Already connected -commands.music.join.error.connecting.already.description = I am already connected to your voice channel. +commands.music.join.error.connecting.already.description = I am already connected to your voice channel commands.music.join.error.connecting.trying.title = Already trying to connect -commands.music.join.error.connecting.trying.description = Hadder is already trying to connect. Please wait a moment. +commands.music.join.error.connecting.trying.description = Hadder is already trying to connect. Please wait a moment commands.music.join.error.channel.title = No Voice Channel commands.music.join.error.channel.description = You aren't in a Voice Channel. commands.music.join.help.description = Joins your voice channel @@ -198,9 +198,9 @@ commands.music.play.success.author = Author commands.music.play.success.length = Length commands.music.play.success.tracks = Tracks 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.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.error.match.description = I can not find a song named this on YouTube commands.music.play.help.description = Plays a song commands.music.stop.success.title = Successfully stopped commands.music.stop.success.description = I successfully stopped the song. @@ -213,25 +213,28 @@ commands.music.queue.error.title = No queue commands.music.queue.error.description = There are no queued songs at the moment commands.music.queue.success.title = Queue commands.music.queue.success.description = This is the queue\: \n %extra% -commands.music.queue.help.description = Shows the music queue. +commands.music.queue.help.description = Shows the music queue +commands.music.skip.success.title = Successfully skipped +commands.music.skip.success.description = I successfully skipped to the next song +commands.music.skip.help.description = Skips the currently playing song commands.nsfw.gif.error.title = GIF not showing? Click here commands.nsfw.img.error.title = Image not showing? Click here -commands.nsfw.anal.help.description = Shows a random anal gif. -commands.nsfw.bdsm.help.description = Shows a random BDSM picture. -commands.nsfw.blowjob.help.description = Shows a random Blowjob picture. -commands.nsfw.boobs.help.description = Shows a random boob gif. -commands.nsfw.cum.help.description = Shows a random cum gif. -commands.nsfw.erotic.help.description = Shows a random erotic picture. -commands.nsfw.feet.help.description = Shows a random feet gif. -commands.nsfw.fingering.help.description = Shows a random fingering gif. -commands.nsfw.linking.help.description = Shows a random licking gif. -commands.nsfw.porn.help.description = Shows a random porn gif. -commands.nsfw.pussy.help.description = Shows a random pussy gif. -commands.nsfw.randomporn.help.description = Shows a completely random porn gif. -commands.nsfw.solo.help.description = Shows a random solo gif. -commands.nsfw.spank.help.description = Shows a random spank gif. -commands.nsfw.trans.help.description = Shows a random trans picture. +commands.nsfw.anal.help.description = Shows a random anal gif +commands.nsfw.bdsm.help.description = Shows a random BDSM picture +commands.nsfw.blowjob.help.description = Shows a random Blowjob picture +commands.nsfw.boobs.help.description = Shows a random boob gif +commands.nsfw.cum.help.description = Shows a random cum gif +commands.nsfw.erotic.help.description = Shows a random erotic picture +commands.nsfw.feet.help.description = Shows a random feet gif +commands.nsfw.fingering.help.description = Shows a random fingering gif +commands.nsfw.linking.help.description = Shows a random licking gif +commands.nsfw.porn.help.description = Shows a random porn gif +commands.nsfw.pussy.help.description = Shows a random pussy gif +commands.nsfw.randomporn.help.description = Shows a completely random porn gif +commands.nsfw.solo.help.description = Shows a random solo gif +commands.nsfw.spank.help.description = Shows a random spank gif +commands.nsfw.trans.help.description = Shows a random trans picture commands.owner.eval.success.title = Eval Command commands.owner.eval.success.input = Input