Correction de 2-3 ptits trucs
This commit is contained in:
@@ -55,7 +55,6 @@ public class PlayMusic extends Command {
|
||||
} else {
|
||||
JukeboxGUISystem.createJukebox(e.getChannel());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void loadAndPlay(final TextChannel channel, final String trackUrl, boolean loop, boolean nomsg) {
|
||||
@@ -67,7 +66,6 @@ public class PlayMusic extends Command {
|
||||
if(!nomsg) {
|
||||
channel.sendMessage("**Now Playing**: "+track.getInfo().title).queue();
|
||||
}
|
||||
System.out.println("Launching track pre:"+track.getInfo().title);
|
||||
musicManager.scheduler.play(track, loop);
|
||||
}
|
||||
|
||||
@@ -82,7 +80,6 @@ public class PlayMusic extends Command {
|
||||
if(!nomsg) {
|
||||
channel.sendMessage("**Now Playing**: "+firstTrack.getInfo().title).queue();
|
||||
}
|
||||
System.out.println("Launching track pre:"+firstTrack.getInfo().title);
|
||||
musicManager.scheduler.play(firstTrack, loop);
|
||||
}
|
||||
|
||||
@@ -110,5 +107,4 @@ public class PlayMusic extends Command {
|
||||
|
||||
return musicManager;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package fr.Skydust.JdrBot.cmds.record;
|
||||
|
||||
import fr.Skydust.JdrBot.jukebox.JukeboxGUISystem;
|
||||
import fr.Skydust.JdrBot.stock.Command;
|
||||
import fr.Skydust.JdrBot.stock.RecordState;
|
||||
import fr.Skydust.JdrBot.utils.MessageType;
|
||||
@@ -16,6 +17,9 @@ public class CancelRecord extends Command {
|
||||
public void call(GuildMessageReceivedEvent e) {
|
||||
RecordState rs = Record.getGuildRecordState(e.getGuild());
|
||||
if(rs.isRecording) {
|
||||
if(JukeboxGUISystem.getGuildsJukebox(e.getGuild()) == null) {
|
||||
e.getGuild().getAudioManager().closeAudioConnection();
|
||||
}
|
||||
rs.cancelRecord(e.getGuild());
|
||||
Utils.sendMessage(e.getChannel(), MessageType.NORMAL, "L'enregistrement a été annulé");
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package fr.Skydust.JdrBot.cmds.record;
|
||||
|
||||
import fr.Skydust.JdrBot.jukebox.JukeboxGUISystem;
|
||||
import fr.Skydust.JdrBot.stock.Command;
|
||||
import fr.Skydust.JdrBot.stock.RecordState;
|
||||
import fr.Skydust.JdrBot.utils.MessageType;
|
||||
@@ -16,6 +17,9 @@ public class StopRecord extends Command {
|
||||
public void call(GuildMessageReceivedEvent e) {
|
||||
RecordState rs = Record.getGuildRecordState(e.getGuild());
|
||||
if(rs.isRecording) {
|
||||
if(JukeboxGUISystem.getGuildsJukebox(e.getGuild()) == null) {
|
||||
e.getGuild().getAudioManager().closeAudioConnection();
|
||||
}
|
||||
rs.endRecord(e.getGuild(), e.getChannel());
|
||||
} else {
|
||||
Utils.sendMessage(e.getChannel(), MessageType.ERROR, "Il n'y a aucun enregistrement en cours");
|
||||
|
||||
@@ -62,20 +62,12 @@ public class RecordState {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(JukeboxGUISystem.getGuildsJukebox(g) == null) {
|
||||
g.getAudioManager().closeAudioConnection();
|
||||
}
|
||||
}
|
||||
|
||||
public void endRecord(Guild g, TextChannel tc) {
|
||||
isRecording = false;
|
||||
isProcessing = true;
|
||||
|
||||
if(JukeboxGUISystem.getGuildsJukebox(g) == null) {
|
||||
g.getAudioManager().closeAudioConnection();
|
||||
}
|
||||
|
||||
System.out.println("["+new Date()+"] Le serveur ID "+g.getId()+"("+g.getName()+") vient de terminer un enregistrement");
|
||||
|
||||
new Thread(() -> {
|
||||
|
||||
@@ -60,10 +60,4 @@ public class Utils {
|
||||
.setColor(c)
|
||||
.build()).build()).queue();
|
||||
}
|
||||
|
||||
public static void closeAudioConnection(Guild guild) {
|
||||
if(JukeboxGUISystem.getGuildsJukebox(guild) == null && !Record.getGuildRecordState(guild).isRecording) {
|
||||
guild.getAudioManager().closeAudioConnection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user