4
1
mirror of https://e.coding.net/circlecloud/MiaoChat.git synced 2024-11-14 13:28:46 +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>
<groupId>pw.yumc</groupId>
<artifactId>MiaoChat</artifactId>
<version>1.5</version>
<version>1.5.1</version>
<build>
<finalName>${project.name}</finalName>
<resources>

View File

@ -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]);
}