1
0
mirror of https://e.coding.net/circlecloud/AuthMe.git synced 2024-12-22 06:48:55 +00:00

modify config and message...

Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
502647092 2015-10-12 19:49:06 +08:00
parent 5a00c165dc
commit 48650c7621
4 changed files with 67 additions and 74 deletions

View File

@ -9,9 +9,9 @@ import fr.xephi.authme.ConsoleLogger;
public class Messages extends CustomConfiguration { public class Messages extends CustomConfiguration {
private static Messages singleton = null; 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); super(file);
load(); load();
singleton = this; singleton = this;
@ -29,38 +29,39 @@ public class Messages extends CustomConfiguration {
singleton = new Messages(Settings.messageFile, Settings.messagesLanguage); singleton = new Messages(Settings.messageFile, Settings.messagesLanguage);
} }
public void send(CommandSender sender, String msg) { public void send(final CommandSender sender, final 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) {
if (!Settings.messagesLanguage.equalsIgnoreCase(singleton.lang)) { if (!Settings.messagesLanguage.equalsIgnoreCase(singleton.lang)) {
singleton.reloadMessages(); 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) { if (s == null) {
ConsoleLogger.showError("Error with the " + msg + " translation, verify in your " + getConfigFile() + " !"); ConsoleLogger.showError("错误的语言文件 " + msg + " 请检查您的配置文件" + getConfigFile() + " !");
String[] loc = new String[1]; final String[] loc = new String[1];
loc[0] = "Error with " + msg + " translation; Please contact the admin for verify or update translation files"; loc[0] = "错误的语言文件 " + msg + " ; 请联系管理员升级语言文件";
return (loc); return (loc);
} }
int i = s.split("&n").length; final int i = s.split("&n").length;
String[] loc = new String[i]; final String[] loc = new String[i];
int a; int a;
for (a = 0; a < i; 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) { 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; return loc;
} }

View File

@ -150,7 +150,7 @@ public final class Settings extends YamlConfiguration {
} }
public static void loadVariables() { 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); isPermissionCheckEnabled = configFile.getBoolean("permission.EnablePermissionCheck", false);
isForcedRegistrationEnabled = configFile.getBoolean("settings.registration.force", true); isForcedRegistrationEnabled = configFile.getBoolean("settings.registration.force", true);
isRegistrationEnabled = configFile.getBoolean("settings.registration.enabled", true); isRegistrationEnabled = configFile.getBoolean("settings.registration.enabled", true);

View File

@ -1,72 +1,65 @@
DataSource: DataSource:
# What type of database do you want to use? # 你希望如何存储登陆数据?
# Can be set to: sqlite, sqlitehikari, mysql # 允许设置的值: sqlite, sqlitehikari, mysql
# (sqlitehikari should be more fast than normal sqlite but it's an experimental feature!) # (sqlitehikari 比普通的 sqlite 更快 但这只是一个实验功能!)
backend: sqlite backend: sqlite
# Enable database caching # 开启数据缓存
caching: true caching: true
# Database location # MySql 数据库地址
mySQLHost: 127.0.0.1 mySQLHost: 127.0.0.1
# Database Port # MySql 数据库端口
mySQLPort: '3306' mySQLPort: '3306'
# MySql Max Connections # MySql 最大连接数
mySQLMaxConections: 25 mySQLMaxConections: 25
# Username about Database Connection Infos # MySql 用户名
mySQLUsername: authme mySQLUsername: authme
# Password about Database Connection Infos # MySql 密码
mySQLPassword: '12345' mySQLPassword: '12345'
# Database Name, use with converters or as SQLITE database name # MySql 数据库名称, 或者是 SQLITE 数据库名称
mySQLDatabase: authme mySQLDatabase: authme
# Table of the database # 数据库表名
mySQLTablename: authme mySQLTablename: authme
# Column of IDs to sort data # 字段 id 字段名
mySQLColumnId: id mySQLColumnId: id
# Column for storing or checking players nickname # 字段 username 字段名
mySQLColumnName: username mySQLColumnName: username
# Column for storing players passwords # 字段 password 字段名
mySQLColumnPassword: password mySQLColumnPassword: password
# Column for storing players emails # 字段 email 字段名
mySQLColumnEmail: email mySQLColumnEmail: email
# Column for Saving if a player is logged in or not # 字段 isLogged 字段名
mySQLColumnLogged: isLogged mySQLColumnLogged: isLogged
# Column for storing players IPs # 字段 ip 字段名
mySQLColumnIp: ip mySQLColumnIp: ip
# Column for storing players lastlogins # 字段 lastlogin 字段名
mySQLColumnLastLogin: lastlogin mySQLColumnLastLogin: lastlogin
# Column for SaveQuitLocation - X # 字段 x 字段名
mySQLlastlocX: x mySQLlastlocX: x
# Column for SaveQuitLocation - Y # 字段 y 字段名
mySQLlastlocY: y mySQLlastlocY: y
# Column for SaveQuitLocation - Z # 字段 z 字段名
mySQLlastlocZ: z mySQLlastlocZ: z
# Column for SaveQuitLocation - World name # 字段 world 字段名
mySQLlastlocWorld: world mySQLlastlocWorld: world
# Column for RealName # 字段 realname 字段名
mySQLRealName: realname mySQLRealName: realname
settings: settings:
sessions: sessions:
# Do you want to enable the session feature? # 是否开启 Session 缓存.
# If enabled, when a player authenticates successfully, # 如果开启 Session 玩家可以在特殊情况下自动登录.
# his IP and his nickname is saved. # 他的IP和名称将会被保存.
# The next time the player joins the server, if his IP # 在他下次进入服务器时.
# is the same of the last time, and the timeout time # 如果 名称 IP 都相同 并且没有超出缓存时间.
# hasn't expired, he will not need to authenticate. # 那么他可以自动登录到服务器.
enabled: false enabled: false
# After how many minutes a session should expire? # Session 缓存时间
# 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!
timeout: 10 timeout: 10
# Should the session expire if the player try to login with an # 下次登陆是否需要检查 IP
# another IP Address?
sessionExpireOnIpChange: true sessionExpireOnIpChange: true
restrictions: 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 allowChat: false
# Commands allowed when a player is not authenticated # 未登录情况下允许使用的命令.
allowCommands: allowCommands:
- /login - /login
- /register - /register
@ -74,9 +67,9 @@ settings:
- /reg - /reg
- /email - /email
- /captcha - /captcha
# Max number of allowed registrations per IP (default: 1) # 每一个 IP 允许注册的账号 (默认: 1)
maxRegPerIp: 1 maxRegPerIp: 1
# Max allowed username length # 允许的最大用户名长度
maxNicknameLength: 16 maxNicknameLength: 16
# When this setting is enabled, online players can't be kicked out # When this setting is enabled, online players can't be kicked out
# due to "Logged in from another Location" # due to "Logged in from another Location"
@ -140,8 +133,8 @@ settings:
- world_the_end - world_the_end
# Ban ip when the ip is not the ip registered in database # Ban ip when the ip is not the ip registered in database
banUnsafedIP: false banUnsafedIP: false
# Spawn Priority, Values : authme, essentials, multiverse, default # Spawn Priority, Values : authme, essentials, default
spawnPriority: authme,essentials,multiverse,default spawnPriority: authme,essentials,default
# Maximum Login authorized by IP # Maximum Login authorized by IP
maxLoginPerIp: 0 maxLoginPerIp: 0
# Maximum Join authorized by IP # Maximum Join authorized by IP
@ -234,7 +227,7 @@ settings:
# It is CaseSensitive! # It is CaseSensitive!
UnrestrictedName: [] UnrestrictedName: []
# Message language, available : en, de, br, cz, pl, fr, ru, hu, sk, es, zhtw, fi, zhcn, lt, it, ko, pt # 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 # Force these commands after /login, without any '/', use %p for replace with player name
forceCommands: [] forceCommands: []
# Force these commands after /login as a server console, without any '/', use %p for replace with player name # 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 # WhiteList only these domains for emails
emailWhitelisted: [] emailWhitelisted: []
Hooks: 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 ? # Do we need to hook with BungeeCord for get the real Player ip ?
bungeecord: false bungeecord: false
# Do we need to disable Essentials SocialSpy on join ? # Do we need to disable Essentials SocialSpy on join ?
@ -385,6 +376,7 @@ Protection:
countries: countries:
- US - US
- GB - GB
- CN
# Countries blacklisted automatically ( without any needed to enable protection ) # Countries blacklisted automatically ( without any needed to enable protection )
countriesBlacklist: countriesBlacklist:
- A1 - A1

View File

@ -1,10 +1,10 @@
name: AuthMe name: AuthMe
author: Xephi59 authors: [Xephi59, 喵♂呜]
website: http://dev.bukkit.org/bukkit-plugins/authme-reloaded/ 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. 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 main: fr.xephi.authme.AuthMe
version: ${project.version} version: ${project.version}
softdepend: [Vault, ChestShop, Multiverse-Core, Citizens, CombatTag, Essentials, EssentialsSpawn, PerWorldInventories, ProtocolLib] softdepend: [Vault, ChestShop, Citizens, Essentials, EssentialsSpawn, ProtocolLib]
commands: commands:
register: register:
description: Register an account description: Register an account