1
0
mirror of https://e.coding.net/circlecloud/MiaoBoard.git synced 2024-12-22 06:49:02 +00:00

fix: 修复自带替换工具错误

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2016-08-16 15:02:19 +08:00
parent c87cc77d3a
commit 862c752d5f
2 changed files with 9 additions and 7 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>pw.yumc</groupId>
<artifactId>MiaoBoard</artifactId>
<version>1.4</version>
<version>1.4.2</version>
<name>MiaoBoard</name>
<build>
<finalName>${project.name}</finalName>

View File

@ -29,20 +29,22 @@ public class Replace {
public static String $(final Player player, String text) {
final Matcher m = PLACEHOLDER_PATTERN.matcher(text);
while (m.find()) {
final String k = m.group(1);
if (k.contains("_")) {
final String[] ka = k.split("_", 2);
final String format = m.group(1);
if (format.contains("_")) {
final String[] ka = format.split("_", 2);
String value = format;
switch (ka[0]) {
case "player":
text = player(player, ka[1]);
value = player(player, ka[1]);
break;
case "server":
text = server(player, ka[1]);
value = server(player, ka[1]);
break;
case "plugin":
text = plugin(player, ka[1]);
value = plugin(player, ka[1]);
break;
}
text = text.replace("%" + format + "%", Matcher.quoteReplacement(value));
}
}
return text;