From 666b491df2afa16e1075516a99e1db9e892bbe3c Mon Sep 17 00:00:00 2001 From: IThundxr Date: Tue, 15 Oct 2024 17:01:54 -0400 Subject: [PATCH] remove some extra stuff into the computeIfAbsent --- .../schematics/ServerSchematicLoader.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/schematics/ServerSchematicLoader.java b/src/main/java/com/simibubi/create/content/schematics/ServerSchematicLoader.java index 089243aa0..2c732131f 100644 --- a/src/main/java/com/simibubi/create/content/schematics/ServerSchematicLoader.java +++ b/src/main/java/com/simibubi/create/content/schematics/ServerSchematicLoader.java @@ -82,15 +82,18 @@ public class ServerSchematicLoader { (filePath, attributes) -> filePath.toString().endsWith(".nbt"))) { for (Path path : filePaths.toList()) { try (InputStream stream = new FileInputStream(path.toFile())) { - String[] pathSplit = path.toString() - .replace("schematics/uploaded/", "") - .replace(".nbt", "") - .split("/"); - String playerName = pathSplit[0]; - String schematicName = pathSplit[1]; String schematicMd5Hex = DigestUtils.md5Hex(stream); - sumToSchematic.computeIfAbsent(schematicMd5Hex, k -> new SchematicFile(playerName, schematicName)); + sumToSchematic.computeIfAbsent(schematicMd5Hex, k -> { + String[] pathSplit = path.toString() + .replace("schematics/uploaded/", "") + .replace(".nbt", "") + .split("/"); + String playerName = pathSplit[0]; + String schematicName = pathSplit[1]; + + return new SchematicFile(playerName, schematicName); + }); } } } catch (IOException ignored) {}