13
0

Merge pull request 'Schematic Info Rework' (#122) from schem_info_rework into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Reviewed-on: #122
Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Chaoscaot 2022-07-03 12:46:46 +02:00
Commit 23d7698076
3 geänderte Dateien mit 70 neuen und 63 gelöschten Zeilen

Datei anzeigen

@ -33,28 +33,25 @@ UTIL_INFO_OWNER=§7Owner: §e{0}
UTIL_INFO_PARENT=§7Directory: §e{0} UTIL_INFO_PARENT=§7Directory: §e{0}
UTIL_INFO_UPDATED=§7Last update: §e{0} UTIL_INFO_UPDATED=§7Last update: §e{0}
UTIL_INFO_TYPE=§7Type: §e{0} UTIL_INFO_TYPE=§7Type: §e{0}
UTIL_INFO_TYPE_DIR=§7DIR UTIL_INFO_TYPE_DIR=§eDIR
UTIL_INFO_RANK=§7Rank: §e{0} UTIL_INFO_RANK=§7Rank: §e{0}
UTIL_INFO_COLOR=§Color translation: {0} UTIL_INFO_COLOR=§Color translation: {0}
UTIL_INFO_REPLAY=§7Replay playback: {0} UTIL_INFO_REPLAY=§7Replay playback: {0}
UTIL_INFO_ELO=§7Elo: §e{0}
UTIL_INFO_FORMAT=§7Format: §e{0} UTIL_INFO_FORMAT=§7Format: §e{0}
UTIL_INFO_STATUS=§cState: §c{0}: {1} UTIL_INFO_STATUS=§cState: §c{0}: {1}
UTIL_INFO_MEMBER=§7Members: §e{0} UTIL_INFO_MEMBER=§7Members: §e{0}
UTIL_INFO_ACTION_LOAD=[Load] UTIL_INFO_MEMBER_STRING=Members:
UTIL_INFO_ACTION_LOAD=(Load)
UTIL_INFO_ACTION_LOAD_HOVER=§eLoad schematic UTIL_INFO_ACTION_LOAD_HOVER=§eLoad schematic
UTIL_INFO_ACTION_DOWNLOAD=[Download] UTIL_INFO_ACTION_DOWNLOAD=(Download)
UTIL_INFO_ACTION_DOWNLOAD_HOVER=§eDownload schematic UTIL_INFO_ACTION_DOWNLOAD_HOVER=§eDownload schematic
UTIL_INFO_ACTION_TYPE=[Change type]
UTIL_INFO_ACTION_TYPE_HOVER=§eChange schematic type UTIL_INFO_ACTION_TYPE_HOVER=§eChange schematic type
UTIL_INFO_ACTION_ADD=[Add]
UTIL_INFO_ACTION_ADD_HOVER=§eAdd member UTIL_INFO_ACTION_ADD_HOVER=§eAdd member
UTIL_INFO_ACTION_REMOVE=[Remove] UTIL_INFO_ACTION_REMOVE_HOVER=§eRemove {0}
UTIL_INFO_ACTION_REMOVE_HOVER=§eRemove member
UTIL_INFO_ACTION_MOVE=[Move]
UTIL_INFO_ACTION_MOVE_HOVER=§eMove schematic UTIL_INFO_ACTION_MOVE_HOVER=§eMove schematic
UTIL_INFO_ACTION_RENAME=[Rename]
UTIL_INFO_ACTION_RENAME_HOVER=§eRename schematic UTIL_INFO_ACTION_RENAME_HOVER=§eRename schematic
UTIL_INFO_ACTION_DELETE=[Delete] UTIL_INFO_ACTION_DELETE=(Delete)
UTIL_INFO_ACTION_DELETE_HOVER=§eDelete schematic UTIL_INFO_ACTION_DELETE_HOVER=§eDelete schematic
UTIL_LOAD_NOT_HERE=§cYou cannot load schematics here UTIL_LOAD_NOT_HERE=§cYou cannot load schematics here
UTIL_LOAD_NOT_HERE_ALL=§cSchematics cannot be loaded on this build UTIL_LOAD_NOT_HERE_ALL=§cSchematics cannot be loaded on this build

Datei anzeigen

@ -29,20 +29,16 @@ UTIL_INFO_COLOR=§7Farbersetzung: {0}
UTIL_INFO_REPLAY=§7Replaywiedergabe: {0} UTIL_INFO_REPLAY=§7Replaywiedergabe: {0}
UTIL_INFO_STATUS=§cStatus: §c{0}: {1} UTIL_INFO_STATUS=§cStatus: §c{0}: {1}
UTIL_INFO_MEMBER=§7Mitglieder: §e{0} UTIL_INFO_MEMBER=§7Mitglieder: §e{0}
UTIL_INFO_ACTION_LOAD=[Laden] UTIL_INFO_MEMBER_STRING=Mitglieder:
UTIL_INFO_ACTION_LOAD=(Laden)
UTIL_INFO_ACTION_LOAD_HOVER=§eSchematic laden UTIL_INFO_ACTION_LOAD_HOVER=§eSchematic laden
UTIL_INFO_ACTION_DOWNLOAD_HOVER=§eSchematic downloaden UTIL_INFO_ACTION_DOWNLOAD_HOVER=§eSchematic downloaden
UTIL_INFO_ACTION_TYPE=[Typ ändern]
UTIL_INFO_ACTION_TYPE_HOVER=§eSchematic Typ ändern UTIL_INFO_ACTION_TYPE_HOVER=§eSchematic Typ ändern
UTIL_INFO_ACTION_ADD=[Hinzufügen]
UTIL_INFO_ACTION_ADD_HOVER=§eMember hinzufügen UTIL_INFO_ACTION_ADD_HOVER=§eMember hinzufügen
UTIL_INFO_ACTION_REMOVE=[Entfernen] UTIL_INFO_ACTION_REMOVE_HOVER=§e{0} entfernen
UTIL_INFO_ACTION_REMOVE_HOVER=§eMember entfernen
UTIL_INFO_ACTION_MOVE=[Verschieben]
UTIL_INFO_ACTION_MOVE_HOVER=§eSchematic verschieben UTIL_INFO_ACTION_MOVE_HOVER=§eSchematic verschieben
UTIL_INFO_ACTION_RENAME=[Umbenennen]
UTIL_INFO_ACTION_RENAME_HOVER=§eSchematic umbenennen UTIL_INFO_ACTION_RENAME_HOVER=§eSchematic umbenennen
UTIL_INFO_ACTION_DELETE=[Löschen] UTIL_INFO_ACTION_DELETE=(Löschen)
UTIL_INFO_ACTION_DELETE_HOVER=§eSchematic löschen UTIL_INFO_ACTION_DELETE_HOVER=§eSchematic löschen
UTIL_LOAD_NOT_HERE=§cDu kannst hier keine Schematics laden UTIL_LOAD_NOT_HERE=§cDu kannst hier keine Schematics laden
UTIL_LOAD_NOT_HERE_ALL=§cAuf diesem Bau können keine Schematics geladen werden UTIL_LOAD_NOT_HERE_ALL=§cAuf diesem Bau können keine Schematics geladen werden

Datei anzeigen

@ -179,13 +179,40 @@ public class SchematicCommandUtils {
public static void printSchemInfo(Player player, SchematicNode node) { public static void printSchemInfo(Player player, SchematicNode node) {
SteamwarUser user = getUser(player); SteamwarUser user = getUser(player);
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_SCHEM", player, node.getName()); SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_SCHEM", player, node.generateBreadcrumbs(user));
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_NAME", player, node.generateBreadcrumbs(user)); if(node.getOwner() == user.getId()) {
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_OWNER", player, SteamwarUser.get(node.getOwner()).getUserName()); player.spigot().sendMessage(
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_PARENT", player, node.getParent() == null || node.getParent() == 0 ? "/" : node.getParentNode().generateBreadcrumbs(user)); new ComponentBuilder(SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_NAME", false, player, node.getName()))
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_UPDATED", player, node.getLastUpdate().toLocalDateTime()); .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[] {SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_ACTION_RENAME_HOVER", false, player)}))
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_TYPE", player, node.isDir() ? SchematicSystem.MESSAGE.parse("UTIL_INFO_TYPE_DIR", player) : node.getSchemtype().name()); .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.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) { if (node.getRank() > 0) {
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_RANK", player, node.getRank()); SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_RANK", player, node.getRank());
} }
@ -193,16 +220,35 @@ public class SchematicCommandUtils {
if (node.getSchemtype().fightType()) { if (node.getSchemtype().fightType()) {
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_COLOR", player, SchematicSystem.MESSAGE.parse(node.replaceColor() ? "ON" : "OFF", player)); 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_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"); SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_FORMAT", player, node.getSchemFormat() ? ".schem" : ".schematic");
CheckedSchematic.getLastDeclinedOfNode(node).stream().findFirst().ifPresent(checkedSchematic -> CheckedSchematic.getLastDeclinedOfNode(node).stream().findFirst().ifPresent(checkedSchematic -> SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_STATUS", player, checkedSchematic.getEndTime(), checkedSchematic.getDeclineReason()));
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_STATUS", player, checkedSchematic.getStartTime(), checkedSchematic.getDeclineReason())); } else {
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_TYPE", player, SchematicSystem.MESSAGE.parse("UTIL_INFO_TYPE_DIR", player));
} }
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<>(); List<String> schematicMembers = new ArrayList<>();
NodeMember.getNodeMembers(node.getId()).forEach(nodeMember -> schematicMembers.add(SteamwarUser.get(nodeMember.getMember()).getUserName())); NodeMember.getNodeMembers(node.getId()).forEach(nodeMember -> schematicMembers.add(SteamwarUser.get(nodeMember.getMember()).getUserName()));
if (!schematicMembers.isEmpty()) { SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_MEMBER", player, schematicMembers.stream().reduce((s, s2) -> s + ", " + s2).orElse(""));
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_MEMBER", player, schematicMembers);
} }
TextComponent base = new TextComponent(); 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.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))); download.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem download " + node.generateBreadcrumbs(user)));
base.addExtra(download); 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); TextComponent delete = SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_ACTION_DELETE", false, player);
delete.setColor(ChatColor.DARK_RED); 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.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); base.addExtra(delete);
if (!base.getExtra().isEmpty()) { if (!base.getExtra().isEmpty()) {