1
0
mirror of https://e.coding.net/circlecloud/MiaoBoard.git synced 2024-11-22 01:49:05 +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> <modelVersion>4.0.0</modelVersion>
<groupId>pw.yumc</groupId> <groupId>pw.yumc</groupId>
<artifactId>MiaoBoard</artifactId> <artifactId>MiaoBoard</artifactId>
<version>1.4</version> <version>1.4.2</version>
<name>MiaoBoard</name> <name>MiaoBoard</name>
<build> <build>
<finalName>${project.name}</finalName> <finalName>${project.name}</finalName>

View File

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