clean up and fix some bug...

Signed-off-by: 502647092 <jtb1@163.com>
master
502647092 2015-10-29 13:42:07 +08:00
parent 67ceb59f05
commit 961d37a375
7 changed files with 85 additions and 72 deletions

View File

@ -319,6 +319,10 @@ public class AuthMe extends JavaPlugin {
} catch (final Exception e) {
ConsoleLogger.writeStackTrace(e);
ConsoleLogger.showError("无法载入配置文件... 某些配置是错误的, 为了安全考虑 服务器即将关闭!");
try {
Thread.sleep(3000);
} catch (final InterruptedException e1) {
}
server.shutdown();
return;
}
@ -343,6 +347,7 @@ public class AuthMe extends JavaPlugin {
} catch (ClassNotFoundException | NoClassDefFoundError e) {
ConsoleLogger.info("You're using Minecraft 1.6.x or older, Log4J support will be disabled");
}
ConsoleLogger.info("已开启密码安全替换 控制台将不会记录密码相关数据...");
}
// AntiBot delay
@ -405,6 +410,7 @@ public class AuthMe extends JavaPlugin {
// Bungeecord hook
if (Settings.bungee) {
ConsoleLogger.info("已启用 BungeeCord 数据转发...");
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
Bukkit.getMessenger().registerIncomingPluginChannel(this, "BungeeCord", new BungeeCordMessage(this));
}
@ -464,10 +470,10 @@ public class AuthMe extends JavaPlugin {
// Configuration Security Warnings
if (!Settings.isForceSingleSessionEnabled) {
ConsoleLogger.showError("WARNING!!! 你关闭了单点登录保护 玩家帐号可能被顶下线!");
ConsoleLogger.showError("警告!!! 你关闭了单点登录保护 玩家帐号可能被顶下线!");
}
if (Settings.getSessionTimeout == 0 && Settings.isSessionsEnabled) {
ConsoleLogger.showError("WARNING!!! 你配置了Session超时为0 请注意账户的安全问题!");
ConsoleLogger.showError("警告!!! 你配置了Session超时为0 请注意账户的安全问题!");
}
// Successful message
@ -602,6 +608,10 @@ public class AuthMe extends JavaPlugin {
} else {
server.getPluginManager().disablePlugin(AuthMe.getInstance());
}
try {
Thread.sleep(3000);
} catch (final InterruptedException e1) {
}
}
// Show the exception message and stop/unload the server/plugin as defined
@ -631,7 +641,7 @@ public class AuthMe extends JavaPlugin {
if (cleared.isEmpty()) {
return;
}
ConsoleLogger.info("自动清理数据库: " + cleared.size() + " 个账户已清理!");
ConsoleLogger.info("自动清理数据库: 移除 " + cleared.size() + " 个 AuthMe 账户");
if (Settings.purgeEssentialsFile && this.ess != null) {
dataManager.purgeEssentials(cleared); // name to UUID convertion
}
@ -646,8 +656,7 @@ public class AuthMe extends JavaPlugin {
if (Settings.purgeAntiXray) {
dataManager.purgeAntiXray(cleared); // IDK if it uses UUID or
}
// names... (Actually it purges
// only names!)
// names... (Actually it purges only names!)
if (Settings.purgePermissions) {
dataManager.purgePermissions(cleared, permission);
}

View File

@ -13,21 +13,24 @@ public class ConsoleFilter implements Filter {
}
@Override
public boolean isLoggable(LogRecord record) {
public boolean isLoggable(final LogRecord record) {
try {
if (record == null || record.getMessage() == null)
if (record == null || record.getMessage() == null) {
return true;
String logM = record.getMessage().toLowerCase();
if (!logM.contains("issued server command:"))
}
final String logM = record.getMessage().toLowerCase();
if (!logM.contains("issued server command:")) {
return true;
}
if (!logM.contains("/login ") && !logM.contains("/l ") && !logM.contains("/reg ") && !logM.contains("/changepassword ") && !logM.contains("/unregister ")
&& !logM.contains("/authme register ") && !logM.contains("/authme changepassword ") && !logM.contains("/authme reg ") && !logM.contains("/authme cp ")
&& !logM.contains("/register "))
&& !logM.contains("/register ")) {
return true;
String playername = record.getMessage().split(" ")[0];
}
final String playername = record.getMessage().split(" ")[0];
record.setMessage(playername + " issued an AuthMe command!");
return true;
} catch (NullPointerException npe) {
} catch (final NullPointerException npe) {
return true;
}
}

View File

@ -75,13 +75,12 @@ public class PerformBackup {
final File dirBackup = new File(AuthMe.getInstance().getDataFolder() + "/backups");
if (!dirBackup.exists()) {
dirBackup.mkdir();
dirBackup.mkdirs();
}
try {
copy(new File("plugins" + File.separator + "AuthMe" + File.separator + backend), new File(path + ".db"));
return true;
} catch (final Exception ex) {
ex.printStackTrace();
}
@ -101,10 +100,10 @@ public class PerformBackup {
runtimeProcess = Runtime.getRuntime().exec(executeCmd);
final int processComplete = runtimeProcess.waitFor();
if (processComplete == 0) {
ConsoleLogger.info("Backup created successfully.");
ConsoleLogger.info("备份创建成功.");
return true;
} else {
ConsoleLogger.showError("Could not create the backup!");
ConsoleLogger.showError("无法创建备份!");
}
} catch (final Exception ex) {
ex.printStackTrace();
@ -116,10 +115,10 @@ public class PerformBackup {
runtimeProcess = Runtime.getRuntime().exec(executeCmd);
final int processComplete = runtimeProcess.waitFor();
if (processComplete == 0) {
ConsoleLogger.info("Backup created successfully.");
ConsoleLogger.info("备份创建成功.");
return true;
} else {
ConsoleLogger.showError("Could not create the backup!");
ConsoleLogger.showError("无法创建备份!");
}
} catch (final Exception ex) {
ex.printStackTrace();

View File

@ -89,7 +89,7 @@ public class Utils {
if (lookupService != null) {
return true;
}
ConsoleLogger.info("从 CityCraft 的 Yum 源 下载IP缓存库...");
ConsoleLogger.info("[LICENSE] IP数据来自 CityCraft 的 Yum 源 原始数据来自 http://www.maxmind.com");
final File file = new File(Settings.APLUGIN_FOLDER, "GeoIP.dat");
try {
if (file.exists()) {
@ -98,6 +98,7 @@ public class Utils {
return true;
}
}
ConsoleLogger.info("从 CityCraft 的 Yum 源 下载IP缓存库...");
final String url = "http://citycraft.cn/downloads/authme/GeoIP.dat.gz";
final URL downloadUrl = new URL(url);
final URLConnection conn = downloadUrl.openConnection();

View File

@ -385,9 +385,11 @@ public class AuthMePlayerListener implements Listener {
}
if (!Settings.isMovementAllowed) {
if (!event.getFrom().getBlock().equals(event.getTo().getBlock())) {
event.setTo(event.getFrom());
}
final Location from = event.getFrom();
from.setPitch(event.getTo().getPitch());
from.setYaw(event.getTo().getYaw());
event.setTo(from);
return;
}
@ -397,7 +399,6 @@ public class AuthMePlayerListener implements Listener {
final int radius = Settings.getMovementRadius;
final Location spawn = plugin.getSpawnLocation(player);
if (spawn != null && spawn.getWorld() != null) {
if (!event.getPlayer().getWorld().equals(spawn.getWorld())) {
event.getPlayer().teleport(spawn);

View File

@ -1,57 +1,57 @@
unknown_user: '&f数据库里找不到此用户'
unsafe_spawn: '&f你退出服务器时的位置不安全,正在传送你到此世界的出生点'
not_logged_in: '&c你还未登录'
reg_voluntarily: '&f你可以在服务器里使用这个指令以注册“/register <密码> <再输入一次以确定密码>”'
usage_log: '&c正确用法“/login <密码>”'
wrong_pwd: '&c错误的密码'
unregistered: '&c成功删除此用户'
reg_disabled: '&c目前服务器暂时禁止注册请到服务器论坛以得到更多资讯'
valid_session: '&c欢迎回来已帮你自动登录到此服务器'
login: '&c已成功登录'
vb_nonActiv: '&f你的帐号还未激活请查看你的邮箱'
user_regged: '&c此用户已经在此服务器注册过'
usage_reg: '&c正确用法“/register <密码> <再输入一次以确定密码>”'
max_reg: '&f你不允许再为你的IP在服务器注册更多用户了'
unknown_user: '&f数据库里找不到此用户!'
unsafe_spawn: '&c你退出服务器时的位置不安全,正在传送你到此世界的出生点!'
not_logged_in: '&c你还未登录!'
reg_voluntarily: '&f你可以在服务器里使用这个指令以注册“/register <密码> <再输入一次以确定密码>”!'
usage_log: '&c正确用法“/login <密码>”!'
wrong_pwd: '&c错误的密码!'
unregistered: '&c成功删除此用户!'
reg_disabled: '&c目前服务器暂时禁止注册请到服务器论坛以得到更多资讯!'
valid_session: '&c欢迎回来已帮你自动登录到此服务器!'
login: '&c已成功登录!'
vb_nonActiv: '&f你的帐号还未激活请查看你的邮箱!'
user_regged: '&c此用户已经在此服务器注册过!'
usage_reg: '&c正确用法“/register <密码> <再输入一次以确定密码>”!'
max_reg: '&f你不允许再为你的IP在服务器注册更多用户了!'
password_error_nick: '&f你不能使用昵称当作密码!'
password_error_unsafe: '&f你不能使用不安全的密码!'
reg_email_msg: '&c请输入 "/register <邮箱> <确认电子邮件>"'
no_perm: '&c你没有此操作的权限'
reg_email_msg: '&c请输入 "/register <邮箱> <确认电子邮件>" !'
no_perm: '&c你没有此操作的权限!'
error: '&f发现错误请联系管理员!'
login_msg: '&c请输入“/login <密码>”以登录'
reg_msg: '&c请输入“/register <密码> <再输入一次以确定密码>”以注册'
usage_unreg: '&c正确用法“/unregister <密码>”'
pwd_changed: '&c密码已成功修改'
user_unknown: '&c此用户名还未注册过'
password_error: '&f两次输入的密码不相同'
invalid_session: '&f登陆数据异常请等待登陆结束'
reg_only: '&f只允许注册过的玩家进服请到http://example.com以注册'
logged_in: '&c你已经登陆过了'
logout: '&c已成功登出'
same_nick: '&f同样的用户名现在在线且已经登录了'
registered: '&c已成功注册'
pass_len: '&c你的密码没有达到要求'
login_msg: '&c请输入“/login <密码>”以登录!'
reg_msg: '&c请输入“/register <密码> <再输入一次以确定密码>”以注册!'
usage_unreg: '&c正确用法“/unregister <密码>”!'
pwd_changed: '&c密码已成功修改!'
user_unknown: '&c此用户名还未注册过!'
password_error: '&f两次输入的密码不相同!'
invalid_session: '&f登陆数据异常请等待登陆结束!'
reg_only: '&f只允许注册过的玩家进服请到http://example.com以注册!'
logged_in: '&c你已经登陆过了!'
logout: '&c已成功登出!'
same_nick: '&f同样的用户名现在在线且已经登录了!'
registered: '&c已成功注册!'
pass_len: '&c你的密码没有达到要求!'
reload: '&f配置以及数据已经重新加载完毕!'
timeout: '&f给你登录的时间已经过了'
usage_changepassword: '&f正确用法“/changepassword 旧密码 新密码”'
name_len: '&c你的用户名太短或者太长了'
regex: '&c你的用户名包含非法字母用户名里允许的字母: REG_EX'
add_email: '&c请输入“/email add <你的邮箱> <再输入一次以确认>”以把你的邮箱添加到此帐号'
recovery_email: '&c忘了你的密码请输入“/email recovery <你的邮箱>”'
usage_captcha: '&c正确用法/captcha <验证码>'
wrong_captcha: '&c错误的验证码请输入“/captcha <验证码>”'
valid_captcha: '&c你的验证码是有效的'
timeout: '&f给你登录的时间已经过了!'
usage_changepassword: '&f正确用法“/changepassword 旧密码 新密码”!'
name_len: '&c你的用户名太短或者太长了!'
regex: '&c你的用户名包含非法字母用户名里允许的字母: REG_EX !'
add_email: '&c请输入“/email add <你的邮箱> <再输入一次以确认>”以把你的邮箱添加到此帐号!'
recovery_email: '&c忘了你的密码请输入“/email recovery <你的邮箱>”!'
usage_captcha: '&c正确用法/captcha <验证码> !'
wrong_captcha: '&c错误的验证码请输入“/captcha <验证码>”!'
valid_captcha: '&c你的验证码是有效的!'
kick_forvip: '&c有VIP玩家加入了已满的服务器 您被踢出了服务器!'
kick_fullserver: '&c抱歉服务器已满!'
usage_email_add: '&f用法: /email add <邮箱> <确认电子邮件> '
usage_email_change: '&f用法: /email change <旧邮箱> <新邮箱> '
usage_email_recovery: '&f用法: /email recovery <邮箱>'
usage_email_add: '&f用法: /email add <邮箱> <确认电子邮件> !'
usage_email_change: '&f用法: /email change <旧邮箱> <新邮箱> !'
usage_email_recovery: '&f用法: /email recovery <邮箱> !'
new_email_invalid: '&f新邮箱无效!'
old_email_invalid: '&f旧邮箱无效!'
email_invalid: '&f无效的邮箱'
email_added: '&f邮箱已添加 !'
email_confirm: '&f确认你的邮箱 !'
email_changed: '&f邮箱已改变 !'
email_send: '&f恢复邮件已发送 !'
country_banned: '&f这个服务器禁止该国家登陆 !'
antibot_auto_enabled: '[AuthMe] 防机器人程序由于大量异常连接而启用'
antibot_auto_disabled: '[AuthMe] 防机器人程序由于异常连接减少而在 %m 分钟后停止'
email_invalid: '&f无效的邮箱!'
email_added: '&f邮箱已添加!'
email_confirm: '&f确认你的邮箱!'
email_changed: '&f邮箱已改变!'
email_send: '&f恢复邮件已发送!'
country_banned: '&f这个服务器禁止该国家登陆!'
antibot_auto_enabled: '[AuthMe] 防机器人程序由于大量异常连接而启用!'
antibot_auto_disabled: '[AuthMe] 防机器人程序由于异常连接减少而在 %m 分钟后停止!'