diff --git a/common/src/main/java/cn/evole/mods/mcbot/common/command/ConnectCommand.java b/common/src/main/java/cn/evole/mods/mcbot/common/command/ConnectCommand.java index 8f1a62d..83d1109 100644 --- a/common/src/main/java/cn/evole/mods/mcbot/common/command/ConnectCommand.java +++ b/common/src/main/java/cn/evole/mods/mcbot/common/command/ConnectCommand.java @@ -18,11 +18,12 @@ public class ConnectCommand { private static final Pattern ipv4Pattern = Pattern.compile("(\\d+\\.\\d+\\.\\d+\\.\\d+):(\\d+)"); private static final Pattern ipv6Pattern = Pattern.compile("\\[([0-9a-fA-F:]+)]:(\\d+)"); + private static final Pattern domainPattern = Pattern.compile("([a-zA-Z0-9.-]+):(\\d+)"); public static int execute(CommandContext context) throws CommandSyntaxException { val parameter = context.getArgument("parameter", String.class); - if (ipv4Pattern.matcher(parameter).find() || ipv6Pattern.matcher(parameter).find()) { + if (ipv4Pattern.matcher(parameter).find() || ipv6Pattern.matcher(parameter).find()|| domainPattern.matcher(parameter).find()) { ModConfig.get().getBotConfig().getUrl().setValueFromString(String.format("ws://%s", parameter)); doConnect(context); return 1;