From 74fbf965ac6a9975fd5e6dda745f293737447d59 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 3 Jul 2022 08:38:30 +0200 Subject: [PATCH] Update to new Systems --- .../src/SchematicSystem.properties | 8 +--- .../src/SchematicSystem_de.properties | 8 +--- .../commands/SchematicCommandUtils.java | 45 +++++++++---------- 3 files changed, 25 insertions(+), 36 deletions(-) diff --git a/SchematicSystem_Core/src/SchematicSystem.properties b/SchematicSystem_Core/src/SchematicSystem.properties index f3a2f19..49c2522 100644 --- a/SchematicSystem_Core/src/SchematicSystem.properties +++ b/SchematicSystem_Core/src/SchematicSystem.properties @@ -40,19 +40,15 @@ UTIL_INFO_REPLAY=§7Replay playback: {0} UTIL_INFO_FORMAT=§7Format: §e{0} UTIL_INFO_STATUS=§cState: §c{0}: {1} UTIL_INFO_MEMBER=§7Members: §e{0} +UTIL_INFO_MEMBER_STRING=Members: UTIL_INFO_ACTION_LOAD=[Load] UTIL_INFO_ACTION_LOAD_HOVER=§eLoad schematic UTIL_INFO_ACTION_DOWNLOAD=[Download] UTIL_INFO_ACTION_DOWNLOAD_HOVER=§eDownload schematic -UTIL_INFO_ACTION_TYPE=[Change type] UTIL_INFO_ACTION_TYPE_HOVER=§eChange schematic type -UTIL_INFO_ACTION_ADD=[Add] UTIL_INFO_ACTION_ADD_HOVER=§eAdd member -UTIL_INFO_ACTION_REMOVE=[Remove] -UTIL_INFO_ACTION_REMOVE_HOVER=§eRemove member -UTIL_INFO_ACTION_MOVE=[Move] +UTIL_INFO_ACTION_REMOVE_HOVER=§eRemove {0} UTIL_INFO_ACTION_MOVE_HOVER=§eMove schematic -UTIL_INFO_ACTION_RENAME=[Rename] UTIL_INFO_ACTION_RENAME_HOVER=§eRename schematic UTIL_INFO_ACTION_DELETE=[Delete] UTIL_INFO_ACTION_DELETE_HOVER=§eDelete schematic diff --git a/SchematicSystem_Core/src/SchematicSystem_de.properties b/SchematicSystem_Core/src/SchematicSystem_de.properties index a9d085d..66d972e 100644 --- a/SchematicSystem_Core/src/SchematicSystem_de.properties +++ b/SchematicSystem_Core/src/SchematicSystem_de.properties @@ -29,18 +29,14 @@ UTIL_INFO_COLOR=§7Farbersetzung: {0} UTIL_INFO_REPLAY=§7Replaywiedergabe: {0} UTIL_INFO_STATUS=§cStatus: §c{0}: {1} UTIL_INFO_MEMBER=§7Mitglieder: §e{0} +UTIL_INFO_MEMBER_STRING=Mitglieder: UTIL_INFO_ACTION_LOAD=[Laden] UTIL_INFO_ACTION_LOAD_HOVER=§eSchematic laden UTIL_INFO_ACTION_DOWNLOAD_HOVER=§eSchematic downloaden -UTIL_INFO_ACTION_TYPE=[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_REMOVE=[Entfernen] -UTIL_INFO_ACTION_REMOVE_HOVER=§eMember entfernen -UTIL_INFO_ACTION_MOVE=[Verschieben] +UTIL_INFO_ACTION_REMOVE_HOVER=§e{0} entfernen UTIL_INFO_ACTION_MOVE_HOVER=§eSchematic verschieben -UTIL_INFO_ACTION_RENAME=[Umbenennen] UTIL_INFO_ACTION_RENAME_HOVER=§eSchematic umbenennen UTIL_INFO_ACTION_DELETE=[Löschen] UTIL_INFO_ACTION_DELETE_HOVER=§eSchematic löschen diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java index 88c586c..25a9a64 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java @@ -179,42 +179,39 @@ public class SchematicCommandUtils { public static void printSchemInfo(Player player, SchematicNode node) { SteamwarUser user = getUser(player); - player.sendMessage("§7Schematic: §e" + node.generateBreadcrumbs(user)); + SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_SCHEM", player, node.generateBreadcrumbs(user)); if(node.getOwner() == user.getId()) { player.spigot().sendMessage( - new ComponentBuilder("Name: ").color(ChatColor.GRAY) - .append(node.getName()).color(ChatColor.YELLOW) - .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§e" + (node.isDir() ? "Ordner" : "Schematic") + " umbenennen"))) - .event(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/schem rename " + node.generateBreadcrumbs(user) + " [Neuer Name]")) + 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 { - player.sendMessage("Name: " + node.getName()); + SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_NAME", player, node.getName()); } - player.sendMessage("§7Besitzer: §e" + SteamwarUser.get(node.getOwner()).getUserName()); + 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("Ordner: ").color(ChatColor.GRAY) - .append(node.getParent() == null || node.getParent() == 0 ? "/" : node.getParentNode().generateBreadcrumbs(user)) - .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§e" + (node.isDir() ? "Ordner" : "Schematic") + " verschieben"))) + 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 { - player.sendMessage("§7Ordner: §e" + (node.getParent() == null ? "/" : node.getParentNode().generateBreadcrumbs(user))); + SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_PARENT", player, node.getParent() == null ? "/" : node.getParentNode().generateBreadcrumbs(user)); } - player.sendMessage("§7Letzes Update: §e" + node.getLastUpdate().toLocalDateTime().format(DateTimeFormatter.ofPattern("HH:mm dd.MM.yyyy", Locale.GERMAN))); + SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_UPDATED", player, node.getLastUpdate()); if (!node.isDir()) { if(node.getOwner() == user.getId()) { player.spigot().sendMessage( - new ComponentBuilder("Typ: ").color(ChatColor.GRAY) - .append(node.getSchemtype().name()).color(ChatColor.YELLOW) - .event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§eSchematic Typ ändern"))) + 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 { - player.sendMessage("§7Typ: §e" + node.getSchemtype().name()); + SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_TYPE", player, node.getSchemtype().name()); } if (node.getRank() > 0) { SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_RANK", player, node.getRank()); @@ -225,32 +222,32 @@ public class SchematicCommandUtils { SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_REPLAY", player, SchematicSystem.MESSAGE.parse(node.allowReplay() ? "ON" : "OFF", player)); } - player.sendMessage("§7Format: §e" + (node.getSchemFormat() ? ".schem" : ".schematic")); - CheckedSchematic.getLastDeclinedOfNode(node).stream().findFirst().ifPresent(checkedSchematic -> player.sendMessage("§cStatus: §c" + checkedSchematic.getStartTime() + " : " + checkedSchematic.getDeclineReason())); + 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.getEndTime(), checkedSchematic.getDeclineReason())); } else { - player.sendMessage("§7Typ: §7DIR"); + SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_TYPE", player, SchematicSystem.MESSAGE.parse("UTIL_INFO_TYPE_DIR", player)); } if(node.getOwner() == user.getId()) { - ComponentBuilder memberBuilder = new ComponentBuilder("Mitglieder: ").color(ChatColor.GRAY); + 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, TextComponent.fromLegacyText("§e" + member.getUserName() + " entfernen"))) + .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, TextComponent.fromLegacyText("§eMember hinzufügen"))) + .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 schematicMembers = new ArrayList<>(); NodeMember.getNodeMembers(node.getId()).forEach(nodeMember -> schematicMembers.add(SteamwarUser.get(nodeMember.getMember()).getUserName())); - player.sendMessage("§7Mitglieder: §e" + schematicMembers); + SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_MEMBER", player, schematicMembers); } TextComponent base = new TextComponent(); @@ -274,7 +271,7 @@ public class SchematicCommandUtils { 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()) {