some stuff ig

This commit is contained in:
Chayapak 2023-05-21 15:31:16 +07:00
parent 31c3b83aed
commit ceec18d806
2 changed files with 8 additions and 8 deletions

View file

@ -19,7 +19,6 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
public class MusicCommand implements Command {
@ -280,7 +279,7 @@ public class MusicCommand implements Command {
public Component queue (CommandContext context) {
final Bot bot = context.bot();
final LinkedList<Song> queue = bot.music().songQueue();
final List<Song> queue = bot.music().songQueue();
final List<Component> queueWithNames = new ArrayList<>();
int i = 0;

View file

@ -17,13 +17,14 @@ import java.io.File;
import java.net.URL;
import java.nio.file.Path;
import java.text.DecimalFormat;
import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
// Author: _ChipMC_ & chayapak <3
public class MusicPlayerPlugin extends Bot.Listener {
private final Bot bot;
public static final String SELECTOR = "@a[tag=!nomusic,tag=!chomens_bot_nomusic]";
public static final String SELECTOR = "@a[tag=!nomusic,tag=!chomens_bot_nomusic]";
public static File SONG_DIR = new File("songs");
static {
if (!SONG_DIR.exists()) {
@ -32,7 +33,7 @@ public class MusicPlayerPlugin extends Bot.Listener {
}
@Getter @Setter private Song currentSong;
@Getter @Setter private LinkedList<Song> songQueue = new LinkedList<>();
@Getter @Setter private List<Song> songQueue = new ArrayList<>();
@Getter @Setter private SongLoaderThread loaderThread;
@Getter @Setter private Loop loop = Loop.OFF;
@ -172,7 +173,7 @@ public class MusicPlayerPlugin extends Bot.Listener {
return;
}
songQueue.remove();
songQueue.remove(0);
if (songQueue.size() == 0) {
stopPlaying();
@ -198,9 +199,9 @@ public class MusicPlayerPlugin extends Bot.Listener {
public void skip () {
if (loop == Loop.ALL) {
songQueue.add(songQueue.remove()); // bot.music.queue.push(bot.music.queue.shift()) in js
songQueue.add(songQueue.remove(0)); // bot.music.queue.push(bot.music.queue.shift()) in js
} else {
songQueue.remove();
songQueue.remove(0);
stopPlaying();
}
if (songQueue.size() == 0) return;