|
|
|
@ -179,13 +179,40 @@ public class SchematicCommandUtils {
|
|
|
|
|
|
|
|
|
|
public static void printSchemInfo(Player player, SchematicNode node) {
|
|
|
|
|
SteamwarUser user = getUser(player);
|
|
|
|
|
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_SCHEM", player, node.getName());
|
|
|
|
|
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_NAME", player, node.generateBreadcrumbs(user));
|
|
|
|
|
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_OWNER", player, SteamwarUser.get(node.getOwner()).getUserName());
|
|
|
|
|
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_PARENT", player, node.getParent() == null || node.getParent() == 0 ? "/" : node.getParentNode().generateBreadcrumbs(user));
|
|
|
|
|
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_UPDATED", player, node.getLastUpdate().toLocalDateTime());
|
|
|
|
|
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_TYPE", player, node.isDir() ? SchematicSystem.MESSAGE.parse("UTIL_INFO_TYPE_DIR", player) : node.getSchemtype().name());
|
|
|
|
|
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_SCHEM", player, node.generateBreadcrumbs(user));
|
|
|
|
|
if(node.getOwner() == user.getId()) {
|
|
|
|
|
player.spigot().sendMessage(
|
|
|
|
|
new ComponentBuilder(SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_NAME", false, player, node.getName()))
|
|
|
|
|
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[] {SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_ACTION_RENAME_HOVER", false, player)}))
|
|
|
|
|
.event(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/schem rename " + node.generateBreadcrumbs(user) + " "))
|
|
|
|
|
.create()
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_NAME", player, node.getName());
|
|
|
|
|
}
|
|
|
|
|
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_OWNER", player, node.getOwner() == user.getId() ? user.getUserName() : SteamwarUser.get(node.getOwner()).getUserName());
|
|
|
|
|
if(node.getOwner() == user.getId()) {
|
|
|
|
|
player.spigot().sendMessage(
|
|
|
|
|
new ComponentBuilder(SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_PARENT", false, player, node.getParent() == null ? "/" : node.getParentNode().generateBreadcrumbs(user)))
|
|
|
|
|
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[] {SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_ACTION_MOVE_HOVER", false, player)}))
|
|
|
|
|
.event(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/schem move " + node.generateBreadcrumbs(user) + " " + node.generateBreadcrumbs(user).replace("/" + node.getName(), "")))
|
|
|
|
|
.create()
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_PARENT", player, node.getParent() == null ? "/" : node.getParentNode().generateBreadcrumbs(user));
|
|
|
|
|
}
|
|
|
|
|
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_UPDATED", player, node.getLastUpdate());
|
|
|
|
|
if (!node.isDir()) {
|
|
|
|
|
if(node.getOwner() == user.getId()) {
|
|
|
|
|
player.spigot().sendMessage(
|
|
|
|
|
new ComponentBuilder(SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_TYPE", false, player, node.getSchemtype().name()))
|
|
|
|
|
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[] {SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_ACTION_TYPE_HOVER", false, player)}))
|
|
|
|
|
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem changetype " + node.generateBreadcrumbs(user)))
|
|
|
|
|
.create()
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_TYPE", player, node.getSchemtype().name());
|
|
|
|
|
}
|
|
|
|
|
if (node.getRank() > 0) {
|
|
|
|
|
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_RANK", player, node.getRank());
|
|
|
|
|
}
|
|
|
|
@ -193,16 +220,35 @@ public class SchematicCommandUtils {
|
|
|
|
|
if (node.getSchemtype().fightType()) {
|
|
|
|
|
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_COLOR", player, SchematicSystem.MESSAGE.parse(node.replaceColor() ? "ON" : "OFF", player));
|
|
|
|
|
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_REPLAY", player, SchematicSystem.MESSAGE.parse(node.allowReplay() ? "ON" : "OFF", player));
|
|
|
|
|
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_ELO", player, node.getElo(Season.getSeason()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_FORMAT", player, node.getSchemFormat() ? ".schem" : ".schematic");
|
|
|
|
|
CheckedSchematic.getLastDeclinedOfNode(node).stream().findFirst().ifPresent(checkedSchematic ->
|
|
|
|
|
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_STATUS", player, checkedSchematic.getStartTime(), checkedSchematic.getDeclineReason()));
|
|
|
|
|
CheckedSchematic.getLastDeclinedOfNode(node).stream().findFirst().ifPresent(checkedSchematic -> SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_STATUS", player, checkedSchematic.getEndTime(), checkedSchematic.getDeclineReason()));
|
|
|
|
|
} else {
|
|
|
|
|
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_TYPE", player, SchematicSystem.MESSAGE.parse("UTIL_INFO_TYPE_DIR", player));
|
|
|
|
|
}
|
|
|
|
|
List<String> schematicMembers = new ArrayList<>();
|
|
|
|
|
NodeMember.getNodeMembers(node.getId()).forEach(nodeMember -> schematicMembers.add(SteamwarUser.get(nodeMember.getMember()).getUserName()));
|
|
|
|
|
if (!schematicMembers.isEmpty()) {
|
|
|
|
|
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_MEMBER", player, schematicMembers);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(node.getOwner() == user.getId()) {
|
|
|
|
|
ComponentBuilder memberBuilder = new ComponentBuilder(SchematicSystem.MESSAGE.parse("UTIL_INFO_MEMBER_STRING", player) + " ").color(ChatColor.GRAY);
|
|
|
|
|
NodeMember.getNodeMembers(node.getId()).forEach(nodeMember -> {
|
|
|
|
|
SteamwarUser member = SteamwarUser.get(nodeMember.getMember());
|
|
|
|
|
memberBuilder.append(member.getUserName())
|
|
|
|
|
.color(ChatColor.YELLOW)
|
|
|
|
|
.event(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/schem delmember " + node.generateBreadcrumbs(user) + " " + member.getUserName()))
|
|
|
|
|
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[]{SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_ACTION_REMOVE_HOVER", false, player, member.getUserName())}))
|
|
|
|
|
.append(" ", ComponentBuilder.FormatRetention.NONE);
|
|
|
|
|
});
|
|
|
|
|
memberBuilder.append("(+)", ComponentBuilder.FormatRetention.NONE)
|
|
|
|
|
.color(ChatColor.GREEN)
|
|
|
|
|
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[]{SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_ACTION_ADD_HOVER", false, player)}))
|
|
|
|
|
.event(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/schem addmember " + node.generateBreadcrumbs(user) + " "));
|
|
|
|
|
player.spigot().sendMessage(memberBuilder.create());
|
|
|
|
|
} else {
|
|
|
|
|
List<String> schematicMembers = new ArrayList<>();
|
|
|
|
|
NodeMember.getNodeMembers(node.getId()).forEach(nodeMember -> schematicMembers.add(SteamwarUser.get(nodeMember.getMember()).getUserName()));
|
|
|
|
|
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_MEMBER", player, schematicMembers.stream().reduce((s, s2) -> s + ", " + s2).orElse(""));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TextComponent base = new TextComponent();
|
|
|
|
@ -220,45 +266,13 @@ public class SchematicCommandUtils {
|
|
|
|
|
download.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[]{SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_ACTION_DOWNLOAD_HOVER", false, player)}));
|
|
|
|
|
download.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem download " + node.generateBreadcrumbs(user)));
|
|
|
|
|
base.addExtra(download);
|
|
|
|
|
|
|
|
|
|
TextComponent changeTyp = SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_ACTION_TYPE", false, player);
|
|
|
|
|
changeTyp.setColor(ChatColor.BLUE);
|
|
|
|
|
changeTyp.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[]{SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_ACTION_TYPE_HOVER", false, player)}));
|
|
|
|
|
changeTyp.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem changetype " + node.generateBreadcrumbs(user)));
|
|
|
|
|
base.addExtra(changeTyp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (node.getOwner() == user.getId()) {
|
|
|
|
|
TextComponent addMember = SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_ACTION_ADD", false, player);
|
|
|
|
|
addMember.setColor(ChatColor.AQUA);
|
|
|
|
|
addMember.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[]{SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_ACTION_ADD_HOVER", false, player)}));
|
|
|
|
|
addMember.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/schem addmember " + node.generateBreadcrumbs(user) + " "));
|
|
|
|
|
base.addExtra(addMember);
|
|
|
|
|
|
|
|
|
|
TextComponent delMember = SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_ACTION_REMOVE", false, player);
|
|
|
|
|
delMember.setColor(ChatColor.RED);
|
|
|
|
|
delMember.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[]{SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_ACTION_REMOVE_HOVER", false, player)}));
|
|
|
|
|
delMember.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/schem delmember " + node.generateBreadcrumbs(user) + " "));
|
|
|
|
|
base.addExtra(delMember);
|
|
|
|
|
|
|
|
|
|
TextComponent move = SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_ACTION_MOVE", false, player);
|
|
|
|
|
move.setColor(ChatColor.DARK_PURPLE);
|
|
|
|
|
move.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[]{SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_ACTION_MOVE_HOVER", false, player)}));
|
|
|
|
|
move.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/schem move " + node.generateBreadcrumbs(user) + " " + node.generateBreadcrumbs(user).replace("/" + node.getName(), "")));
|
|
|
|
|
base.addExtra(move);
|
|
|
|
|
|
|
|
|
|
TextComponent rename = SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_ACTION_RENAME", false, player);
|
|
|
|
|
rename.setColor(ChatColor.LIGHT_PURPLE);
|
|
|
|
|
rename.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[]{SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_ACTION_RENAME_HOVER", false, player)}));
|
|
|
|
|
rename.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/schem rename " + node.generateBreadcrumbs(user) + " [Neuer Name]"));
|
|
|
|
|
base.addExtra(rename);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TextComponent delete = SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_ACTION_DELETE", false, player);
|
|
|
|
|
delete.setColor(ChatColor.DARK_RED);
|
|
|
|
|
delete.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[]{SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_ACTION_DELETE_HOVER", false, player)}));
|
|
|
|
|
delete.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem delete " + node.generateBreadcrumbs(user)));
|
|
|
|
|
delete.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/schem delete " + node.generateBreadcrumbs(user)));
|
|
|
|
|
base.addExtra(delete);
|
|
|
|
|
|
|
|
|
|
if (!base.getExtra().isEmpty()) {
|
|
|
|
|