mirror of
https://e.coding.net/circlecloud/AuthMe.git
synced 2024-11-13 00:18:58 +00:00
remove english config fix some bug and use PluginHelper...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
parent
9fc1fa567b
commit
6e21ab6f37
5
pom.xml
5
pom.xml
@ -95,8 +95,13 @@
|
||||
<include>org.slf4j:slf4j-api</include>
|
||||
<include>com.maxmind.geoip:geoip-api</include>
|
||||
<include>com.google.code.gson:gson</include>
|
||||
<include>cn.citycraft:PluginHelper</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<relocation>
|
||||
<pattern>cn.citycraft.PluginHelper</pattern>
|
||||
<shadedPattern>${project.groupId}.${project.artifactId}</shadedPattern>
|
||||
</relocation>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
|
@ -72,6 +72,7 @@ public class AuthMe extends JavaPlugin {
|
||||
public NewAPI api;
|
||||
public ConcurrentHashMap<String, String> cap = new ConcurrentHashMap<>();
|
||||
public ConcurrentHashMap<String, Integer> captcha = new ConcurrentHashMap<>();
|
||||
public FileConfig config;
|
||||
public DataSource database;
|
||||
public DataManager dataManager;
|
||||
public boolean delayedAntiBot = true;
|
||||
@ -80,9 +81,7 @@ public class AuthMe extends JavaPlugin {
|
||||
public AuthMeInventoryPacketAdapter inventoryProtector;
|
||||
public Management management;
|
||||
public OtherAccounts otherAccounts;
|
||||
public FileConfig config;
|
||||
|
||||
// Hooks TODO: move into modules
|
||||
public Permission permission;
|
||||
|
||||
public ConcurrentHashMap<String, String> realIp = new ConcurrentHashMap<>();
|
||||
@ -285,7 +284,7 @@ public class AuthMe extends JavaPlugin {
|
||||
if (Backup) {
|
||||
ConsoleLogger.info("数据文件备份完成.");
|
||||
} else {
|
||||
ConsoleLogger.showError("Error while performing the backup!");
|
||||
ConsoleLogger.showError("备份数据文件时发生错误 备份失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -315,6 +314,7 @@ public class AuthMe extends JavaPlugin {
|
||||
try {
|
||||
settings = new Settings(this);
|
||||
Settings.reloadcfg();
|
||||
Settings.loadVariables();
|
||||
} catch (final Exception e) {
|
||||
ConsoleLogger.writeStackTrace(e);
|
||||
ConsoleLogger.showError("无法载入配置文件... 某些配置是错误的, 为了安全考虑 服务器即将关闭!");
|
||||
@ -347,7 +347,6 @@ public class AuthMe extends JavaPlugin {
|
||||
// AntiBot delay
|
||||
if (Settings.enableAntiBot) {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
delayedAntiBot = false;
|
||||
@ -374,7 +373,7 @@ public class AuthMe extends JavaPlugin {
|
||||
if (new PerformBackup(this).doBackup()) {
|
||||
ConsoleLogger.info("数据备份完成...");
|
||||
} else {
|
||||
ConsoleLogger.showError("Error while performing the backup!");
|
||||
ConsoleLogger.showError("备份数据文件时发生错误 备份失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -384,7 +383,7 @@ public class AuthMe extends JavaPlugin {
|
||||
} catch (final Exception e) {
|
||||
ConsoleLogger.writeStackTrace(e);
|
||||
ConsoleLogger.showError(e.getMessage());
|
||||
ConsoleLogger.showError("连接数据库期间发生错误! Authme 初始化 中断!");
|
||||
ConsoleLogger.showError("连接数据库期间发生错误! Authme 初始化被中断!");
|
||||
stopOrUnload();
|
||||
return;
|
||||
}
|
||||
|
@ -122,16 +122,16 @@ public class SQLite implements DataSource {
|
||||
while (rs.next()) {
|
||||
PlayerAuth pAuth;
|
||||
if (rs.getString(columnIp).isEmpty()) {
|
||||
pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "127.0.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY),
|
||||
rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName));
|
||||
pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "127.0.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs
|
||||
.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName));
|
||||
} else {
|
||||
if (!columnSalt.isEmpty()) {
|
||||
pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnSalt), rs.getInt(columnGroup), rs.getString(columnIp),
|
||||
rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail),
|
||||
rs.getString(columnRealName));
|
||||
pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnSalt), rs.getInt(columnGroup), rs.getString(columnIp), rs
|
||||
.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs
|
||||
.getString(columnRealName));
|
||||
} else {
|
||||
pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX),
|
||||
rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName));
|
||||
pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs
|
||||
.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName));
|
||||
}
|
||||
}
|
||||
auths.add(pAuth);
|
||||
@ -227,16 +227,16 @@ public class SQLite implements DataSource {
|
||||
rs = pst.executeQuery();
|
||||
if (rs.next()) {
|
||||
if (rs.getString(columnIp).isEmpty()) {
|
||||
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "192.168.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY),
|
||||
rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName));
|
||||
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "192.168.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs
|
||||
.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName));
|
||||
} else {
|
||||
if (!columnSalt.isEmpty()) {
|
||||
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnSalt), rs.getInt(columnGroup), rs.getString(columnIp),
|
||||
rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail),
|
||||
rs.getString(columnRealName));
|
||||
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnSalt), rs.getInt(columnGroup), rs.getString(columnIp), rs
|
||||
.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs
|
||||
.getString(columnRealName));
|
||||
} else {
|
||||
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX),
|
||||
rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName));
|
||||
return new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs
|
||||
.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -284,16 +284,16 @@ public class SQLite implements DataSource {
|
||||
while (rs.next()) {
|
||||
PlayerAuth pAuth;
|
||||
if (rs.getString(columnIp).isEmpty()) {
|
||||
pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "127.0.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY),
|
||||
rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName));
|
||||
pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), "127.0.0.1", rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs
|
||||
.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName));
|
||||
} else {
|
||||
if (!columnSalt.isEmpty()) {
|
||||
pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnSalt), rs.getInt(columnGroup), rs.getString(columnIp),
|
||||
rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail),
|
||||
rs.getString(columnRealName));
|
||||
pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnSalt), rs.getInt(columnGroup), rs.getString(columnIp), rs
|
||||
.getLong(columnLastLogin), rs.getDouble(lastlocX), rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs
|
||||
.getString(columnRealName));
|
||||
} else {
|
||||
pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX),
|
||||
rs.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName));
|
||||
pAuth = new PlayerAuth(rs.getString(columnName), rs.getString(columnPassword), rs.getString(columnIp), rs.getLong(columnLastLogin), rs.getDouble(lastlocX), rs
|
||||
.getDouble(lastlocY), rs.getDouble(lastlocZ), rs.getString(lastlocWorld), rs.getString(columnEmail), rs.getString(columnRealName));
|
||||
}
|
||||
}
|
||||
auths.add(pAuth);
|
||||
@ -613,7 +613,7 @@ public class SQLite implements DataSource {
|
||||
|
||||
private synchronized void connect() throws ClassNotFoundException, SQLException {
|
||||
Class.forName("org.sqlite.JDBC");
|
||||
ConsoleLogger.info("SQLite driver loaded");
|
||||
ConsoleLogger.info("SQLite 驱动载入成功...");
|
||||
this.con = DriverManager.getConnection("jdbc:sqlite:plugins/AuthMe/" + database + ".db");
|
||||
|
||||
}
|
||||
@ -672,6 +672,6 @@ public class SQLite implements DataSource {
|
||||
close(rs);
|
||||
close(st);
|
||||
}
|
||||
ConsoleLogger.info("SQLite Setup finished");
|
||||
ConsoleLogger.info("SQLite 数据表已初始化并载入完毕...");
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,6 @@ public final class Settings extends FileConfig {
|
||||
customAttributes, generateImage, isRemoveSpeedEnabled;
|
||||
public static final File LOG_FILE = new File(APLUGIN_FOLDER, "authme.log");
|
||||
public static File messageFile;
|
||||
public static final File MODULE_FOLDER = new File(APLUGIN_FOLDER, "modules");
|
||||
public static int purgeDelay = 60;
|
||||
public static final File SETTINGS_FILE = new File(APLUGIN_FOLDER, "config.yml");
|
||||
public static List<String> unsafePasswords;
|
||||
@ -80,19 +79,6 @@ public final class Settings extends FileConfig {
|
||||
configFile = (FileConfig) plugin.getConfig();
|
||||
}
|
||||
|
||||
public static String checkLang(final String lang) {
|
||||
if (new File(APLUGIN_FOLDER, "messages" + File.separator + "messages_" + lang + ".yml").exists()) {
|
||||
ConsoleLogger.info("配置语言文件: " + lang);
|
||||
return lang;
|
||||
}
|
||||
if (AuthMe.class.getResourceAsStream("/messages/messages_" + lang + ".yml") != null) {
|
||||
ConsoleLogger.info("配置语言文件: " + lang);
|
||||
return lang;
|
||||
}
|
||||
ConsoleLogger.info("语言文件未找到 " + lang + ", 使用默认语言: en !");
|
||||
return "en";
|
||||
}
|
||||
|
||||
/**
|
||||
* Config option for setting and check restricted user by username;ip ,
|
||||
* return false if ip and name doesnt amtch with player that join the
|
||||
@ -149,7 +135,6 @@ public final class Settings extends FileConfig {
|
||||
}
|
||||
|
||||
public static void loadVariables() {
|
||||
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);
|
||||
@ -311,7 +296,7 @@ public final class Settings extends FileConfig {
|
||||
forceRegisterCommandsAsConsole = configFile.getStringList("settings.forceRegisterCommandsAsConsole");
|
||||
customAttributes = configFile.getBoolean("Hooks.customAttributes");
|
||||
generateImage = configFile.getBoolean("Email.generateImage", true);
|
||||
|
||||
messageFile = new File(APLUGIN_FOLDER, "messages_zhcn.yml");
|
||||
// Load the welcome message
|
||||
getWelcomeMessage();
|
||||
|
||||
|
@ -275,7 +275,7 @@ Security:
|
||||
console:
|
||||
# 移除控制台消息
|
||||
noConsoleSpam: false
|
||||
# 当玩家输入类似 /login 指令时,在后台替换显示的密码
|
||||
# 当玩家输入类似 /login 指令时,在后台替换显示的密码
|
||||
removePassword: true
|
||||
captcha:
|
||||
# 当玩家输入错误密码很多次后需要填写验证码
|
||||
@ -337,4 +337,4 @@ Protection:
|
||||
# Max number of player allowed to login in 5 secs before enable AntiBot system automatically
|
||||
antiBotSensibility: 5
|
||||
# Duration in minutes of the antibot automatic system
|
||||
antiBotDuration: 10
|
||||
antiBotDuration: 10
|
@ -1,58 +0,0 @@
|
||||
unknown_user: '&cCan''t find the requested user in the database!'
|
||||
unsafe_spawn: '&cYour quit location was unsafe, you have been teleported to the world''s spawnpoint.'
|
||||
not_logged_in: '&cYou''re not logged in!'
|
||||
reg_voluntarily: 'You can register yourself to the server with the command "/register <password> <ConfirmPassword>"'
|
||||
usage_log: '&cUsage: /login <password>'
|
||||
wrong_pwd: '&cWrong password!'
|
||||
unregistered: '&cSuccessfully unregistered!'
|
||||
reg_disabled: '&cIn-game registration is disabled!'
|
||||
valid_session: '&2Logged-in due to Session Reconnection.'
|
||||
login: '&2Successful login!'
|
||||
vb_nonActiv: '&cYour account isn''t activated yet, please check your emails!'
|
||||
user_regged: '&cYou already have registered this username!'
|
||||
usage_reg: '&cUsage: /register <password> <ConfirmPassword>'
|
||||
max_reg: '&cYou have exceeded the maximum number of registrations for your connection!'
|
||||
no_perm: '&4You don''t have the permission to perform this action!'
|
||||
error: '&4An unexpected error occurred, please contact an Administrator!'
|
||||
login_msg: '&cPlease, login with the command "/login <password>"'
|
||||
reg_msg: '&3Please, register to the server with the command "/register <password> <ConfirmPassword>"'
|
||||
reg_email_msg: '&3Please, register to the server with the command "/register <email> <confirmEmail>"'
|
||||
usage_unreg: '&cUsage: /unregister <password>'
|
||||
pwd_changed: '&2Password changed successfully!'
|
||||
user_unknown: '&cThis user isn''t registered!'
|
||||
password_error: '&cPasswords didn''t match, check them again!'
|
||||
password_error_nick: '&cYou can''t use your name as password, please choose another one...'
|
||||
password_error_unsafe: '&cThe chosen password isn''t safe, please choose another one...'
|
||||
invalid_session: '&cYour IP has been changed and your session data has expired!'
|
||||
reg_only: '&4Only registered users can join the server! Please visit http://example.com to register yourself!'
|
||||
logged_in: '&cYou''re already logged in!'
|
||||
logout: '&2Logged-out successfully!'
|
||||
same_nick: '&4The same username is already playing on the server!'
|
||||
registered: '&2Successfully registered!'
|
||||
pass_len: '&cYour password is too short or too long! Please try with another one!'
|
||||
reload: '&2Configuration and database have been reloaded correctly!'
|
||||
timeout: '&4Login timeout exceeded, you have been kicked from the server, please try again!'
|
||||
usage_changepassword: '&cUsage: /changepassword <oldPassword> <newPassword>'
|
||||
name_len: '&4Your username is either too short or too long!'
|
||||
regex: '&4Your username contains illegal characters. Allowed chars: REG_EX'
|
||||
add_email: '&3Please add your email to your account with the command "/email add <yourEmail> <confirmEmail>"'
|
||||
recovery_email: '&3Forgot your password? Please use the command "/email recovery <yourEmail>"'
|
||||
usage_captcha: '&3To login you have to solve a captcha code, please use the command "/captcha <theCaptcha>"'
|
||||
wrong_captcha: '&cWrong Captcha, please type "/captcha THE_CAPTCHA" into the chat!'
|
||||
valid_captcha: '&2Captcha code solved correctly!'
|
||||
kick_forvip: '&3A VIP Player has joined the server when it was full!'
|
||||
kick_fullserver: '&4The server is full, try again later!'
|
||||
usage_email_add: '&cUsage: /email add <email> <confirmEmail>'
|
||||
usage_email_change: '&cUsage: /email change <oldEmail> <newEmail>'
|
||||
usage_email_recovery: '&cUsage: /email recovery <Email>'
|
||||
new_email_invalid: '&cInvalid New Email, try again!'
|
||||
old_email_invalid: '&cInvalid Old Email, try again!'
|
||||
email_invalid: '&cInvalid Email address, try again!'
|
||||
email_added: '&2Email address successfully added to your account!'
|
||||
email_confirm: '&cPlease confirm your email address!'
|
||||
email_changed: '&2Email address changed correctly!'
|
||||
email_send: '&2Recovery email sent correctly! Check your email inbox!'
|
||||
email_exists: '&cA recovery email was already sent! You can discart it and send a new one using the command below:'
|
||||
country_banned: '&4Your country is banned from this server!'
|
||||
antibot_auto_enabled: '&4[AntiBotService] AntiBot enabled due to the huge number of connections!'
|
||||
antibot_auto_disabled: '&2[AntiBotService] AntiBot disabled disabled after %m minutes!'
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user