Fix new lines break URL matching

This commit is contained in:
Thinkofdeath 2013-12-11 18:09:41 +00:00
parent dedbed0faf
commit 5b756ab152
1 changed files with 11 additions and 4 deletions

View File

@ -1,11 +1,11 @@
From 90653e58b284b1b1f0304d409faf40c6c8039bd8 Mon Sep 17 00:00:00 2001 From e36d608f7f0a8fc2ea06b381311a394f8d6ed123 Mon Sep 17 00:00:00 2001
From: Thinkofdeath <purggames@gmail.com> From: Thinkofdeath <purggames@gmail.com>
Date: Sun, 1 Dec 2013 10:33:55 +0000 Date: Sun, 1 Dec 2013 10:33:55 +0000
Subject: [PATCH] Fix links in chat Subject: [PATCH] Fix links in chat
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
index cc8e715..22d1346 100644 index cc8e715..5607df1 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
@@ -3,11 +3,15 @@ package org.bukkit.craftbukkit.util; @@ -3,11 +3,15 @@ package org.bukkit.craftbukkit.util;
@ -48,7 +48,14 @@ index cc8e715..22d1346 100644
if (builder.length() > 0) { if (builder.length() > 0) {
appendNewComponent(); appendNewComponent();
} }
@@ -78,6 +88,11 @@ public final class CraftChatMessage { @@ -73,11 +83,18 @@ public final class CraftChatMessage {
}
i++;
} else if (currentChar == '\n') {
+ checkUrl(matcher, message, i);
+ lastWord = i + 1;
if (builder.length() > 0) {
appendNewComponent();
} }
currentChatComponent = null; currentChatComponent = null;
} else { } else {
@ -60,7 +67,7 @@ index cc8e715..22d1346 100644
builder.append(currentChar); builder.append(currentChar);
} }
} }
@@ -89,6 +104,31 @@ public final class CraftChatMessage { @@ -89,6 +106,31 @@ public final class CraftChatMessage {
output = list.toArray(new IChatBaseComponent[0]); output = list.toArray(new IChatBaseComponent[0]);
} }