diff --git a/src/main/java/net/cybercake/discordmusicbot/commands/list/QueueCMD.java b/src/main/java/net/cybercake/discordmusicbot/commands/list/QueueCMD.java index 0cccc40..25d5845 100644 --- a/src/main/java/net/cybercake/discordmusicbot/commands/list/QueueCMD.java +++ b/src/main/java/net/cybercake/discordmusicbot/commands/list/QueueCMD.java @@ -50,9 +50,9 @@ public QueueCMD() { private int currentTrackIndex; public int getPageOf(int position) { - return (int) ((double)(position + ITEMS_PER_PAGE) / (double)ITEMS_PER_PAGE); + return (int) Math.floor((double) (position + (ITEMS_PER_PAGE - 1)) / ITEMS_PER_PAGE); // simple algebra - // \operatorname{floor}\left(\frac{v+6}{6}\right) + // \operatorname{floor}\left(\frac{v+5}{6}\right) // ^ paste into desmos // originated from the equation below: \left(i\cdot6\right)-6=p_{g} (where i is the index, like 7, and p_g is the page number) } @@ -65,7 +65,7 @@ private void handleQueueCMD(IReplyCallback callback, int page) { if (musicPlayer == null) return; this.currentTrackIndex = musicPlayer.getTrackScheduler().getQueue().getCurrentIndex(); - if (page == -1) + if (page != -1) page = getPageOf(currentTrackIndex); int maxPages = getMaxPages(callback.getGuild()); diff --git a/src/main/java/net/cybercake/discordmusicbot/commands/list/developer/LoadDev.java b/src/main/java/net/cybercake/discordmusicbot/commands/list/developer/LoadDev.java index 3949030..896ddfc 100644 --- a/src/main/java/net/cybercake/discordmusicbot/commands/list/developer/LoadDev.java +++ b/src/main/java/net/cybercake/discordmusicbot/commands/list/developer/LoadDev.java @@ -23,7 +23,7 @@ public LoadDev() { @Override public void command(SlashCommandInteractionEvent event) { try { - Command.getCommandClass(Play.class).handlePlay(event, "https://www.youtube.com/watch?v=X-nwU7fvUp4&list=PLQFF4PlpFPWUOAUyHHYrcI6PgP_5LBU19&index=1&pp=gAQBiAQB8AUB", false, true); + Command.getCommandClass(Play.class).handlePlay(event, "https://music.youtube.com/playlist?list=PLQFF4PlpFPWVkThOxHDoyyrsuzTuzwwW9", false, true); } catch (Exception exception) { Embeds.throwError(event, event.getUser(), "Error:" + exception.getMessage(), true, null); }