Added ServerCompatibility.ServerVersion#getVersions(Compatibility...)

This commit is contained in:
Florian CUNY 2019-06-09 08:49:37 +02:00
parent 44e7004db1
commit d91222d30b

View File

@ -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<ServerVersion> getVersions(@NonNull Compatibility... compatibility) {
List<ServerVersion> versions = new LinkedList<>();
for (ServerVersion version : values()) {
if (Arrays.asList(compatibility).contains(version.getCompatibility())) {
versions.add(version);
}
}
return versions;
}
}
/**