ig fix music filename mabe mabe

This commit is contained in:
ChomeNS
2023-04-21 17:31:12 +07:00
parent 2b9d29e52e
commit d133cd7d13
4 changed files with 16 additions and 19 deletions

View File

@@ -393,22 +393,22 @@ public class MusicCommand implements Command {
public Component info (CommandContext context) {
final Bot bot = context.bot();
final Song currentSong = bot.music().currentSong();
final String fileName = bot.music().fileName();
if (currentSong == null) return Component.text("No song is currently playing").color(NamedTextColor.RED);
// ig very code yup
final Component title = currentSong.name;
final String songAuthor = currentSong.songAuthor == null || currentSong.songAuthor.equals("") ? "N/A" : currentSong.songAuthor;
final String songOriginalAuthor = currentSong.songOriginalAuthor == null || currentSong.songOriginalAuthor.equals("") ? "N/A" : currentSong.songOriginalAuthor;
final String songDescription = currentSong.songDescription == null || currentSong.songDescription.equals("") ? "N/A" : currentSong.songDescription;
final Component component = Component.translatable(
"""
Filename: %s
Title/Filename: %s
Author: %s
Original author: %s
Description: %s""",
Component.text(fileName).color(NamedTextColor.AQUA),
title.color(NamedTextColor.AQUA),
Component.text(songAuthor).color(NamedTextColor.AQUA),
Component.text(songOriginalAuthor).color(NamedTextColor.AQUA),
Component.text(songDescription).color(NamedTextColor.AQUA)

View File

@@ -34,8 +34,6 @@ public class MusicPlayerPlugin extends SessionAdapter {
}
}
@Getter private String fileName;
@Getter @Setter private Song currentSong;
@Getter @Setter private LinkedList<Song> songQueue = new LinkedList<>();
@Getter @Setter private SongLoaderThread loaderThread;
@@ -99,7 +97,6 @@ public class MusicPlayerPlugin extends SessionAdapter {
bot.chat().tellraw(Component.translatable("Failed to load song: %s", loaderThread.exception.message()).color(NamedTextColor.RED));
} else {
songQueue.add(loaderThread.song);
fileName = loaderThread.fileName;
bot.chat().tellraw(Component.translatable("Added %s to the song queue", Component.empty().append(loaderThread.song.name).color(NamedTextColor.GOLD)));
}
loaderThread = null;
@@ -151,7 +148,6 @@ public class MusicPlayerPlugin extends SessionAdapter {
if (songQueue.size() == 0) {
stopPlaying();
removeBossBar();
fileName = null;
bot.chat().tellraw(Component.text("Finished playing every song in the queue"));
return;
}