Merge pull request #73 from thinkofdeath/master
Fix links missing the path once clicked
Dieser Commit ist enthalten in:
Commit
2e5d2f1fca
@ -1,11 +1,11 @@
|
|||||||
From 4f2f1f5b626323a15226c3ac2791a11f732f19bb Mon Sep 17 00:00:00 2001
|
From 8cb1e75734ea07360b11efb0734785c8300df9cf 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..a786da9 100644
|
index cc8e715..377653b 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;
|
||||||
@ -41,7 +41,7 @@ index cc8e715..a786da9 100644
|
|||||||
|
|
||||||
for (int i = 0; i < message.length(); i++) {
|
for (int i = 0; i < message.length(); i++) {
|
||||||
char currentChar = message.charAt(i);
|
char currentChar = message.charAt(i);
|
||||||
@@ -78,6 +85,28 @@ public final class CraftChatMessage {
|
@@ -78,6 +85,30 @@ public final class CraftChatMessage {
|
||||||
}
|
}
|
||||||
currentChatComponent = null;
|
currentChatComponent = null;
|
||||||
} else {
|
} else {
|
||||||
@ -52,12 +52,14 @@ index cc8e715..a786da9 100644
|
|||||||
+ String fullUrl = urlMatcher.group(0);
|
+ String fullUrl = urlMatcher.group(0);
|
||||||
+ String protocol = urlMatcher.group(1);
|
+ String protocol = urlMatcher.group(1);
|
||||||
+ String url = urlMatcher.group(2);
|
+ String url = urlMatcher.group(2);
|
||||||
|
+ String path = urlMatcher.group(3);
|
||||||
+ builder.delete(builder.length() - fullUrl.length() + (i == message.length() - 1 ? 1 : 0), builder.length());
|
+ builder.delete(builder.length() - fullUrl.length() + (i == message.length() - 1 ? 1 : 0), builder.length());
|
||||||
+ if (builder.length() > 0) {
|
+ if (builder.length() > 0) {
|
||||||
+ appendNewComponent();
|
+ appendNewComponent();
|
||||||
+ }
|
+ }
|
||||||
+ builder.append(fullUrl);
|
+ builder.append(fullUrl);
|
||||||
+ ChatClickable link = new ChatClickable(EnumClickAction.OPEN_URL, (protocol!=null?protocol:"http") + "://" + url);
|
+ ChatClickable link = new ChatClickable(EnumClickAction.OPEN_URL,
|
||||||
|
+ (protocol!=null?protocol:"http") + "://" + url + (path!=null?path:""));
|
||||||
+ modifier.a(link);
|
+ modifier.a(link);
|
||||||
+ appendNewComponent();
|
+ appendNewComponent();
|
||||||
+ modifier.a((ChatClickable) null);
|
+ modifier.a((ChatClickable) null);
|
||||||
@ -71,5 +73,5 @@ index cc8e715..a786da9 100644
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
--
|
--
|
||||||
1.8.3.2
|
1.8.4.msysgit.0
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren