4
1
mirror of https://e.coding.net/circlecloud/MiaoChat.git synced 2024-12-22 19:18:47 +00:00

fix: 修复format为空时的错误

This commit is contained in:
502647092 2016-12-05 16:48:53 +08:00
parent c84b4ea5f7
commit 4538653914
2 changed files with 4 additions and 4 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>MiaoChat</artifactId> <artifactId>MiaoChat</artifactId>
<version>1.5</version> <version>1.5.1</version>
<build> <build>
<finalName>${project.name}</finalName> <finalName>${project.name}</finalName>
<resources> <resources>

View File

@ -18,7 +18,7 @@ import pw.yumc.YumCore.config.inject.InjectConfigurationSection;
* @author * @author
*/ */
public class ChatRule extends InjectConfigurationSection { 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; private transient String name;
@Default("50") @Default("50")
private Integer index; private Integer index;
@ -43,7 +43,7 @@ public class ChatRule extends InjectConfigurationSection {
} }
formats = new LinkedList<>(); formats = new LinkedList<>();
load(); load();
lastColor = ChatColor.getLastColors(ChatColor.translateAlternateColorCodes('&', formats.getLast())); lastColor = ChatColor.getLastColors(ChatColor.translateAlternateColorCodes('&', formats.isEmpty() ? "§r" : formats.getLast()));
} }
public boolean check(Player player) { public boolean check(Player player) {
@ -99,7 +99,7 @@ public class ChatRule extends InjectConfigurationSection {
String tempvar = format; String tempvar = format;
if (!temp.isEmpty()) { if (!temp.isEmpty()) {
for (String var : temp) { for (String var : temp) {
String[] args = tempvar.split("\\[" + var + "\\]", 2); String[] args = tempvar.split("\\[" + var + "]", 2);
if (!"".equals(args[0])) { if (!"".equals(args[0])) {
formats.add(args[0]); formats.add(args[0]);
} }