From d91222d30b14a4fc94cab176fe114f4777af2c9d Mon Sep 17 00:00:00 2001 From: Florian CUNY Date: Sun, 9 Jun 2019 08:49:37 +0200 Subject: [PATCH] Added ServerCompatibility.ServerVersion#getVersions(Compatibility...) --- .../bentobox/versions/ServerCompatibility.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/world/bentobox/bentobox/versions/ServerCompatibility.java b/src/main/java/world/bentobox/bentobox/versions/ServerCompatibility.java index 010564112..1eac21784 100644 --- a/src/main/java/world/bentobox/bentobox/versions/ServerCompatibility.java +++ b/src/main/java/world/bentobox/bentobox/versions/ServerCompatibility.java @@ -5,6 +5,8 @@ import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; /** * Checks and ensures the current server software is compatible with BentoBox. @@ -122,6 +124,20 @@ public class ServerCompatibility { public String toString() { return super.toString().substring(1).replace("_", "."); } + + /** + * @since 1.5.0 + */ + @NonNull + public static List getVersions(@NonNull Compatibility... compatibility) { + List versions = new LinkedList<>(); + for (ServerVersion version : values()) { + if (Arrays.asList(compatibility).contains(version.getCompatibility())) { + versions.add(version); + } + } + return versions; + } } /**