From b481be77598538e3a8942b625feffe6bb79713f7 Mon Sep 17 00:00:00 2001 From: Coloryr <402067010@qq.com> Date: Wed, 25 Mar 2020 22:14:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=9C=E6=AD=8C=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/Color_yr/ALLMusic/Command/CommandEX.java | 10 +++++----- .../ALLMusic/MusicAPI/SongSearch/SearchPage.java | 8 ++++---- src/main/resources/Message.json | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/Color_yr/ALLMusic/Command/CommandEX.java b/src/main/java/Color_yr/ALLMusic/Command/CommandEX.java index a774f1b1..f6a5fee7 100644 --- a/src/main/java/Color_yr/ALLMusic/Command/CommandEX.java +++ b/src/main/java/Color_yr/ALLMusic/Command/CommandEX.java @@ -47,8 +47,12 @@ public class CommandEX { SearchOBJ item; String info; ALLMusic.Side.SendMessage(sender, ""); + if (search.haveLastPage()) { + ALLMusic.Side.SendMessage(sender, ALLMusic.Message.getPage().getLast(), + ClickEvent.Action.RUN_COMMAND, "/music lastpage"); + } for (int a = 0; a < index; a++) { - item = search.getRes(a + search.getPage()); + item = search.getRes(a + search.getPage() * 10); info = ALLMusic.Message.getPage().getChoice(); info = info.replace("%index%", "" + (a + 1)) .replace("%MusicName%", item.getName()) @@ -61,10 +65,6 @@ public class CommandEX { ALLMusic.Side.SendMessage(sender, ALLMusic.Message.getPage().getNext(), ClickEvent.Action.RUN_COMMAND, "/music nextpage"); } - if (search.haveLastPage()) { - ALLMusic.Side.SendMessage(sender, ALLMusic.Message.getPage().getLast(), - ClickEvent.Action.RUN_COMMAND, "/music lastpage"); - } ALLMusic.Side.SendMessage(sender, ""); } diff --git a/src/main/java/Color_yr/ALLMusic/MusicAPI/SongSearch/SearchPage.java b/src/main/java/Color_yr/ALLMusic/MusicAPI/SongSearch/SearchPage.java index 9cb4c18e..f89577d9 100644 --- a/src/main/java/Color_yr/ALLMusic/MusicAPI/SongSearch/SearchPage.java +++ b/src/main/java/Color_yr/ALLMusic/MusicAPI/SongSearch/SearchPage.java @@ -5,7 +5,7 @@ import java.util.List; public class SearchPage { private List resData; private int page = 0; - private int maxpage = 0; + private int maxpage; public SearchPage(List resData, int maxpage) { this.resData = resData; @@ -21,14 +21,14 @@ public class SearchPage { } public boolean nextPage() { - if (page == maxpage) + if (!haveNextPage()) return false; page++; return true; } public boolean lastPage() { - if (page == 0) + if (!haveLastPage()) return false; page--; return true; @@ -40,7 +40,7 @@ public class SearchPage { } public boolean haveNextPage() { - return page < maxpage; + return page != (maxpage - 1); } public boolean haveLastPage() { diff --git a/src/main/resources/Message.json b/src/main/resources/Message.json index 790efbad..305ff4f0 100644 --- a/src/main/resources/Message.json +++ b/src/main/resources/Message.json @@ -26,8 +26,8 @@ }, "Page": { "Choice": "§b[§n点我选择§r§b]§2%index%->%MusicName% | %MusicAuthor% | %MusicAl%", - "Next": "§d[ALLMusic]§e[§n点我下一页§r§b]", - "Last": "§d[ALLMusic]§e[§n点我上一页§r§b]" + "Next": "§d[ALLMusic]§e[§n点我下一页§r§e]", + "Last": "§d[ALLMusic]§e[§n点我上一页§r§e]" }, "Check": { "NoMOD": "§d[ALLMusic]§2你没有安装AllMusic配套mod,点歌将被禁用",