Skip to content

Commit

Permalink
Added short form for Auto Detect protocol name
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphiMC committed Jan 12, 2025
1 parent e160438 commit 63b2c67
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@
package net.raphimc.viaproxy.util;

import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import net.raphimc.viaproxy.protocoltranslator.ProtocolTranslator;

public class ProtocolVersionUtil {

public static ProtocolVersion fromNameLenient(final String name) {
if (name.equalsIgnoreCase("auto")) { // Short form for auto-detect
return ProtocolTranslator.AUTO_DETECT_PROTOCOL;
}

final ProtocolVersion version = ProtocolVersion.getClosest(name);
if (version == null) {
return ProtocolVersion.getClosest(name.replace("-", " "));
Expand Down

0 comments on commit 63b2c67

Please sign in to comment.