Added VersionEnum#fromProtocolName

This commit is contained in:
FlorianMichael 2023-11-24 17:34:00 +01:00
parent 50c7f623a6
commit 9e90d1f098
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126

View File

@ -220,6 +220,12 @@ public enum VersionEnum {
return fromProtocolVersion(ProtocolVersion.getProtocol(protocolId));
}
public static VersionEnum fromProtocolName(final String protocolName) {
final ProtocolVersion protocolVersion = ProtocolVersion.getClosest(protocolName);
if (protocolVersion == null) return UNKNOWN;
return fromProtocolVersion(protocolVersion);
}
public static VersionEnum fromUserConnection(final UserConnection userConnection) {
return fromUserConnection(userConnection, true);
}