13
0

NodeMember: SchematicSystem #137

Zusammengeführt
Chaoscaot hat 4 Commits von nodemember nach master 2023-01-17 18:14:10 +01:00 zusammengeführt
2 geänderte Dateien mit 6 neuen und 6 gelöschten Zeilen
Nur Änderungen aus Commit a2ccc6ce43 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -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());
}
}

Datei anzeigen

@ -318,16 +318,16 @@ public class SchematicCommandUtils {
Optional<SchematicNode> currentNode = Optional.empty();
for (int i = 0; i < layers.length - minus; i++) {
int finalI = i;
List<SchematicNode> nodes = SchematicNode.list(user, currentNode.map(SchematicNode::getId).orElse(0)).stream()
List<SchematicNode> 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()));
}
}
}