搜歌修复

This commit is contained in:
Coloryr committed 2020-03-25 22:14:05 +08:00
1 parent 2385c4f15c
commit b481be7759
3 files changed
+11 -11

No files matched your search

@@ -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, "");
}
@@ -5,7 +5,7 @@ import java.util.List;
public class SearchPage {
private List<SearchOBJ> resData;
private int page = 0;
private int maxpage = 0;
private int maxpage;
public SearchPage(List<SearchOBJ> 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() {
+2 -2
View File
@@ -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,点歌将被禁用",