From 48650c76211b356fe2f7588b375e2c11200d3542 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Mon, 12 Oct 2015 19:49:06 +0800 Subject: [PATCH] modify config and message... Signed-off-by: 502647092 --- .../fr/xephi/authme/settings/Messages.java | 49 +++++------ .../fr/xephi/authme/settings/Settings.java | 2 +- src/main/resources/config.yml | 86 +++++++++---------- src/main/resources/plugin.yml | 4 +- 4 files changed, 67 insertions(+), 74 deletions(-) diff --git a/src/main/java/fr/xephi/authme/settings/Messages.java b/src/main/java/fr/xephi/authme/settings/Messages.java index e21fe4c..e1786bf 100644 --- a/src/main/java/fr/xephi/authme/settings/Messages.java +++ b/src/main/java/fr/xephi/authme/settings/Messages.java @@ -9,9 +9,9 @@ import fr.xephi.authme.ConsoleLogger; public class Messages extends CustomConfiguration { private static Messages singleton = null; - private String lang = "en"; + private String lang = "zhcn"; - public Messages(File file, String lang) { + public Messages(final File file, final String lang) { super(file); load(); singleton = this; @@ -29,38 +29,39 @@ public class Messages extends CustomConfiguration { singleton = new Messages(Settings.messageFile, Settings.messagesLanguage); } - public void send(CommandSender sender, String msg) { - if (!Settings.messagesLanguage.equalsIgnoreCase(singleton.lang)) - singleton.reloadMessages(); - String loc = (String) singleton.get(msg); - if (loc == null) { - loc = "Error with Translation files, please contact the admin for verify or update translation"; - ConsoleLogger.showError("Error with the " + msg + " translation, verify in your " + getConfigFile() + " !"); - } - for (String l : loc.split("&n")) { - sender.sendMessage(l.replace("&", "\u00a7")); - } - } - - public String[] send(String msg) { + public void send(final CommandSender sender, final String msg) { if (!Settings.messagesLanguage.equalsIgnoreCase(singleton.lang)) { singleton.reloadMessages(); } - String s = (String) singleton.get(msg); + String loc = (String) singleton.get(msg); + if (loc == null) { + loc = "错误的语言文件 " + msg + " ; 请联系管理员升级语言文件"; + ConsoleLogger.showError("错误的语言文件 " + msg + " 请检查您的配置文件" + getConfigFile() + " !"); + } + for (final String l : loc.split("&n")) { + sender.sendMessage(l.replace("&", "§")); + } + } + + public String[] send(final String msg) { + if (!Settings.messagesLanguage.equalsIgnoreCase(singleton.lang)) { + singleton.reloadMessages(); + } + final String s = (String) singleton.get(msg); if (s == null) { - ConsoleLogger.showError("Error with the " + msg + " translation, verify in your " + getConfigFile() + " !"); - String[] loc = new String[1]; - loc[0] = "Error with " + msg + " translation; Please contact the admin for verify or update translation files"; + ConsoleLogger.showError("错误的语言文件 " + msg + " 请检查您的配置文件" + getConfigFile() + " !"); + final String[] loc = new String[1]; + loc[0] = "错误的语言文件 " + msg + " ; 请联系管理员升级语言文件"; return (loc); } - int i = s.split("&n").length; - String[] loc = new String[i]; + final int i = s.split("&n").length; + final String[] loc = new String[i]; int a; for (a = 0; a < i; a++) { - loc[a] = ((String) this.get(msg)).split("&n")[a].replace("&", "\u00a7"); + loc[a] = ((String) this.get(msg)).split("&n")[a].replace("&", "§"); } if (loc.length == 0) { - loc[0] = "Error with " + msg + " translation; Please contact the admin for verify or update translation files"; + loc[0] = "错误的语言文件 " + msg + " ; 请联系管理员升级语言文件"; } return loc; } diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index 48aaa75..4fb5c00 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -150,7 +150,7 @@ public final class Settings extends YamlConfiguration { } public static void loadVariables() { - messagesLanguage = checkLang(configFile.getString("settings.messagesLanguage", "en").toLowerCase()); + messagesLanguage = checkLang(configFile.getString("settings.messagesLanguage", "zhcn").toLowerCase()); isPermissionCheckEnabled = configFile.getBoolean("permission.EnablePermissionCheck", false); isForcedRegistrationEnabled = configFile.getBoolean("settings.registration.force", true); isRegistrationEnabled = configFile.getBoolean("settings.registration.enabled", true); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index c10c977..d024ac8 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,72 +1,65 @@ DataSource: - # What type of database do you want to use? - # Can be set to: sqlite, sqlitehikari, mysql - # (sqlitehikari should be more fast than normal sqlite but it's an experimental feature!) + # 你希望如何存储登陆数据? + # 允许设置的值: sqlite, sqlitehikari, mysql + # (sqlitehikari 比普通的 sqlite 更快 但这只是一个实验功能!) backend: sqlite - # Enable database caching + # 开启数据缓存 caching: true - # Database location + # MySql 数据库地址 mySQLHost: 127.0.0.1 - # Database Port + # MySql 数据库端口 mySQLPort: '3306' - # MySql Max Connections + # MySql 最大连接数 mySQLMaxConections: 25 - # Username about Database Connection Infos + # MySql 用户名 mySQLUsername: authme - # Password about Database Connection Infos + # MySql 密码 mySQLPassword: '12345' - # Database Name, use with converters or as SQLITE database name + # MySql 数据库名称, 或者是 SQLITE 数据库名称 mySQLDatabase: authme - # Table of the database + # 数据库表名 mySQLTablename: authme - # Column of IDs to sort data + # 字段 id 字段名 mySQLColumnId: id - # Column for storing or checking players nickname + # 字段 username 字段名 mySQLColumnName: username - # Column for storing players passwords + # 字段 password 字段名 mySQLColumnPassword: password - # Column for storing players emails + # 字段 email 字段名 mySQLColumnEmail: email - # Column for Saving if a player is logged in or not + # 字段 isLogged 字段名 mySQLColumnLogged: isLogged - # Column for storing players IPs + # 字段 ip 字段名 mySQLColumnIp: ip - # Column for storing players lastlogins + # 字段 lastlogin 字段名 mySQLColumnLastLogin: lastlogin - # Column for SaveQuitLocation - X + # 字段 x 字段名 mySQLlastlocX: x - # Column for SaveQuitLocation - Y + # 字段 y 字段名 mySQLlastlocY: y - # Column for SaveQuitLocation - Z + # 字段 z 字段名 mySQLlastlocZ: z - # Column for SaveQuitLocation - World name + # 字段 world 字段名 mySQLlastlocWorld: world - # Column for RealName + # 字段 realname 字段名 mySQLRealName: realname settings: sessions: - # Do you want to enable the session feature? - # If enabled, when a player authenticates successfully, - # his IP and his nickname is saved. - # The next time the player joins the server, if his IP - # is the same of the last time, and the timeout time - # hasn't expired, he will not need to authenticate. + # 是否开启 Session 缓存. + # 如果开启 Session 玩家可以在特殊情况下自动登录. + # 他的IP和名称将会被保存. + # 在他下次进入服务器时. + # 如果 名称 IP 都相同 并且没有超出缓存时间. + # 那么他可以自动登录到服务器. enabled: false - # After how many minutes a session should expire? - # 0 for unlimited time (Very dangerous, use it at your own risk!) - # Consider that session will end only after the timeout time, and - # if the player's ip has changed but the timeout hasn't expired, - # player will be kicked out of sever due to invalidSession! + # Session 缓存时间 timeout: 10 - # Should the session expire if the player try to login with an - # another IP Address? + # 下次登陆是否需要检查 IP sessionExpireOnIpChange: true restrictions: - # Can not authenticated players chat and see the chat log? - # Care that this feature blocks also all the commands not - # listed in the list below. + # 未登录情况下是否允许聊天. allowChat: false - # Commands allowed when a player is not authenticated + # 未登录情况下允许使用的命令. allowCommands: - /login - /register @@ -74,9 +67,9 @@ settings: - /reg - /email - /captcha - # Max number of allowed registrations per IP (default: 1) + # 每一个 IP 允许注册的账号 (默认: 1) maxRegPerIp: 1 - # Max allowed username length + # 允许的最大用户名长度 maxNicknameLength: 16 # When this setting is enabled, online players can't be kicked out # due to "Logged in from another Location" @@ -140,8 +133,8 @@ settings: - world_the_end # Ban ip when the ip is not the ip registered in database banUnsafedIP: false - # Spawn Priority, Values : authme, essentials, multiverse, default - spawnPriority: authme,essentials,multiverse,default + # Spawn Priority, Values : authme, essentials, default + spawnPriority: authme,essentials,default # Maximum Login authorized by IP maxLoginPerIp: 0 # Maximum Join authorized by IP @@ -234,7 +227,7 @@ settings: # It is CaseSensitive! UnrestrictedName: [] # Message language, available : en, de, br, cz, pl, fr, ru, hu, sk, es, zhtw, fi, zhcn, lt, it, ko, pt - messagesLanguage: en + messagesLanguage: zhcn # Force these commands after /login, without any '/', use %p for replace with player name forceCommands: [] # Force these commands after /login as a server console, without any '/', use %p for replace with player name @@ -351,8 +344,6 @@ Email: # WhiteList only these domains for emails emailWhitelisted: [] Hooks: - # Do we need to hook with multiverse for spawn checking? - multiverse: true # Do we need to hook with BungeeCord for get the real Player ip ? bungeecord: false # Do we need to disable Essentials SocialSpy on join ? @@ -385,6 +376,7 @@ Protection: countries: - US - GB + - CN # Countries blacklisted automatically ( without any needed to enable protection ) countriesBlacklist: - A1 diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 276773c..f1a37f4 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,10 +1,10 @@ name: AuthMe -author: Xephi59 +authors: [Xephi59, 喵♂呜] website: http://dev.bukkit.org/bukkit-plugins/authme-reloaded/ description: AuthMe prevents people, which aren't logged in, from doing stuff like placing blocks, moving, typing commands or seeing the inventory of the player. main: fr.xephi.authme.AuthMe version: ${project.version} -softdepend: [Vault, ChestShop, Multiverse-Core, Citizens, CombatTag, Essentials, EssentialsSpawn, PerWorldInventories, ProtocolLib] +softdepend: [Vault, ChestShop, Citizens, Essentials, EssentialsSpawn, ProtocolLib] commands: register: description: Register an account