SteamWar/SpigotCore
Archiviert
13
0

Improve Performance
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
Chaoscaot 2021-12-11 13:04:05 +01:00
Ursprung 72708d7183
Commit 04de43ed4d

Datei anzeigen

@ -34,6 +34,7 @@ import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.time.Instant; import java.time.Instant;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.zip.GZIPInputStream; import java.util.zip.GZIPInputStream;
@ -488,8 +489,12 @@ public class SchematicNode {
StringBuilder builder = new StringBuilder(getName()); StringBuilder builder = new StringBuilder(getName());
SchematicNode currentNode = this; SchematicNode currentNode = this;
if (currentNode.isDir()) builder.append("/"); if (currentNode.isDir()) builder.append("/");
while (currentNode.getParentNode() != null && !currentNode.getMembers().stream().anyMatch(member -> member.getMember() == user.getId())) { final Set<NodeMember> 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(); currentNode = currentNode.getParentNode();
i.set(currentNode.getId());
builder.insert(0, split) builder.insert(0, split)
.insert(0, currentNode.getName()); .insert(0, currentNode.getName());
} }