From 04d4e89541a506116c59dc7ffce94fb90a72ad26 Mon Sep 17 00:00:00 2001 From: Me4502 Date: Sun, 15 Jan 2017 17:23:45 +1000 Subject: [PATCH] When choosing adapters, allow ones that aren't best, but prioritize best. --- .../worldedit/sponge/adapter/SpongeImplLoader.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplLoader.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplLoader.java index 2985175cf..17c9800ce 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplLoader.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplLoader.java @@ -21,7 +21,6 @@ package com.sk89q.worldedit.sponge.adapter; import com.google.common.collect.Lists; import com.sk89q.worldedit.util.io.Closer; -import org.spongepowered.api.Sponge; import java.io.File; import java.io.IOException; @@ -180,7 +179,14 @@ public class SpongeImplLoader { if (suitableAdapters.size() == 1) { return suitableAdapters.get(0); } else { - return suitableAdapters.stream().filter(SpongeImplAdapter::isBest).findFirst().orElse(suitableAdapters.get(0)); + return suitableAdapters.stream().sorted((o1, o2) -> { + if (o1.isBest() && !o2.isBest()) { + return -1; + } else if (!o1.isBest() && o2.isBest()) { + return 1; + } + return 0; + }).findFirst().orElse(suitableAdapters.get(0)); } } }