700 #334
9 changed files with 75 additions and 7 deletions
2
pom.xml
2
pom.xml
|
|
@ -27,7 +27,7 @@
|
|||
<dependency>
|
||||
<groupId>net.dv8tion</groupId>
|
||||
<artifactId>JDA</artifactId>
|
||||
<version>4.1.0_97</version>
|
||||
<version>4.1.0_99</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
|
|
|
|||
|
|
@ -103,7 +103,8 @@ public class Hadder {
|
|||
new StopCommand(),
|
||||
new BlacklistCommand(),
|
||||
new PauseCommand(),
|
||||
new LoopCommand()), config, helpCommand);
|
||||
new LoopCommand(),
|
||||
new BassCommand()), config, helpCommand);
|
||||
|
||||
builder.addEventListeners(
|
||||
new MentionListener(rethink),
|
||||
|
|
@ -118,7 +119,7 @@ public class Hadder {
|
|||
|
||||
try {
|
||||
shardManager = builder.build();
|
||||
} catch (LoginException e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ public class AudioManager {
|
|||
|
||||
public AudioManager() {
|
||||
AudioSourceManagers.registerRemoteSources(myManager);
|
||||
myManager.getConfiguration().setFilterHotSwapEnabled(true);
|
||||
}
|
||||
|
||||
public boolean hasPlayer(Guild guild) {
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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(); */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
61
src/main/java/com/bbn/hadder/commands/music/BassCommand.java
Normal file
61
src/main/java/com/bbn/hadder/commands/music/BassCommand.java
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
@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 {
|
||||
private static final float[] BASS_BOOST = { 0.2f, 0.15f, 0.1f, 0.05f, 0.0f, -0.05f, -0.1f, -0.1f, -0.1f, -0.1f, -0.1f,
|
||||
-0.1f, -0.1f, -0.1f, -0.1f };
|
||||
|
||||
@Override
|
||||
public void executed(String[] args, CommandEvent event) {
|
||||
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();
|
||||
}
|
||||
} else event.getHelpCommand().sendHelp(this, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] labels() {
|
||||
return new String[]{"bass"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "commands.music.bass.help.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "[Bass-Level]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String example() {
|
||||
return "1000";
|
||||
}
|
||||
}
|
||||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ public class MentionListener extends ListenerAdapter {
|
|||
|
||||
private Rethink rethink;
|
||||
|
||||
|
||||
public MentionListener(Rethink rethink) {
|
||||
this.rethink = rethink;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue