When choosing adapters, allow ones that aren't best, but prioritize best.

This commit is contained in:
Me4502 2017-01-15 17:23:45 +10:00
parent 9f24f84c2b
commit 04d4e89541

View File

@ -21,7 +21,6 @@ package com.sk89q.worldedit.sponge.adapter;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.sk89q.worldedit.util.io.Closer; import com.sk89q.worldedit.util.io.Closer;
import org.spongepowered.api.Sponge;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -180,7 +179,14 @@ public class SpongeImplLoader {
if (suitableAdapters.size() == 1) { if (suitableAdapters.size() == 1) {
return suitableAdapters.get(0); return suitableAdapters.get(0);
} else { } 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));
} }
} }
} }