Skip to content

Commit 348b041

Browse files
committed
Fix paper adapter lookup
1 parent d871e0e commit 348b041

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

paper/all/src/main/java/org/geysermc/geyser/adapters/paper/PaperAdapters.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ public static void registerClosestWorldAdapter(int version) throws Exception {
4343
}
4444

4545
int closest = Arrays.stream(protocols)
46-
.reduce((a, b) -> Math.abs(a - version) < Math.abs(b - version) ? a : b)
47-
.orElse(protocols[0]);
46+
.filter(v -> v <= version)
47+
.max()
48+
.orElseThrow(() -> new IllegalArgumentException("No compatible protocol found for " + version + "!"));
4849

4950
registerWorldAdapter(closest);
5051
}

0 commit comments

Comments
 (0)