mirror of
https://github.com/ColdeZhang/Dominion.git
synced 2025-01-27 09:43:56 +08:00
优化了一些命名
“默认权限”->“访客权限” “玩家特权”->“成员权限”
This commit is contained in:
parent
34eed403e4
commit
3ec1a3447c
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>cn.lunadeer</groupId>
|
||||
<artifactId>Dominion</artifactId>
|
||||
<version>1.28.6-beta</version>
|
||||
<version>1.28.7-beta</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Dominion</name>
|
||||
|
@ -162,6 +162,9 @@ public class Commands implements TabExecutor {
|
||||
case "cui_create":
|
||||
OpenCUI.CreateDominion(sender, args);
|
||||
break;
|
||||
case "cui_create_privilege":
|
||||
OpenCUI.CreatePrivilege(sender, args);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -2,8 +2,11 @@ package cn.lunadeer.dominion.commands;
|
||||
|
||||
import cn.lunadeer.dominion.Dominion;
|
||||
import cn.lunadeer.dominion.controllers.DominionController;
|
||||
import cn.lunadeer.dominion.controllers.PrivilegeController;
|
||||
import cn.lunadeer.dominion.dtos.DominionDTO;
|
||||
import cn.lunadeer.dominion.tuis.DominionManage;
|
||||
import cn.lunadeer.dominion.tuis.DominionPrivilegeList;
|
||||
import cn.lunadeer.dominion.tuis.SelectPlayer;
|
||||
import cn.lunadeer.minecraftpluginutils.Notification;
|
||||
import cn.lunadeer.minecraftpluginutils.XLogger;
|
||||
import cn.lunadeer.minecraftpluginutils.scui.CuiTextInput;
|
||||
@ -93,6 +96,26 @@ public class OpenCUI {
|
||||
}
|
||||
}
|
||||
|
||||
private static class createPrivilegeCB implements CuiTextInput.InputCallback {
|
||||
private final Player sender;
|
||||
private final String dominionName;
|
||||
|
||||
public createPrivilegeCB(Player sender, String dominionName) {
|
||||
this.sender = sender;
|
||||
this.dominionName = dominionName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleData(String input) {
|
||||
XLogger.debug("createPrivilegeCB.run: %s", input);
|
||||
if (PrivilegeController.createPrivilege(sender, input, dominionName)) {
|
||||
DominionPrivilegeList.show(sender, new String[]{"privilege_list", dominionName});
|
||||
} else {
|
||||
SelectPlayer.show(sender, new String[]{"select_player_create_privilege", dominionName});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void RenameDominion(CommandSender sender, String[] args) {
|
||||
Player player = playerOnly(sender);
|
||||
if (player == null) return;
|
||||
@ -134,4 +157,17 @@ public class OpenCUI {
|
||||
CuiTextInput view = CuiTextInput.create(createDominionCB).setText("未命名领地").title("输入要创建的领地名称");
|
||||
view.open(player);
|
||||
}
|
||||
|
||||
public static void CreatePrivilege(CommandSender sender, String[] args) {
|
||||
Player player = playerOnly(sender);
|
||||
if (player == null) return;
|
||||
DominionDTO dominion = DominionDTO.select(args[1]);
|
||||
if (dominion == null) {
|
||||
Notification.error(sender, "领地不存在");
|
||||
return;
|
||||
}
|
||||
CuiTextInput.InputCallback createPrivilegeCB = new createPrivilegeCB(player, dominion.getName());
|
||||
CuiTextInput view = CuiTextInput.create(createPrivilegeCB).setText("Steve").title("输入玩家名称以添加为成员");
|
||||
view.open(player);
|
||||
}
|
||||
}
|
||||
|
@ -34,12 +34,12 @@ public class DominionFlagInfo {
|
||||
}
|
||||
}
|
||||
ListView view = ListView.create(10, "/dominion flag_info " + dominion.getName());
|
||||
view.title("领地 " + dominion.getName() + " 默认权限")
|
||||
view.title("领地 " + dominion.getName() + " 访客权限")
|
||||
.navigator(Line.create()
|
||||
.append(Button.create("主菜单").setExecuteCommand("/dominion menu").build())
|
||||
.append(Button.create("我的领地").setExecuteCommand("/dominion list").build())
|
||||
.append(Button.create("管理界面").setExecuteCommand("/dominion manage " + dominion.getName()).build())
|
||||
.append("权限列表"));
|
||||
.append("访客权限"));
|
||||
for (Flag flag : Flag.getDominionFlagsEnabled()) {
|
||||
view.add(createOption(flag, dominion.getFlagValue(flag), dominion.getName(), page));
|
||||
}
|
||||
|
@ -26,11 +26,11 @@ public class DominionManage {
|
||||
.append(Button.create("详细信息").setExecuteCommand("/dominion info " + dominion.getName()).build())
|
||||
.append("查看领地详细信息");
|
||||
Line flag_info = Line.create()
|
||||
.append(Button.create("权限设置").setExecuteCommand("/dominion flag_info " + dominion.getName()).build())
|
||||
.append("管理领地默认权限");
|
||||
.append(Button.create("访客权限").setExecuteCommand("/dominion flag_info " + dominion.getName()).build())
|
||||
.append("访客在此领地的权限");
|
||||
Line privilege_list = Line.create()
|
||||
.append(Button.create("玩家权限").setExecuteCommand("/dominion privilege_list " + dominion.getName()).build())
|
||||
.append("管理玩家特权");
|
||||
.append(Button.create("成员权限").setExecuteCommand("/dominion privilege_list " + dominion.getName()).build())
|
||||
.append("管理此领地成员的权限");
|
||||
Line set_tp = Line.create()
|
||||
.append(Button.create("设置传送点").setExecuteCommand("/dominion set_tp_location " + dominion.getName()).build())
|
||||
.append("设置当前位置为此领地传送点");
|
||||
|
@ -36,22 +36,22 @@ public class DominionPrivilegeList {
|
||||
ListView view = ListView.create(10, "/dominion privilege_list " + dominion.getName());
|
||||
if (noAuthToManage(player, dominion)) return;
|
||||
List<PlayerPrivilegeDTO> privileges = PlayerPrivilegeDTO.select(dominion.getId());
|
||||
view.title("领地 " + dominion.getName() + " 玩家特权列表");
|
||||
view.title("领地 " + dominion.getName() + " 成员列表");
|
||||
view.navigator(
|
||||
Line.create()
|
||||
.append(Button.create("主菜单").setExecuteCommand("/dominion menu").build())
|
||||
.append(Button.create("我的领地").setExecuteCommand("/dominion list").build())
|
||||
.append(Button.create("管理界面").setExecuteCommand("/dominion manage " + dominion.getName()).build())
|
||||
.append("特权列表")
|
||||
.append("成员列表")
|
||||
);
|
||||
view.add(Line.create().append(Button.create("选择玩家创建特权").setExecuteCommand("/dominion select_player_create_privilege " + dominion.getName()).build()));
|
||||
view.add(Line.create().append(Button.create("添加成员").setExecuteCommand("/dominion select_player_create_privilege " + dominion.getName()).build()));
|
||||
for (PlayerPrivilegeDTO privilege : privileges) {
|
||||
PlayerDTO p_player = PlayerDTO.select(privilege.getPlayerUUID());
|
||||
if (p_player == null) continue;
|
||||
view.add(Line.create()
|
||||
.append(p_player.getLastKnownName())
|
||||
.append(Button.createGreen("管理").setExecuteCommand("/dominion privilege_info " + p_player.getLastKnownName() + " " + dominion.getName()).build())
|
||||
.append(Button.createRed("清除").setExecuteCommand("/dominion clear_privilege " + p_player.getLastKnownName() + " " + dominion.getName() + " b").build())
|
||||
.append(Button.createGreen("配置权限").setExecuteCommand("/dominion privilege_info " + p_player.getLastKnownName() + " " + dominion.getName()).build())
|
||||
.append(Button.createRed("移除成员").setExecuteCommand("/dominion clear_privilege " + p_player.getLastKnownName() + " " + dominion.getName() + " b").build())
|
||||
);
|
||||
}
|
||||
view.showOn(player, page);
|
||||
|
@ -43,17 +43,17 @@ public class PrivilegeInfo {
|
||||
}
|
||||
PlayerPrivilegeDTO privilege = PlayerPrivilegeDTO.select(playerDTO.getUuid(), dominion.getId());
|
||||
if (privilege == null) {
|
||||
Notification.warn(sender, "玩家 %s 没有任何特权", playerName);
|
||||
Notification.warn(sender, "玩家 %s 不是领地 %s 的成员", playerName, dominion.getName());
|
||||
return;
|
||||
}
|
||||
view.title("玩家 " + playerName + " 在领地 " + dominion.getName() + " 的特权信息");
|
||||
view.title("玩家 " + playerName + " 在领地 " + dominion.getName() + " 的权限设置");
|
||||
view.navigator(
|
||||
Line.create()
|
||||
.append(Button.create("主菜单").setExecuteCommand("/dominion menu").build())
|
||||
.append(Button.create("我的领地").setExecuteCommand("/dominion list").build())
|
||||
.append(Button.create("管理界面").setExecuteCommand("/dominion manage " + dominion.getName()).build())
|
||||
.append(Button.create("特权列表").setExecuteCommand("/dominion privilege_list " + dominion.getName()).build())
|
||||
.append("特权信息")
|
||||
.append(Button.create("成员列表").setExecuteCommand("/dominion privilege_list " + dominion.getName()).build())
|
||||
.append("成员权限")
|
||||
);
|
||||
if (privilege.getAdmin()) {
|
||||
view.add(Line.create()
|
||||
|
@ -26,8 +26,11 @@ public class SelectPlayer {
|
||||
}
|
||||
String dominion_name = args[1];
|
||||
ListView view = ListView.create(10, "/dominion select_player_create_privilege " + dominion_name);
|
||||
Line sub = Line.create().append("只能选择已经登录过的玩家").append(Button.create("返回").setExecuteCommand("/dominion privilege_list " + dominion_name).build());
|
||||
view.title("选择玩家以创建特权").subtitle(sub);
|
||||
Line sub = Line.create()
|
||||
.append("只能选择已经登录过的玩家")
|
||||
.append(Button.create("搜索").setExecuteCommand("/dominion cui_create_privilege " + dominion_name).build())
|
||||
.append(Button.create("返回").setExecuteCommand("/dominion privilege_list " + dominion_name).build());
|
||||
view.title("选择玩家添加为成员").subtitle(sub);
|
||||
List<PlayerDTO> players = PlayerController.allPlayers();
|
||||
for (PlayerDTO p : players) {
|
||||
if (p.getUuid() == player.getUniqueId()) {
|
||||
|
Loading…
Reference in New Issue
Block a user