From 48a10b0b9b76f2925cef94fe250e22c48dc59f1f Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 27 Dec 2021 02:25:16 +0100 Subject: [PATCH] Fixing PR(TM) Stuff Signed-off-by: Chaoscaot --- .../commands/SchematicCommand.java | 27 ++++++------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java index 3f6d7ee..ae6db12 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java @@ -235,8 +235,11 @@ public class SchematicCommand extends SWCommand { } } - if(!added.isEmpty()) { - player.sendMessage(SchematicSystem.PREFIX + (added.size()>1?"Die":"Der") + " Spieler §e" + added.stream().map(SteamwarUser::getUserName).reduce((s, s2) -> s + ", " + s2).get() + " §7" + (added.size()>1?"haben":"hat") + " nun Zugriff auf die Schematic §e" + node.generateBreadcrumbs(user)); + Optional reduced = added.stream().map(SteamwarUser::getUserName).reduce((s, s2) -> s + ", " + s2); + if (reduced.isPresent()) { + player.sendMessage(SchematicSystem.PREFIX + "§7" + (added.size()>1?"Die":"Der") + " Spieler §e" + reduced.get() + " §7" + (added.size()>1?"wurden":"wurde") + " auf die Schematic hinzugefügt"); + } else { + player.sendMessage(SchematicSystem.PREFIX + "§cEs wurde kein Spieler hinzugefügt"); } } @@ -343,7 +346,7 @@ public class SchematicCommand extends SWCommand { public void move(Player player, SchematicNode node, @Mapper("dirStringMapper") String name) { SteamwarUser user = getUser(player); if (node.getOwner() != user.getId()) { - player.sendMessage(SchematicSystem.PREFIX + "§cDas kannst du nur bei deinen eigenen Schems machen"); + player.sendMessage(SchematicSystem.PREFIX + "§cDu kannst nur deine eigenen Schems verschieben."); return; } @@ -356,7 +359,7 @@ public class SchematicCommand extends SWCommand { if (invalidSchemName(player, layers)) return; SchematicNode newNode = mkdirs(layers, user, 0); if(SchematicNode.getAllParentsOfNode(newNode).contains(node)) { - player.sendMessage(SchematicSystem.PREFIX + "§cDas kann nur Fehler machen, vertrau mir!"); + player.sendMessage(SchematicSystem.PREFIX + "§cDas gibt nur Fehler, vertrau mir."); return; } node.setParent(newNode.getId()); @@ -391,21 +394,7 @@ public class SchematicCommand extends SWCommand { return; } - List added = new ArrayList<>(); - for (Integer member : team.getMembers()) { - if (user.getId() == member) continue; - if (NodeMember.getNodeMember(node.getId(), member) == null) { - NodeMember.createNodeMember(node.getId(), member); - added.add(SteamwarUser.get(member).getUserName()); - } - } - - Optional reduced = added.stream().reduce((s, s2) -> s + ", " + s2); - if (reduced.isPresent()) { - player.sendMessage(SchematicSystem.PREFIX + "§7Die Spieler §e" + reduced.get() + " §7wurden auf die Schematic hinzugefügt"); - } else { - player.sendMessage(SchematicSystem.PREFIX + "§7Es wurde kein Spieler hinzugefügt"); - } + addMember(player, node, team.getMembers().stream().map(SteamwarUser::get).toArray(SteamwarUser[]::new)); } @Register("delteam")