mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 13:07:06 +01:00
cab333b217
Don't send requests of every player was found in the global api cache SpigotMC/Spigot@841270ff1e Correctly set the response code for the cached lookups and return the ... SpigotMC/Spigot@f170b7899c Don't try and re-set the global api cache on reload SpigotMC/Spigot@b410a00a66 Use a compile time sneaky throw hack. SpigotMC/Spigot@508462b96b Fix a missed rename in WorldGenGroundBush SpigotMC/Spigot@0614d8fae9
41 lines
2.3 KiB
Diff
41 lines
2.3 KiB
Diff
From c025c5caed701fead870e2b1b71c8960156fff67 Mon Sep 17 00:00:00 2001
|
|
From: Thinkofdeath <thethinkofdeath@gmail.com>
|
|
Date: Sat, 18 Jan 2014 19:32:42 +0000
|
|
Subject: [PATCH] Support non-prefixed URLs
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
|
index 256f053..6491b10 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
|
@@ -19,7 +19,7 @@ import com.google.common.collect.ImmutableMap.Builder;
|
|
public final class CraftChatMessage {
|
|
private static class StringMessage {
|
|
private static final Map<Character, EnumChatFormat> formatMap;
|
|
- private static final Pattern INCREMENTAL_PATTERN = Pattern.compile("(" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + "[0-9a-fk-or])|(\\n)|(?:(https?://[^ ][^ ]*?)(?=[\\.\\?!,;:]?(?:[ \\n]|$)))", Pattern.CASE_INSENSITIVE);
|
|
+ private static final Pattern INCREMENTAL_PATTERN = Pattern.compile("(" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + "[0-9a-fk-or])|(\\n)|((?:(?:https?)://)?(?:[-\\w_\\.]{2,}\\.[a-z]{2,4}.*?(?=[\\.\\?!,;:]?(?:[" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + " \\n]|$))))", Pattern.CASE_INSENSITIVE);
|
|
|
|
static {
|
|
Builder<Character, EnumChatFormat> builder = ImmutableMap.builder();
|
|
@@ -85,6 +85,9 @@ public final class CraftChatMessage {
|
|
currentChatComponent = null;
|
|
break;
|
|
case 3:
|
|
+ if ( !( match.startsWith( "http://" ) || match.startsWith( "https://" ) ) ) {
|
|
+ match = "http://" + match;
|
|
+ }
|
|
modifier.setChatClickable(new ChatClickable(EnumClickAction.OPEN_URL, match));
|
|
appendNewComponent(matcher.end(groupId));
|
|
modifier.setChatClickable((ChatClickable) null);
|
|
@@ -96,7 +99,7 @@ public final class CraftChatMessage {
|
|
appendNewComponent(message.length());
|
|
}
|
|
|
|
- output = list.toArray(new IChatBaseComponent[0]);
|
|
+ output = list.toArray(new IChatBaseComponent[list.size()]);
|
|
}
|
|
|
|
private void appendNewComponent(int index) {
|
|
--
|
|
1.9.1
|
|
|