修改语言文件分割代码...

Signed-off-by: 502647092 <jtb1@163.com>
master
502647092 2015-11-12 13:25:08 +08:00
parent 5e79e2a5f7
commit e53092f90c
3 changed files with 15 additions and 17 deletions

View File

@ -10,13 +10,6 @@ public class Messages {
private static Messages singleton = null; private static Messages singleton = null;
public static Messages getInstance() {
if (singleton == null) {
singleton = new Messages();
}
return singleton;
}
private final FileConfig msgcfg; private final FileConfig msgcfg;
public Messages() { public Messages() {
@ -24,6 +17,13 @@ public class Messages {
singleton = this; singleton = this;
} }
public static Messages getInstance() {
if (singleton == null) {
singleton = new Messages();
}
return singleton;
}
public String getString(final String string) { public String getString(final String string) {
return msgcfg.getMessage(string); return msgcfg.getMessage(string);
} }
@ -42,10 +42,10 @@ public class Messages {
public String[] send(final String msg) { public String[] send(final String msg) {
String loc = msgcfg.getMessage(msg); String loc = msgcfg.getMessage(msg);
if (loc == null || loc.isEmpty()) { if (loc == null || loc.isEmpty()) {
loc = "错误的语言文件 " + msg + " ; 请联系管理员升级语言文件"; loc = "错误的语言文件 " + msg + " 请联系管理员升级语言文件";
ConsoleLogger.showError("错误的语言文件 " + msg + " 请检查您的配置文件" + msgcfg.getName() + " !"); ConsoleLogger.showError("错误的语言文件 " + msg + " 请检查您的配置文件 " + msgcfg.getName() + " !");
} }
return loc.split(Settings.messageSplit); return loc.split("\n");
} }
} }

View File

@ -70,6 +70,11 @@ public final class Settings {
protected static FileConfig configFile; protected static FileConfig configFile;
public Settings(final AuthMe pl) {
plugin = pl;
configFile = (FileConfig) plugin.getConfig();
}
/** /**
* Config option for setting and check restricted user by username;ip , * Config option for setting and check restricted user by username;ip ,
* return false if ip and name doesnt amtch with player that join the * return false if ip and name doesnt amtch with player that join the
@ -188,7 +193,6 @@ public final class Settings {
isStopEnabled = configFile.getBoolean("Security.SQLProblem.stopServer", true); isStopEnabled = configFile.getBoolean("Security.SQLProblem.stopServer", true);
reloadSupport = configFile.getBoolean("Security.ReloadCommand.useReloadCommandSupport", true); reloadSupport = configFile.getBoolean("Security.ReloadCommand.useReloadCommandSupport", true);
allowCommands = configFile.getStringList("settings.restrictions.allowCommands"); allowCommands = configFile.getStringList("settings.restrictions.allowCommands");
messageSplit = configFile.getString("settings.messagesplit", "&n");
if (configFile.contains("allowCommands")) { if (configFile.contains("allowCommands")) {
if (!allowCommands.contains("/login")) { if (!allowCommands.contains("/login")) {
allowCommands.add("/login"); allowCommands.add("/login");
@ -361,11 +365,6 @@ public final class Settings {
} }
} }
public Settings(final AuthMe pl) {
plugin = pl;
configFile = (FileConfig) plugin.getConfig();
}
public void mergeConfig() { public void mergeConfig() {
boolean changes = false; boolean changes = false;
if (configFile.contains("Xenoforo.predefinedSalt")) { if (configFile.contains("Xenoforo.predefinedSalt")) {

View File

@ -44,7 +44,6 @@ DataSource:
# 字段 realname 字段名 # 字段 realname 字段名
mySQLRealName: realname mySQLRealName: realname
settings: settings:
messagesplit: '&n'
sessions: sessions:
# 是否开启 Session 缓存. # 是否开启 Session 缓存.
# 如果开启 Session 玩家可以在特殊情况下自动登录. # 如果开启 Session 玩家可以在特殊情况下自动登录.