优化了UI显示

This commit is contained in:
zhangyuheng 2024-02-10 17:44:56 +08:00
parent 15f19865ef
commit 1d369afc80
6 changed files with 11 additions and 4 deletions

View File

@ -31,7 +31,7 @@ public class DominionFlagInfo {
} catch (Exception ignored) {
}
}
ListView view = ListView.create(6, "/dominion flag_info " + dominion.getName());
ListView view = ListView.create(10, "/dominion flag_info " + dominion.getName());
view.title("领地 " + dominion.getName() + " 默认权限")
.navigator(Line.create()
.append(Button.create("主菜单", "/dominion menu"))

View File

@ -33,7 +33,7 @@ public class DominionPrivilegeList {
Notification.error(sender, "你不在任何领地内,请指定领地名称 /dominion privilege_list <领地名称>");
return;
}
ListView view = ListView.create(5, "/dominion privilege_list " + dominion.getName());
ListView view = ListView.create(10, "/dominion privilege_list " + dominion.getName());
if (noAuthToManage(player, dominion)) return;
List<PlayerPrivilegeDTO> privileges = PlayerPrivilegeDTO.select(dominion.getId());
if (privileges.isEmpty()) {

View File

@ -19,7 +19,7 @@ public class ListDominion {
Player player = playerOnly(sender);
if (player == null) return;
int page = getPage(args);
ListView view = ListView.create(5, "/dominion list");
ListView view = ListView.create(10, "/dominion list");
List<String> dominions = playerDominions(sender);
if (dominions.isEmpty()) {
Notification.warn(sender, "你没有任何领地");

View File

@ -32,7 +32,7 @@ public class PrivilegeInfo {
Notification.error(sender, "你不在任何领地内,请指定领地名称 /dominion privilege_info <玩家名称> [领地名称]");
return;
}
ListView view = ListView.create(5, "/dominion privilege_info " + playerName + " " + dominion.getName());
ListView view = ListView.create(10, "/dominion privilege_info " + playerName + " " + dominion.getName());
if (noAuthToManage(player, dominion)) return;
PlayerDTO playerDTO = PlayerDTO.select(playerName);
if (playerDTO == null) {

View File

@ -73,6 +73,9 @@ public class ListView {
}
for (int i = offset; i < offset + page_size; i++) {
if (i >= lines.size()) {
for (int j = 0; j < page_size - lines.size() % page_size; j++) {
view.addLine(Line.create());
}
break;
}
view.addLine(lines.get(i));

View File

@ -25,9 +25,13 @@ public class Pagination {
componentList.add(Component.text("", main_color));
if (page > 1) {
componentList.add(Button.create("上一页", command + " " + (page - 1)));
} else {
componentList.add(Component.text("[上一页]", sub_color));
}
if (page < page_count) {
componentList.add(Button.create("下一页", command + " " + (page + 1)));
} else {
componentList.add(Component.text("[下一页]", sub_color));
}
TextComponent.Builder builder = Component.text();
for (Component component : componentList) {