From cd401a389e01e61eedefdd160b93e1f0efa249ef Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 16 Apr 2022 10:39:45 +0200 Subject: [PATCH] member parent --- .../commands/SchematicCommand.java | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java index c3acd21..c06a4c7 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java @@ -432,7 +432,8 @@ public class SchematicCommand extends SWCommand { @Register("move") public void move(Player player, SchematicNode node, @Mapper("dirStringMapper") String name) { SteamwarUser user = getUser(player); - if (node.getOwner() != user.getId()) { + NodeMember member = NodeMember.getNodeMember(node.getId(), user.getId()); + if (node.getOwner() != user.getId() && member == null) { player.sendMessage(SchematicSystem.PREFIX + "§cDu kannst nur deine eigenen Schems verschieben."); return; } @@ -445,14 +446,18 @@ public class SchematicCommand extends SWCommand { String[] layers = name.split("/"); if (invalidSchemName(player, layers)) return; SchematicNode newNode = mkdirs(layers, user, 0); - if(SchematicNode.getAllParentsOfNode(newNode).contains(node)) { - player.sendMessage(SchematicSystem.PREFIX + "§cDas gibt nur Fehler, vertrau mir."); - return; - } - SafeSchematicNode.Result result = SafeSchematicNode.setParent(user, node, newNode); - if(!result.isSuccessful()) { - result.sendError(player); - return; + if(node.getOwner() == user.getId()) { + if(SchematicNode.getAllParentsOfNode(newNode).contains(node)) { + player.sendMessage(SchematicSystem.PREFIX + "§cDas gibt nur Fehler, vertrau mir."); + return; + } + SafeSchematicNode.Result result = SafeSchematicNode.setParent(user, node, newNode); + if(!result.isSuccessful()) { + result.sendError(player); + return; + } + } else { + member.setParentNode(newNode == null ? null : node.getId()); } } player.sendMessage(SchematicSystem.PREFIX + "§7Die Schematic ist nun unter §e" + node.generateBreadcrumbs(user) + " §7zu finden");