13
0

member parent
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

Dieser Commit ist enthalten in:
Chaoscaot 2022-04-16 10:39:45 +02:00
Ursprung 73cca7675c
Commit cd401a389e

Datei anzeigen

@ -432,7 +432,8 @@ public class SchematicCommand extends SWCommand {
@Register("move") @Register("move")
public void move(Player player, SchematicNode node, @Mapper("dirStringMapper") String name) { public void move(Player player, SchematicNode node, @Mapper("dirStringMapper") String name) {
SteamwarUser user = getUser(player); 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."); player.sendMessage(SchematicSystem.PREFIX + "§cDu kannst nur deine eigenen Schems verschieben.");
return; return;
} }
@ -445,14 +446,18 @@ public class SchematicCommand extends SWCommand {
String[] layers = name.split("/"); String[] layers = name.split("/");
if (invalidSchemName(player, layers)) return; if (invalidSchemName(player, layers)) return;
SchematicNode newNode = mkdirs(layers, user, 0); SchematicNode newNode = mkdirs(layers, user, 0);
if(SchematicNode.getAllParentsOfNode(newNode).contains(node)) { if(node.getOwner() == user.getId()) {
player.sendMessage(SchematicSystem.PREFIX + "§cDas gibt nur Fehler, vertrau mir."); if(SchematicNode.getAllParentsOfNode(newNode).contains(node)) {
return; player.sendMessage(SchematicSystem.PREFIX + "§cDas gibt nur Fehler, vertrau mir.");
} return;
SafeSchematicNode.Result result = SafeSchematicNode.setParent(user, node, newNode); }
if(!result.isSuccessful()) { SafeSchematicNode.Result result = SafeSchematicNode.setParent(user, node, newNode);
result.sendError(player); if(!result.isSuccessful()) {
return; 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"); player.sendMessage(SchematicSystem.PREFIX + "§7Die Schematic ist nun unter §e" + node.generateBreadcrumbs(user) + " §7zu finden");