mirror of
https://github.com/kaboomserver/extras.git
synced 2024-11-27 01:45:44 -05:00
Make URL regex stricter
This commit is contained in:
parent
4d2455d45b
commit
6c375f0cb5
1 changed files with 3 additions and 3 deletions
|
@ -49,8 +49,8 @@ public final class PlayerChat implements Listener {
|
||||||
TextReplacementConfig
|
TextReplacementConfig
|
||||||
.builder()
|
.builder()
|
||||||
.match(Pattern
|
.match(Pattern
|
||||||
.compile("((https?://(www\\.)?)?[-a-zA-Z0-9@:%._+~#=]" +
|
.compile("((https?://(ww(w|\\d)\\.)?|ww(w|\\d))[-a-zA-Z0-9@:%._+~#=]{1,256}"
|
||||||
"{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_+.~#?&/=]*))"))
|
+ "\\.[a-zA-Z0-9]{2,6}\\b([-a-zA-Z0-9@:%_+.~#?&/=]*))"))
|
||||||
.replacement((b, c) -> {
|
.replacement((b, c) -> {
|
||||||
if (c == null) {
|
if (c == null) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -64,7 +64,7 @@ public final class PlayerChat implements Listener {
|
||||||
final String url;
|
final String url;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Minecraft doesn't accept "www.google.com" or "google.com" as URLs
|
Minecraft doesn't accept "www.google.com" as a URL
|
||||||
in click events
|
in click events
|
||||||
*/
|
*/
|
||||||
if (content.contains("://")) {
|
if (content.contains("://")) {
|
||||||
|
|
Loading…
Reference in a new issue