优化部分代码

This commit is contained in:
zhangyuheng 2024-08-02 16:08:01 +08:00
parent 8bee085eda
commit 010e9386da
2 changed files with 3 additions and 5 deletions

View File

@ -72,7 +72,7 @@ public enum Flag {
VEHICLE_DESTROY("vehicle_destroy", "破坏载具", "是否可以破坏载具(主要是矿车)", false, false, true),
VEHICLE_SPAWN("vehicle_spawn", "生成载具", "是否可以生成载具(主要是矿车)", false, false, true),
VILLAGER_KILLING("villager_killing", "对村民造成伤害", "是否可以对村民造成伤害", false, false, true),
VILLAGER_SPAWN("villager_spawn", "村民繁殖", "是否允许村民繁殖", true, true, true),
VILLAGER_SPAWN("villager_spawn", "村民繁殖", "是否允许村民繁殖(包括村民蛋)", true, true, true),
WITHER_SPAWN("wither_spawn", "凋零生成", "凋零生成", false, true, true),
;
private final String flag_name;

View File

@ -29,7 +29,7 @@ public class DominionList {
view.navigator(Line.create().append(Button.create("主菜单").setExecuteCommand("/dominion menu").build()).append("我的领地"));
view.addLines(BuildTreeLines(DominionNode.BuildNodeTree(-1, DominionDTO.selectByOwner(player.getUniqueId())), 0));
List<String> admin_dominions = playerAdminDominions(sender);
if (admin_dominions.size() != 0) {
if (!admin_dominions.isEmpty()) {
view.add(Line.create().append(""));
view.add(Line.create().append(Component.text("--- 以下为你拥有管理员权限的领地 ---", ViewStyles.main_color)));
}
@ -43,9 +43,7 @@ public class DominionList {
public static List<Line> BuildTreeLines(List<DominionNode> dominionTree, Integer depth) {
List<Line> lines = new ArrayList<>();
StringBuilder prefix = new StringBuilder();
for (int i = 0; i < depth; i++) {
prefix.append(" | ");
}
prefix.append(" | ".repeat(Math.max(0, depth)));
for (DominionNode node : dominionTree) {
TextComponent manage = Button.createGreen("管理").setExecuteCommand("/dominion manage " + node.getDominion().getName()).build();
TextComponent delete = Button.createRed("删除").setExecuteCommand("/dominion delete " + node.getDominion().getName()).build();