This commit is contained in:
parent
bb32f085ac
commit
c0fcc2aaa0
@ -4,7 +4,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "cn.lunadeer"
|
group = "cn.lunadeer"
|
||||||
version = "2.1.5-beta"
|
version = "2.1.6-beta"
|
||||||
|
|
||||||
java {
|
java {
|
||||||
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
|
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
|
||||||
|
@ -5,6 +5,7 @@ import cn.lunadeer.dominion.controllers.GroupController;
|
|||||||
import cn.lunadeer.dominion.tuis.dominion.manage.group.GroupList;
|
import cn.lunadeer.dominion.tuis.dominion.manage.group.GroupList;
|
||||||
import cn.lunadeer.dominion.tuis.dominion.manage.group.GroupSetting;
|
import cn.lunadeer.dominion.tuis.dominion.manage.group.GroupSetting;
|
||||||
import cn.lunadeer.dominion.tuis.dominion.manage.group.SelectMember;
|
import cn.lunadeer.dominion.tuis.dominion.manage.group.SelectMember;
|
||||||
|
import cn.lunadeer.minecraftpluginutils.ColorParser;
|
||||||
import cn.lunadeer.minecraftpluginutils.Notification;
|
import cn.lunadeer.minecraftpluginutils.Notification;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -39,7 +40,7 @@ public class Group {
|
|||||||
BukkitPlayerOperator operator = BukkitPlayerOperator.create(sender);
|
BukkitPlayerOperator operator = BukkitPlayerOperator.create(sender);
|
||||||
String dominionName = args[2];
|
String dominionName = args[2];
|
||||||
String groupName = args[3];
|
String groupName = args[3];
|
||||||
GroupController.createGroup(operator, dominionName, groupName);
|
GroupController.createGroup(operator, dominionName, ColorParser.getPlainText(groupName), groupName);
|
||||||
GroupList.show(sender, dominionName);
|
GroupList.show(sender, dominionName);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Notification.error(sender, e.getMessage());
|
Notification.error(sender, e.getMessage());
|
||||||
@ -90,7 +91,7 @@ public class Group {
|
|||||||
String dominionName = args[2];
|
String dominionName = args[2];
|
||||||
String oldGroupName = args[3];
|
String oldGroupName = args[3];
|
||||||
String newGroupName = args[4];
|
String newGroupName = args[4];
|
||||||
GroupController.renameGroup(operator, dominionName, oldGroupName, newGroupName);
|
GroupController.renameGroup(operator, dominionName, oldGroupName, ColorParser.getPlainText(newGroupName), newGroupName);
|
||||||
GroupSetting.show(sender, dominionName, newGroupName);
|
GroupSetting.show(sender, dominionName, newGroupName);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Notification.error(sender, e.getMessage());
|
Notification.error(sender, e.getMessage());
|
||||||
|
@ -9,7 +9,7 @@ import static cn.lunadeer.dominion.controllers.Apis.notOwner;
|
|||||||
|
|
||||||
public class GroupController {
|
public class GroupController {
|
||||||
|
|
||||||
public static void createGroup(AbstractOperator operator, String domName, String groupName) {
|
public static void createGroup(AbstractOperator operator, String domName, String groupName, String nameColored) {
|
||||||
AbstractOperator.Result FAIL = new AbstractOperator.Result(AbstractOperator.Result.FAILURE, "创建权限组 %s 失败", groupName);
|
AbstractOperator.Result FAIL = new AbstractOperator.Result(AbstractOperator.Result.FAILURE, "创建权限组 %s 失败", groupName);
|
||||||
AbstractOperator.Result SUCCESS = new AbstractOperator.Result(AbstractOperator.Result.SUCCESS, "创建权限组 %s 成功", groupName);
|
AbstractOperator.Result SUCCESS = new AbstractOperator.Result(AbstractOperator.Result.SUCCESS, "创建权限组 %s 成功", groupName);
|
||||||
if (groupName.contains(" ")) {
|
if (groupName.contains(" ")) {
|
||||||
@ -30,7 +30,7 @@ public class GroupController {
|
|||||||
operator.setResponse(FAIL.addMessage("领地 %s 已存在名为 %s 的权限组", domName, groupName));
|
operator.setResponse(FAIL.addMessage("领地 %s 已存在名为 %s 的权限组", domName, groupName));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
group = GroupDTO.create(groupName, dominion);
|
group = GroupDTO.create(nameColored, dominion);
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
operator.setResponse(FAIL.addMessage("请联系服务器管理员"));
|
operator.setResponse(FAIL.addMessage("请联系服务器管理员"));
|
||||||
return;
|
return;
|
||||||
@ -96,7 +96,7 @@ public class GroupController {
|
|||||||
operator.setResponse(SUCCESS);
|
operator.setResponse(SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void renameGroup(AbstractOperator operator, String domName, String oldName, String newName) {
|
public static void renameGroup(AbstractOperator operator, String domName, String oldName, String newName, String nameColored) {
|
||||||
AbstractOperator.Result FAIL = new AbstractOperator.Result(AbstractOperator.Result.FAILURE, "重命名权限组 %s 为 %s 失败", oldName, newName);
|
AbstractOperator.Result FAIL = new AbstractOperator.Result(AbstractOperator.Result.FAILURE, "重命名权限组 %s 为 %s 失败", oldName, newName);
|
||||||
AbstractOperator.Result SUCCESS = new AbstractOperator.Result(AbstractOperator.Result.SUCCESS, "重命名权限组 %s 为 %s 成功", oldName, newName);
|
AbstractOperator.Result SUCCESS = new AbstractOperator.Result(AbstractOperator.Result.SUCCESS, "重命名权限组 %s 为 %s 成功", oldName, newName);
|
||||||
if (newName.contains(" ")) {
|
if (newName.contains(" ")) {
|
||||||
@ -117,7 +117,7 @@ public class GroupController {
|
|||||||
operator.setResponse(FAIL.addMessage("领地 %s 不存在名为 %s 的权限组", domName, oldName));
|
operator.setResponse(FAIL.addMessage("领地 %s 不存在名为 %s 的权限组", domName, oldName));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
group = group.setName(newName);
|
group = group.setName(nameColored);
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
operator.setResponse(FAIL.addMessage("请联系服务器管理员"));
|
operator.setResponse(FAIL.addMessage("请联系服务器管理员"));
|
||||||
return;
|
return;
|
||||||
|
@ -4,6 +4,7 @@ import cn.lunadeer.dominion.controllers.BukkitPlayerOperator;
|
|||||||
import cn.lunadeer.dominion.controllers.GroupController;
|
import cn.lunadeer.dominion.controllers.GroupController;
|
||||||
import cn.lunadeer.dominion.dtos.DominionDTO;
|
import cn.lunadeer.dominion.dtos.DominionDTO;
|
||||||
import cn.lunadeer.dominion.tuis.dominion.manage.group.GroupList;
|
import cn.lunadeer.dominion.tuis.dominion.manage.group.GroupList;
|
||||||
|
import cn.lunadeer.minecraftpluginutils.ColorParser;
|
||||||
import cn.lunadeer.minecraftpluginutils.Notification;
|
import cn.lunadeer.minecraftpluginutils.Notification;
|
||||||
import cn.lunadeer.minecraftpluginutils.XLogger;
|
import cn.lunadeer.minecraftpluginutils.XLogger;
|
||||||
import cn.lunadeer.minecraftpluginutils.scui.CuiTextInput;
|
import cn.lunadeer.minecraftpluginutils.scui.CuiTextInput;
|
||||||
@ -28,7 +29,7 @@ public class CreateGroup {
|
|||||||
public void handleData(String input) {
|
public void handleData(String input) {
|
||||||
XLogger.debug("createGroupCB.run: %s", input);
|
XLogger.debug("createGroupCB.run: %s", input);
|
||||||
BukkitPlayerOperator operator = BukkitPlayerOperator.create(sender);
|
BukkitPlayerOperator operator = BukkitPlayerOperator.create(sender);
|
||||||
GroupController.createGroup(operator, dominionName, input);
|
GroupController.createGroup(operator, dominionName, ColorParser.getPlainText(input), input);
|
||||||
GroupList.show(sender, dominionName);
|
GroupList.show(sender, dominionName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import cn.lunadeer.dominion.controllers.BukkitPlayerOperator;
|
|||||||
import cn.lunadeer.dominion.controllers.GroupController;
|
import cn.lunadeer.dominion.controllers.GroupController;
|
||||||
import cn.lunadeer.dominion.dtos.DominionDTO;
|
import cn.lunadeer.dominion.dtos.DominionDTO;
|
||||||
import cn.lunadeer.dominion.tuis.dominion.manage.group.GroupSetting;
|
import cn.lunadeer.dominion.tuis.dominion.manage.group.GroupSetting;
|
||||||
|
import cn.lunadeer.minecraftpluginutils.ColorParser;
|
||||||
import cn.lunadeer.minecraftpluginutils.Notification;
|
import cn.lunadeer.minecraftpluginutils.Notification;
|
||||||
import cn.lunadeer.minecraftpluginutils.XLogger;
|
import cn.lunadeer.minecraftpluginutils.XLogger;
|
||||||
import cn.lunadeer.minecraftpluginutils.scui.CuiTextInput;
|
import cn.lunadeer.minecraftpluginutils.scui.CuiTextInput;
|
||||||
@ -30,8 +31,8 @@ public class RenameGroup {
|
|||||||
public void handleData(String input) {
|
public void handleData(String input) {
|
||||||
XLogger.debug("renameGroupCB.run: %s", input);
|
XLogger.debug("renameGroupCB.run: %s", input);
|
||||||
BukkitPlayerOperator operator = BukkitPlayerOperator.create(sender);
|
BukkitPlayerOperator operator = BukkitPlayerOperator.create(sender);
|
||||||
GroupController.renameGroup(operator, dominionName, oldName, input);
|
GroupController.renameGroup(operator, dominionName, oldName, ColorParser.getPlainText(input), input);
|
||||||
GroupSetting.show(sender, dominionName, input);
|
GroupSetting.show(sender, dominionName, ColorParser.getPlainText(input));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cn.lunadeer.dominion.tuis;
|
package cn.lunadeer.dominion.tuis;
|
||||||
|
|
||||||
import cn.lunadeer.dominion.Cache;
|
import cn.lunadeer.dominion.Cache;
|
||||||
|
import cn.lunadeer.dominion.dtos.DominionDTO;
|
||||||
import cn.lunadeer.dominion.dtos.GroupDTO;
|
import cn.lunadeer.dominion.dtos.GroupDTO;
|
||||||
import cn.lunadeer.minecraftpluginutils.stui.ListView;
|
import cn.lunadeer.minecraftpluginutils.stui.ListView;
|
||||||
import cn.lunadeer.minecraftpluginutils.stui.components.Button;
|
import cn.lunadeer.minecraftpluginutils.stui.components.Button;
|
||||||
@ -32,13 +33,14 @@ public class TitleList {
|
|||||||
GroupDTO using = Cache.instance.getPlayerUsingGroupTitle(player.getUniqueId());
|
GroupDTO using = Cache.instance.getPlayerUsingGroupTitle(player.getUniqueId());
|
||||||
|
|
||||||
for (GroupDTO group : groups) {
|
for (GroupDTO group : groups) {
|
||||||
|
DominionDTO dominion = Cache.instance.getDominion(group.getDomID());
|
||||||
Line line = Line.create();
|
Line line = Line.create();
|
||||||
if (using != null && using.getId().equals(group.getId())) {
|
if (using != null && using.getId().equals(group.getId())) {
|
||||||
line.append(Button.createRed("卸下").setExecuteCommand("/dominion use_title -1").build());
|
line.append(Button.createRed("卸下").setExecuteCommand("/dominion use_title -1").build());
|
||||||
} else {
|
} else {
|
||||||
line.append(Button.createGreen("使用").setExecuteCommand("/dominion use_title " + group.getId()).build());
|
line.append(Button.createGreen("使用").setExecuteCommand("/dominion use_title " + group.getId()).build());
|
||||||
}
|
}
|
||||||
line.append(group.getNameColoredComponent());
|
line.append(group.getNameColoredComponent()).append("来自领地:" + dominion.getName());
|
||||||
view.add(line);
|
view.add(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public class GroupSetting {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ListView view = ListView.create(10, "/dominion group setting " + dominion.getName() + " " + group.getName());
|
ListView view = ListView.create(10, "/dominion group setting " + dominion.getName() + " " + group.getName());
|
||||||
view.title("权限组 " + group.getNameColoredBukkit() + " 管理");
|
view.title(Component.text("权限组 ").append(group.getNameColoredComponent()).append(Component.text(" 管理")));
|
||||||
view.navigator(
|
view.navigator(
|
||||||
Line.create()
|
Line.create()
|
||||||
.append(Button.create("主菜单").setExecuteCommand("/dominion menu").build())
|
.append(Button.create("主菜单").setExecuteCommand("/dominion menu").build())
|
||||||
|
Reference in New Issue
Block a user