fix invalid urls in chat
This commit is contained in:
parent
342957ef68
commit
42585c97cf
|
|
@ -4,7 +4,6 @@ import com.alttd.chat.ChatAPI;
|
|||
import com.alttd.chat.config.Config;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import net.luckperms.api.LuckPerms;
|
||||
|
|
@ -20,7 +19,6 @@ import java.util.stream.Collectors;
|
|||
public class Utility {
|
||||
|
||||
static final Pattern DEFAULT_URL_PATTERN = Pattern.compile("(?:(https?)://)?([-\\w_.]+\\.\\w{2,})(/\\S*)?");
|
||||
static final Pattern URL_SCHEME_PATTERN = Pattern.compile("^[a-z][a-z0-9+\\-.]*:");
|
||||
|
||||
private static MiniMessage miniMessage = null;
|
||||
|
||||
|
|
@ -232,9 +230,6 @@ public class Utility {
|
|||
String url = matcher.group();
|
||||
String clickUrl = url;
|
||||
String urlFormat = Config.URLFORMAT;
|
||||
if (!URL_SCHEME_PATTERN.matcher(clickUrl).find()) {
|
||||
clickUrl = "http://" + clickUrl;
|
||||
}
|
||||
message = message.replace(url, urlFormat.replaceAll("<url>", url).replaceAll("<clickurl>", clickUrl));
|
||||
}
|
||||
return message;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user