From a2ccc6ce4340dcdb2e69f6be5ea961bbb03935d8 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 16 Jan 2023 16:52:32 +0100 Subject: [PATCH] NodeMember: Move Member Schematics --- .../steamwar/schematicsystem/commands/SchematicCommand.java | 6 +++--- .../schematicsystem/commands/SchematicCommandUtils.java | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java index 21f9e6e..2199788 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java @@ -99,7 +99,7 @@ public class SchematicCommand extends SWCommand { @Register("list") @Register({"list", "/"}) public void schemList(Player player, @OptionalValue(value = "1", onlyUINIG = true) int page) { - createCachedSchemList(player, SchematicNode.list(getUser(player), 0), Math.max(page - 1, 0), null, SchematicListBehavior.DEFAULT); + createCachedSchemList(player, SchematicNode.list(getUser(player), null), Math.max(page - 1, 0), null, SchematicListBehavior.DEFAULT); } @Register({"list", "public"}) @@ -110,7 +110,7 @@ public class SchematicCommand extends SWCommand { @Register({"list", "public"}) @Register({"list", "public", "/"}) public void schemListPublic(Player player, @OptionalValue(value = "1", onlyUINIG = true) int page) { - createCachedSchemList(player, SchematicNode.list(SteamwarUser.get(0), 0), Math.max(page - 1, 0), null, SchematicListBehavior.builder().setPublics(true).setPageCommandGen(integer -> "/schem list public " + integer).build()); + createCachedSchemList(player, SchematicNode.list(SteamwarUser.get(0), null), Math.max(page - 1, 0), null, SchematicListBehavior.builder().setPublics(true).setPageCommandGen(integer -> "/schem list public " + integer).build()); } @Register("list") @@ -272,7 +272,7 @@ public class SchematicCommand extends SWCommand { if(SchematicNode.getSchematicNode(schematicNode.getName(), newNode == null ? 0 : newNode.getId()) != null) { schematicNode.setName(schematicNode.getName() + "-" + Instant.now().getEpochSecond() % 1000); } - schematicNode.setParent(newNode == null ? 0 : newNode.getId()); + schematicNode.setParent(newNode == null ? null : newNode.getId()); } } diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java index 7fde1f6..340a828 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java @@ -318,16 +318,16 @@ public class SchematicCommandUtils { Optional currentNode = Optional.empty(); for (int i = 0; i < layers.length - minus; i++) { int finalI = i; - List nodes = SchematicNode.list(user, currentNode.map(SchematicNode::getId).orElse(0)).stream() + List nodes = SchematicNode.list(user, currentNode.map(SchematicNode::getId).orElse(null)).stream() .filter(node -> node.getName().equalsIgnoreCase(layers[finalI])) .collect(Collectors.toList()); if (nodes.isEmpty()) { - currentNode = Optional.ofNullable(SchematicNode.byIdAndUser(user, SchematicNode.createSchematicDirectory(user.getId(), layers[i], currentNode.map(SchematicNode::getId).orElse(0)).getId())); + currentNode = Optional.ofNullable(SchematicNode.byIdAndUser(user, SchematicNode.createSchematicDirectory(user.getId(), layers[i], currentNode.map(SchematicNode::getId).orElse(null)).getId())); } else { if(nodes.stream().anyMatch(SchematicNode::isDir)) { currentNode = nodes.stream().filter(SchematicNode::isDir).findFirst(); } else { - currentNode = Optional.ofNullable(SchematicNode.byIdAndUser(user, SchematicNode.createSchematicDirectory(user.getId(), layers[i] + "-dir-" + System.currentTimeMillis() % 100, currentNode.map(SchematicNode::getId).orElse(0)).getId())); + currentNode = Optional.ofNullable(SchematicNode.byIdAndUser(user, SchematicNode.createSchematicDirectory(user.getId(), layers[i] + "-dir-" + System.currentTimeMillis() % 100, currentNode.map(SchematicNode::getId).orElse(null)).getId())); } } }