diff --git a/BauSystem_Main/src/de/steamwar/bausystem/linkage/LinkageUtils.java b/BauSystem_Main/src/de/steamwar/bausystem/linkage/LinkageUtils.java index 03b0ffc0..429d96cc 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/linkage/LinkageUtils.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/linkage/LinkageUtils.java @@ -31,6 +31,7 @@ import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.util.*; import java.util.logging.Level; +import java.util.stream.Collectors; @UtilityClass public class LinkageUtils { @@ -90,18 +91,7 @@ public class LinkageUtils { return; } - List linkageTypeList = new ArrayList<>(); - for (Linked linked : linkages) { - if (linked == null) { - continue; - } - LinkageType linkageType = linked.value(); - if (linkageType.getLinkagePredicate().test(clazz)) { - linkageTypeList.add(linked.value()); - } - } - - linkageTypeList.removeIf(linkageType -> linkageType.isUnlink() != unlink); + List linkageTypeList = Arrays.stream(linkages).filter(Objects::nonNull).map(Linked::value).filter(linkageType -> linkageType.getLinkagePredicate().test(clazz)).filter(linkageType -> linkageType.isUnlink() == unlink).collect(Collectors.toList()); if (linkageTypeList.isEmpty()) { return; } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/region/loader/RegionLoader.java b/BauSystem_Main/src/de/steamwar/bausystem/region/loader/RegionLoader.java index 2cce1ef0..ecd13afc 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/region/loader/RegionLoader.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/region/loader/RegionLoader.java @@ -27,7 +27,6 @@ import lombok.experimental.UtilityClass; import org.bukkit.Bukkit; import yapion.hierarchy.diff.DiffBase; import yapion.hierarchy.diff.YAPIONDiff; -import yapion.hierarchy.output.FileOutput; import yapion.hierarchy.types.YAPIONObject; import yapion.hierarchy.types.YAPIONType; import yapion.parser.YAPIONParser;