13
0

Schematic Info Rework #122

Zusammengeführt
Chaoscaot hat 6 Commits von schem_info_rework nach master 2022-07-03 12:46:46 +02:00 zusammengeführt
Nur Änderungen aus Commit 744dccb326 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -185,13 +185,43 @@ public class SchematicCommandUtils {
public static void printSchemInfo(Player player, SchematicNode node) {
SteamwarUser user = getUser(player);
player.sendMessage("§7Schematic: §e" + node.getName());
player.sendMessage("§7Name: §e" + node.generateBreadcrumbs(user));
player.sendMessage("§7Schematic: §e" + 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]"))
.create()
);
} else {
player.sendMessage("Name: " + node.getName());
}
player.sendMessage("§7Besitzer: §e" + SteamwarUser.get(node.getOwner()).getUserName());
player.sendMessage("§7Ordner: §e" + (node.getParent() == null || node.getParent() == 0 ? "/" : node.getParentNode().generateBreadcrumbs(user)));
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")))
.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)));
}
player.sendMessage("§7Letzes Update: §e" + node.getLastUpdate().toLocalDateTime().format(DateTimeFormatter.ofPattern("HH:mm dd.MM.yyyy", Locale.GERMAN)));
player.sendMessage("§7Typ: §e" + (node.isDir() ? "§7DIR" : node.getSchemtype().name()));
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")))
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem changetype " + node.generateBreadcrumbs(user)))
.create()
);
} else {
player.sendMessage("§7Typ: §e" + node.getSchemtype().name());
}
if (node.getRank() > 0) {
player.sendMessage("§7Rang: §e" + node.getRank());
}
@ -203,10 +233,29 @@ public class SchematicCommandUtils {
player.sendMessage("§7Format: §e" + (node.getSchemFormat() ? ".schem" : ".schematic"));
CheckedSchematic.getLastDeclinedOfNode(node).stream().findFirst().ifPresent(checkedSchematic -> player.sendMessage("§cStatus: §c" + checkedSchematic.getStartTime() + " : " + checkedSchematic.getDeclineReason()));
} else {
player.sendMessage("§7Typ: §7DIR");
}
List<String> schematicMembers = new ArrayList<>();
NodeMember.getNodeMembers(node.getId()).forEach(nodeMember -> schematicMembers.add(SteamwarUser.get(nodeMember.getMember()).getUserName()));
if (!schematicMembers.isEmpty()) {
if(node.getOwner() == user.getId()) {
ComponentBuilder memberBuilder = new ComponentBuilder("Mitglieder: ").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")))
.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 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()));
player.sendMessage("§7Mitglieder: §e" + schematicMembers);
}
@ -225,41 +274,9 @@ public class SchematicCommandUtils {
download.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§eSchematic downloaden")));
download.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem download " + node.generateBreadcrumbs(user)));
base.addExtra(download);
TextComponent changeTyp = new TextComponent("[Typ ändern] ");
changeTyp.setColor(ChatColor.BLUE);
changeTyp.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§eSchematic Typ ändern")));
changeTyp.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem changetype " + node.generateBreadcrumbs(user)));
base.addExtra(changeTyp);
}
}
if (node.getOwner() == user.getId()) {
TextComponent addMember = new TextComponent("[Hinzufügen] ");
addMember.setColor(ChatColor.AQUA);
addMember.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§eMember hinzufügen")));
addMember.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/schem addmember " + node.generateBreadcrumbs(user) + " "));
base.addExtra(addMember);
TextComponent delMember = new TextComponent("[Entfernen] ");
delMember.setColor(ChatColor.RED);
delMember.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§eMember entfernen")));
delMember.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/schem delmember " + node.generateBreadcrumbs(user) + " "));
base.addExtra(delMember);
TextComponent move = new TextComponent("[Verschieben] ");
move.setColor(ChatColor.DARK_PURPLE);
move.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§e" + (node.isDir() ? "Ordner" : "Schematic") + " verschieben")));
move.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/schem move " + node.generateBreadcrumbs(user) + " " + node.generateBreadcrumbs(user).replace("/" + node.getName(), "")));
base.addExtra(move);
TextComponent rename = new TextComponent("[Umbenennen] ");
rename.setColor(ChatColor.LIGHT_PURPLE);
rename.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§e" + (node.isDir() ? "Ordner" : "Schematic") + " umbenennen")));
rename.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/schem rename " + node.generateBreadcrumbs(user) + " [Neuer Name]"));
base.addExtra(rename);
}
TextComponent delete = new TextComponent("[" + (node.getOwner() == user.getId() ? "Löschen" : "Entfernen") + "] ");
delete.setColor(ChatColor.DARK_RED);
delete.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§e" + (node.isDir() ? "Ordner" : "Schematic") + " Löschen")));