From 45386539149a0e5d644bb7fd3bfa7c95276b3781 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Mon, 5 Dec 2016 16:48:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dformat=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E6=97=B6=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- src/main/java/pw/yumc/MiaoChat/config/ChatRule.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 82b2e5a..efcbc99 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 pw.yumc MiaoChat - 1.5 + 1.5.1 ${project.name} diff --git a/src/main/java/pw/yumc/MiaoChat/config/ChatRule.java b/src/main/java/pw/yumc/MiaoChat/config/ChatRule.java index 653a1f5..23434da 100644 --- a/src/main/java/pw/yumc/MiaoChat/config/ChatRule.java +++ b/src/main/java/pw/yumc/MiaoChat/config/ChatRule.java @@ -18,7 +18,7 @@ import pw.yumc.YumCore.config.inject.InjectConfigurationSection; * @author 喵♂呜 */ public class ChatRule extends InjectConfigurationSection { - private transient static Pattern FORMAT_PATTERN = Pattern.compile("[\\[]([^\\[\\]]+)[\\]]"); + private transient static Pattern FORMAT_PATTERN = Pattern.compile("[\\[]([^\\[\\]]+)[]]"); private transient String name; @Default("50") private Integer index; @@ -43,7 +43,7 @@ public class ChatRule extends InjectConfigurationSection { } formats = new LinkedList<>(); load(); - lastColor = ChatColor.getLastColors(ChatColor.translateAlternateColorCodes('&', formats.getLast())); + lastColor = ChatColor.getLastColors(ChatColor.translateAlternateColorCodes('&', formats.isEmpty() ? "§r" : formats.getLast())); } public boolean check(Player player) { @@ -99,7 +99,7 @@ public class ChatRule extends InjectConfigurationSection { String tempvar = format; if (!temp.isEmpty()) { for (String var : temp) { - String[] args = tempvar.split("\\[" + var + "\\]", 2); + String[] args = tempvar.split("\\[" + var + "]", 2); if (!"".equals(args[0])) { formats.add(args[0]); }