From 04de43ed4de5805b97b57a51e844911fecd27ca8 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 11 Dec 2021 13:04:05 +0100 Subject: [PATCH] Improve Performance Signed-off-by: Chaoscaot --- SpigotCore_Main/src/de/steamwar/sql/SchematicNode.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/SpigotCore_Main/src/de/steamwar/sql/SchematicNode.java b/SpigotCore_Main/src/de/steamwar/sql/SchematicNode.java index e67cdd5..d888e5e 100644 --- a/SpigotCore_Main/src/de/steamwar/sql/SchematicNode.java +++ b/SpigotCore_Main/src/de/steamwar/sql/SchematicNode.java @@ -34,6 +34,7 @@ import java.sql.SQLException; import java.sql.Timestamp; import java.time.Instant; import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Predicate; import java.util.zip.GZIPInputStream; @@ -488,8 +489,12 @@ public class SchematicNode { StringBuilder builder = new StringBuilder(getName()); SchematicNode currentNode = this; if (currentNode.isDir()) builder.append("/"); - while (currentNode.getParentNode() != null && !currentNode.getMembers().stream().anyMatch(member -> member.getMember() == user.getId())) { + final Set nodeMembers = NodeMember.getSchematics(user.getId()); + AtomicInteger i = new AtomicInteger(); + i.set(currentNode.getId()); + while (currentNode.getParentNode() != null && nodeMembers.stream().noneMatch(nodeMember -> nodeMember.getNode() == i.get())) { currentNode = currentNode.getParentNode(); + i.set(currentNode.getId()); builder.insert(0, split) .insert(0, currentNode.getName()); }