Missing files in last commit

This commit is contained in:
Anthony Robert committed 2018-11-04 20:16:06 -05:00
1 parent 15497a09ab
commit 66957f0eeb
2 files changed
+19 -9

No files matched your search

@@ -14,9 +14,7 @@ import com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers;
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException; import com.sedmelluq.discord.lavaplayer.tools.FriendlyException;
import com.sedmelluq.discord.lavaplayer.track.AudioPlaylist; import com.sedmelluq.discord.lavaplayer.track.AudioPlaylist;
import com.sedmelluq.discord.lavaplayer.track.AudioTrack; import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
import net.dv8tion.jda.core.entities.Guild; import net.dv8tion.jda.core.entities.*;
import net.dv8tion.jda.core.entities.TextChannel;
import net.dv8tion.jda.core.entities.VoiceChannel;
import netneutrality.MusicBot; import netneutrality.MusicBot;
import netneutrality.handler.LogHandler; import netneutrality.handler.LogHandler;
import netneutrality.utils.MessageFunction; import netneutrality.utils.MessageFunction;
@@ -85,6 +83,8 @@ public class MusicManager {
stopMusic(); stopMusic();
} }
scheduler.resetTopic();
Guild guild = MusicBot.getJDA().getGuildById(guildId); Guild guild = MusicBot.getJDA().getGuildById(guildId);
if (guild != null) { if (guild != null) {
guild.getAudioManager().closeAudioConnection(); guild.getAudioManager().closeAudioConnection();
@@ -93,9 +93,7 @@ public class MusicManager {
} }
public synchronized void stopMusic() { public synchronized void stopMusic() {
if (scheduler.getTextChannel() != null) scheduler.resetTopic();
scheduler.getTextChannel().getManager().setTopic(scheduler.topic).queue();
player.destroy(); player.destroy();
} }
@@ -105,7 +103,7 @@ public class MusicManager {
} }
} }
public synchronized void play(String url, TextChannel channel, boolean silent ) { public synchronized void play(String url, TextChannel channel, Member user, boolean silent ) {
String identifier = SourceFinder.getIdentifier(url, channel); String identifier = SourceFinder.getIdentifier(url, channel);
System.out.println(identifier); System.out.println(identifier);
@@ -116,7 +114,7 @@ public class MusicManager {
@Override @Override
public void trackLoaded(AudioTrack audioTrack) { public void trackLoaded(AudioTrack audioTrack) {
if (!silent) if (!silent)
channel.sendMessage(MessageFunction.buildAddingTrackMessage(audioTrack)).queue(); channel.sendMessage(MessageFunction.buildAddingTrackMessage(audioTrack, user)).queue();
scheduler.queue(audioTrack); scheduler.queue(audioTrack);
@@ -41,13 +41,25 @@ public class TrackScheduler extends AudioEventAdapter {
public void setTextChannel(TextChannel channel) { public void setTextChannel(TextChannel channel) {
this.channel = channel; this.channel = channel;
topic = channel.getTopic();
if (this.topic == null) {
this.topic = channel.getTopic();
}
} }
public TextChannel getTextChannel() { public TextChannel getTextChannel() {
return channel; return channel;
} }
public void resetTopic() {
if (this.channel != null) {
this.channel.getManager().setTopic(this.topic).queue();
}
this.topic = "";
}
/** /**
* Start the next track, stopping the current one if it is playing. * Start the next track, stopping the current one if it is playing.
*/ */