diff --git a/pom.xml b/pom.xml index 569e8aa..470de55 100644 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,7 @@ net.dv8tion JDA - 4.1.0_97 + 4.1.0_99 org.json diff --git a/src/main/java/com/bbn/hadder/Hadder.java b/src/main/java/com/bbn/hadder/Hadder.java index 0494551..2dd1812 100644 --- a/src/main/java/com/bbn/hadder/Hadder.java +++ b/src/main/java/com/bbn/hadder/Hadder.java @@ -119,7 +119,7 @@ public class Hadder { try { shardManager = builder.build(); - } catch (LoginException e) { + } catch (Exception e) { e.printStackTrace(); } } diff --git a/src/main/java/com/bbn/hadder/audio/TrackManager.java b/src/main/java/com/bbn/hadder/audio/TrackManager.java index 91fa146..5154b80 100644 --- a/src/main/java/com/bbn/hadder/audio/TrackManager.java +++ b/src/main/java/com/bbn/hadder/audio/TrackManager.java @@ -48,10 +48,10 @@ public class TrackManager extends AudioEventAdapter { @Override public void onTrackEnd(AudioPlayer player, AudioTrack track, AudioTrackEndReason endReason) { - Guild g = queue.element().getAuthor().getGuild(); if (loop) { player.playTrack(track.makeClone()); } else if (queue.isEmpty()) { + Guild g = queue.poll().getAuthor().getGuild(); g.getAudioManager().closeAudioConnection(); } else { player.playTrack(queue.element().getTrack().makeClone()); diff --git a/src/main/java/com/bbn/hadder/commands/misc/GitHubCommand.java b/src/main/java/com/bbn/hadder/commands/misc/GitHubCommand.java index 906798e..8c1ffd6 100644 --- a/src/main/java/com/bbn/hadder/commands/misc/GitHubCommand.java +++ b/src/main/java/com/bbn/hadder/commands/misc/GitHubCommand.java @@ -79,6 +79,9 @@ public class GitHubCommand implements Command { } } } else { + event.getHelpCommand().sendHelp(this, event); + /* + TODO: THIS event.getTextChannel().sendMessage( event.getMessageEditor().getMessage( MessageEditor.MessageType.INFO, @@ -86,7 +89,7 @@ public class GitHubCommand implements Command { "", "commands.misc.github.connect.description", "(https://github.com/login/oauth/authorize?client_id=25321f690bb1b6952942)") - .build()).queue(); + .build()).queue(); */ } } diff --git a/src/main/java/com/bbn/hadder/commands/music/BassCommand.java b/src/main/java/com/bbn/hadder/commands/music/BassCommand.java index 1b7b4de..c227118 100644 --- a/src/main/java/com/bbn/hadder/commands/music/BassCommand.java +++ b/src/main/java/com/bbn/hadder/commands/music/BassCommand.java @@ -1,11 +1,12 @@ /* - * @author Hax / Hax6775 / Schlauer_Hax + @author Hax / Hax6775 / Schlauer_Hax */ package com.bbn.hadder.commands.music; import com.bbn.hadder.commands.Command; import com.bbn.hadder.commands.CommandEvent; +import com.bbn.hadder.utils.MessageEditor; import com.sedmelluq.discord.lavaplayer.filter.equalizer.EqualizerFactory; public class BassCommand implements Command { @@ -14,16 +15,28 @@ public class BassCommand implements Command { @Override public void executed(String[] args, CommandEvent event) { - if (args.length==1) { - float value = Float.parseFloat(args[0]); - EqualizerFactory equalizer = new EqualizerFactory(); - for (int i = 0; i < BASS_BOOST.length; i++) { - equalizer.setGain(i, BASS_BOOST[i] + value); + if (args.length > 0) { + 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())) { + float value = Float.parseFloat(args[0]); + EqualizerFactory equalizer = new EqualizerFactory(); + for (int i = 0; i < BASS_BOOST.length; i++) { + equalizer.setGain(i, BASS_BOOST[i] + value); + } + event.getAudioManager().getPlayer(event.getGuild()).setFrameBufferDuration(500); + event.getAudioManager().getPlayer(event.getGuild()).setFilterFactory(equalizer); + } else { + event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, + "commands.music.bass.error.connected.title", + "commands.music.bass.error.connected.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(); } - event.getAudioManager().getPlayer(event.getGuild()).setFrameBufferDuration(500); - event.getAudioManager().getPlayer(event.getGuild()).setFilterFactory(equalizer); - event.getTextChannel().sendMessage("Bruh, set dae bass").queue(); - } + } else event.getHelpCommand().sendHelp(this, event); } @Override @@ -33,16 +46,16 @@ public class BassCommand implements Command { @Override public String description() { - return null; + return "commands.music.bass.help.description"; } @Override public String usage() { - return null; + return "[Bass-Level]"; } @Override public String example() { - return null; + return "1000"; } } diff --git a/src/main/java/com/bbn/hadder/commands/music/VolumeCommand.java b/src/main/java/com/bbn/hadder/commands/music/VolumeCommand.java index a7d3546..b39fbf2 100644 --- a/src/main/java/com/bbn/hadder/commands/music/VolumeCommand.java +++ b/src/main/java/com/bbn/hadder/commands/music/VolumeCommand.java @@ -35,7 +35,7 @@ public class VolumeCommand implements Command { } else { event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.music.volume.error.connected.title", - "commands.volume.stop.error.connected.description") + "commands.music.volume.error.connected.description") .build()).queue(); } } else { diff --git a/src/main/java/com/bbn/hadder/listener/MentionListener.java b/src/main/java/com/bbn/hadder/listener/MentionListener.java index 238b2d8..cd14129 100644 --- a/src/main/java/com/bbn/hadder/listener/MentionListener.java +++ b/src/main/java/com/bbn/hadder/listener/MentionListener.java @@ -13,7 +13,6 @@ public class MentionListener extends ListenerAdapter { private Rethink rethink; - public MentionListener(Rethink rethink) { this.rethink = rethink; } diff --git a/src/main/resources/Translations/Translations_de.properties b/src/main/resources/Translations/Translations_de.properties index 41eee21..d1aaab0 100644 --- a/src/main/resources/Translations/Translations_de.properties +++ b/src/main/resources/Translations/Translations_de.properties @@ -174,6 +174,9 @@ commands.moderation.editrules.success.title = Successfully changed commands.moderation.editrules.success.description = I successfully changed the rules commands.moderation.editrules.help.description = Edits the rules message. +commands.music.bass.error.connected.title = No channel +commands.music.bass.error.connected.description = You have to be in the same voice channel as the bot to change the bass level. +commands.music.bass.help.description = Change the bass for the song which is played at the moment. commands.music.join.success.title = Successfully connected commands.music.join.success.description = Ich habe mich erfolgreich mit %extra% verbunden. commands.music.join.error.connecting.already.title = Already connected diff --git a/src/main/resources/Translations/Translations_en.properties b/src/main/resources/Translations/Translations_en.properties index 9167e2d..5ca0715 100644 --- a/src/main/resources/Translations/Translations_en.properties +++ b/src/main/resources/Translations/Translations_en.properties @@ -174,6 +174,9 @@ commands.moderation.editrules.success.title = Successfully changed commands.moderation.editrules.success.description = I successfully changed the rules commands.moderation.editrules.help.description = Edits the rules message. +commands.music.bass.error.connected.title = No channel +commands.music.bass.error.connected.description = You have to be in the same voice channel as the bot to change the bass level. +commands.music.bass.help.description = Change the bass for the song which is played at the moment. 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 diff --git a/src/main/resources/Translations/Translations_es.properties b/src/main/resources/Translations/Translations_es.properties index 9167e2d..5ca0715 100644 --- a/src/main/resources/Translations/Translations_es.properties +++ b/src/main/resources/Translations/Translations_es.properties @@ -174,6 +174,9 @@ commands.moderation.editrules.success.title = Successfully changed commands.moderation.editrules.success.description = I successfully changed the rules commands.moderation.editrules.help.description = Edits the rules message. +commands.music.bass.error.connected.title = No channel +commands.music.bass.error.connected.description = You have to be in the same voice channel as the bot to change the bass level. +commands.music.bass.help.description = Change the bass for the song which is played at the moment. 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 diff --git a/src/main/resources/Translations/Translations_fr.properties b/src/main/resources/Translations/Translations_fr.properties index 9167e2d..5ca0715 100644 --- a/src/main/resources/Translations/Translations_fr.properties +++ b/src/main/resources/Translations/Translations_fr.properties @@ -174,6 +174,9 @@ commands.moderation.editrules.success.title = Successfully changed commands.moderation.editrules.success.description = I successfully changed the rules commands.moderation.editrules.help.description = Edits the rules message. +commands.music.bass.error.connected.title = No channel +commands.music.bass.error.connected.description = You have to be in the same voice channel as the bot to change the bass level. +commands.music.bass.help.description = Change the bass for the song which is played at the moment. 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 diff --git a/src/main/resources/Translations/Translations_ru.properties b/src/main/resources/Translations/Translations_ru.properties index 9167e2d..5ca0715 100644 --- a/src/main/resources/Translations/Translations_ru.properties +++ b/src/main/resources/Translations/Translations_ru.properties @@ -174,6 +174,9 @@ commands.moderation.editrules.success.title = Successfully changed commands.moderation.editrules.success.description = I successfully changed the rules commands.moderation.editrules.help.description = Edits the rules message. +commands.music.bass.error.connected.title = No channel +commands.music.bass.error.connected.description = You have to be in the same voice channel as the bot to change the bass level. +commands.music.bass.help.description = Change the bass for the song which is played at the moment. 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 diff --git a/src/main/resources/Translations/Translations_tr.properties b/src/main/resources/Translations/Translations_tr.properties index 9167e2d..5ca0715 100644 --- a/src/main/resources/Translations/Translations_tr.properties +++ b/src/main/resources/Translations/Translations_tr.properties @@ -174,6 +174,9 @@ commands.moderation.editrules.success.title = Successfully changed commands.moderation.editrules.success.description = I successfully changed the rules commands.moderation.editrules.help.description = Edits the rules message. +commands.music.bass.error.connected.title = No channel +commands.music.bass.error.connected.description = You have to be in the same voice channel as the bot to change the bass level. +commands.music.bass.help.description = Change the bass for the song which is played at the moment. 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 diff --git a/src/main/resources/Translations/Translations_zh.properties b/src/main/resources/Translations/Translations_zh.properties index 9167e2d..5ca0715 100644 --- a/src/main/resources/Translations/Translations_zh.properties +++ b/src/main/resources/Translations/Translations_zh.properties @@ -174,6 +174,9 @@ commands.moderation.editrules.success.title = Successfully changed commands.moderation.editrules.success.description = I successfully changed the rules commands.moderation.editrules.help.description = Edits the rules message. +commands.music.bass.error.connected.title = No channel +commands.music.bass.error.connected.description = You have to be in the same voice channel as the bot to change the bass level. +commands.music.bass.help.description = Change the bass for the song which is played at the moment. 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