diff --git a/pom.xml b/pom.xml
index 6d038b9..d99315f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
pw.yumc
MiaoChat
- 1.2
+ 1.3
${project.name}
diff --git a/src/main/java/pw/yumc/MiaoChat/config/ChatConfig.java b/src/main/java/pw/yumc/MiaoChat/config/ChatConfig.java
index bfac3e0..3c3a5e1 100644
--- a/src/main/java/pw/yumc/MiaoChat/config/ChatConfig.java
+++ b/src/main/java/pw/yumc/MiaoChat/config/ChatConfig.java
@@ -4,7 +4,6 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedList;
-import java.util.List;
import java.util.Map;
import org.bukkit.entity.Player;
@@ -22,7 +21,7 @@ public class ChatConfig {
private static final String F = "Formats";
private final Map formats;
private final RuleComparator rulecomp;
- private final List rules;
+ private final LinkedList rules;
private final FileConfig config;
private final FileConfig format;
@@ -32,7 +31,7 @@ public class ChatConfig {
rulecomp = new RuleComparator();
formats = new HashMap<>();
rules = new LinkedList<>();
- reload();
+ load();
}
/**
@@ -55,21 +54,27 @@ public class ChatConfig {
return formats.get(name);
}
- public void reload() {
- format.reload();
+ public void load() {
formats.clear();
for (final String name : format.getKeys(false)) {
formats.put(name, new ChatMessagePart(format.getConfigurationSection(name)));
+ Log.d("载入聊天格式: %s", name);
}
rules.clear();
if (config.isSet(F)) {
for (final String rule : config.getConfigurationSection(F).getKeys(false)) {
rules.add(new ChatRule(rule, config.getConfigurationSection(F + "." + rule)));
+ Log.d("载入聊天规则: %s => \"%s\"", rule, rules.getLast().getFormat());
}
}
Collections.sort(rules, rulecomp);
}
+ public void reload() {
+ format.reload();
+ load();
+ }
+
private class RuleComparator implements Comparator {
@Override
public int compare(final ChatRule o1, final ChatRule o2) {
diff --git a/src/main/java/pw/yumc/MiaoChat/config/ChatRule.java b/src/main/java/pw/yumc/MiaoChat/config/ChatRule.java
index 145e1bc..3b4dedc 100644
--- a/src/main/java/pw/yumc/MiaoChat/config/ChatRule.java
+++ b/src/main/java/pw/yumc/MiaoChat/config/ChatRule.java
@@ -93,7 +93,9 @@ public class ChatRule extends InjectConfigurationSection {
if (!temp.isEmpty()) {
for (final String var : temp) {
final String[] args = tempvar.split("\\[" + var + "\\]", 2);
- formats.add(args[0]);
+ if (!"".equals(args[0])) {
+ formats.add(args[0]);
+ }
formats.add(var);
tempvar = args[1];
}