From d812735d72b960941a1a89750a0fd55bfe576b86 Mon Sep 17 00:00:00 2001 From: Loyisa Date: Mon, 19 Dec 2022 15:54:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=A3=E7=BF=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 20 +-- .../net/md_5/bungee/BungeeCordLauncher.java | 2 +- .../java/ru/leymooo/botfilter/BotFilter.java | 22 +-- .../leymooo/botfilter/BotFilterCommand.java | 23 +-- .../ru/leymooo/botfilter/BotFilterThread.java | 4 +- .../java/ru/leymooo/botfilter/Connector.java | 24 +-- .../botfilter/caching/PacketUtils.java | 8 +- .../botfilter/captcha/CaptchaGeneration.java | 6 +- .../ru/leymooo/botfilter/config/Settings.java | 160 +++++++++--------- .../leymooo/botfilter/utils/FailedUtils.java | 2 +- .../botfilter/utils/FakeOnlineUtils.java | 2 +- .../ru/leymooo/botfilter/utils/GeoIp.java | 12 +- .../java/ru/leymooo/botfilter/utils/Sql.java | 22 +-- 13 files changed, 154 insertions(+), 153 deletions(-) diff --git a/README.md b/README.md index 1720416b8c..67fe623e36 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,19 @@ -BungeeCord with built in AntiBot protection. (English lang) +BungeeCord, 但是内置反假人. (Simplified Chinese) ========== -Videos +视频演示 -------- -Captcha+Falling check: +验证码+重力检查: [![Only captcha](https://i.ytimg.com/vi/S27EbttIG-8/1.jpg)](https://youtu.be/S27EbttIG-8) -Falling check: +重力检查: [![Only captcha](https://i.ytimg.com/vi/23O16oJyvl8/1.jpg)](https://youtu.be/23O16oJyvl8) -Download +下载 -------- -You can download this protection at [Releases](https://github.com/LoyisaSUS/BungeeCord-BotFilter-ENG/releases/) +你可以在[Releases](https://github.com/LoyisaSUS/BungeeCord-BotFilter-ZHCN/releases/) 下载 -Credit +特别鸣谢 -------- -[Leymooo](https://github.com/Leymooo) (Original BotFilter developer)
-[koloslolya](https://github.com/SleepyKolosLolya) (Help me translate BotFilter)
-[Maxsimuss](https://github.com/Maxsimuss) (Help me translate BotFilter) \ No newline at end of file +[Leymooo](https://github.com/Leymooo) (BotFilter 开发者)
+[koloslolya](https://github.com/SleepyKolosLolya) (帮助了我翻译 BotFilter (俄->英))
+[Maxsimuss](https://github.com/Maxsimuss) (帮助了我翻译 BotFilter (俄->英))
\ No newline at end of file diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCordLauncher.java b/proxy/src/main/java/net/md_5/bungee/BungeeCordLauncher.java index 81fce0c9c8..a247ac3a74 100644 --- a/proxy/src/main/java/net/md_5/bungee/BungeeCordLauncher.java +++ b/proxy/src/main/java/net/md_5/bungee/BungeeCordLauncher.java @@ -45,7 +45,7 @@ public static void main(String[] args) throws Exception BungeeCord bungee = new BungeeCord(); ProxyServer.setInstance( bungee ); - bungee.getLogger().log( Level.WARNING, "Enabled BungeeCord BotFilter-ENG {0} from https://github.com/LoyisaSUS/BungeeCord-BotFilter-ENG", bungee.getGameVersion() ); //BotFilter + bungee.getLogger().log( Level.WARNING, "Enabled BungeeCord BotFilter-ZHCN {0} from https://github.com/LoyisaSUS/BungeeCord-BotFilter-ZHCN", bungee.getGameVersion() ); //BotFilter bungee.start(); if ( !options.has( "noconsole" ) ) diff --git a/proxy/src/main/java/ru/leymooo/botfilter/BotFilter.java b/proxy/src/main/java/ru/leymooo/botfilter/BotFilter.java index 6e292f37d0..97612e1201 100644 --- a/proxy/src/main/java/ru/leymooo/botfilter/BotFilter.java +++ b/proxy/src/main/java/ru/leymooo/botfilter/BotFilter.java @@ -103,7 +103,7 @@ public void disable() { if ( connector.getUserConnection() != null ) { - connector.getUserConnection().disconnect( "§c[BotFilter] §aFilter reloading..." ); + connector.getUserConnection().disconnect( "§c[BotFilter] §a重载反假人模块中..." ); } connector.setState( CheckState.FAILED ); } @@ -351,7 +351,7 @@ public void checkAsyncIfNeeded(InitialHandler handler) if ( !Settings.IMP.PROTECTION.ALWAYS_CHECK && ManyChecksUtils.isManyChecks( address ) ) { PacketUtils.kickPlayer( KickType.MANYCHECKS, Protocol.LOGIN, ch, version ); - bungee.getLogger().log( Level.INFO, "(BF) [{0}] disconnected: Too many checks in 10 min", address ); + bungee.getLogger().log( Level.INFO, "(BF) [{0}] 已断开: 玩家在10分钟之内数次未通过验证", address ); return; } @@ -359,7 +359,7 @@ public void checkAsyncIfNeeded(InitialHandler handler) if ( ping.needCheck() && ping.needKickOrRemove( address ) ) { PacketUtils.kickPlayer( KickType.PING, Protocol.LOGIN, ch, version ); - bungee.getLogger().log( Level.INFO, "(BF) [{0}] disconnected: The player did not ping the server", address.getHostAddress() ); + bungee.getLogger().log( Level.INFO, "(BF) [{0}] 已断开: 玩家没有ping过服务器", address.getHostAddress() ); return; } @@ -377,7 +377,7 @@ public void checkAsyncIfNeeded(InitialHandler handler) if ( checkGeoIp( address ) ) { PacketUtils.kickPlayer( KickType.COUNTRY, Protocol.LOGIN, ch, version ); - bungee.getLogger().log( Level.INFO, "(BF) [{0}] disconnected: Country is not allowed", + bungee.getLogger().log( Level.INFO, "(BF) [{0}] 已断开: 不允许的国家", address.getHostAddress() ); return; } @@ -414,8 +414,8 @@ private void checkForUpdates(boolean startup) Logger logger = BungeeCord.getInstance().getLogger(); try { - logger.log( Level.INFO, "[BotFilter] Checking for updates..." ); - URL url = new URL( "https://raw.githubusercontent.com/LoyisaSUS/BungeeCord-BotFilter-ENG/master/version.txt" ); + logger.log( Level.INFO, "[BotFilter] 检查更新中..." ); + URL url = new URL( "https://raw.githubusercontent.com/LoyisaSUS/BungeeCord-BotFilter-ZHCN/master/version.txt" ); URLConnection conn = url.openConnection(); conn.setConnectTimeout( 1200 ); conn.setReadTimeout( 1200 ); @@ -425,21 +425,21 @@ private void checkForUpdates(boolean startup) if ( !in.readLine().trim().equalsIgnoreCase( Settings.IMP.BOT_FILTER_VERSION ) ) { - logger.log( Level.INFO, "§c[BotFilter] §aNew update available!" ); - logger.log( Level.INFO, "§c[BotFilter] §aPlease update to latest version!" ); - logger.log( Level.INFO, "§c[BotFilter] §ahttps://github.com/LoyisaSUS/BungeeCord-BotFilter-ENG/releases/" ); + logger.log( Level.INFO, "§c[BotFilter] §a有新的更新可用!" ); + logger.log( Level.INFO, "§c[BotFilter] §a请更新到最新版本!" ); + logger.log( Level.INFO, "§c[BotFilter] §ahttps://github.com/LoyisaSUS/BungeeCord-BotFilter-ZHCN/releases/" ); if ( startup ) { Thread.sleep( 3500L ); } } else { - logger.log( Level.INFO, "[BotFilter] You are using the latest version!" ); + logger.log( Level.INFO, "[BotFilter] 你正在使用最新的版本!" ); } } } catch ( IOException | InterruptedException ex ) { - logger.log( Level.WARNING, "[BotFilter] Can't check the update", ex ); + logger.log( Level.WARNING, "[BotFilter] 无法检查更新", ex ); } } diff --git a/proxy/src/main/java/ru/leymooo/botfilter/BotFilterCommand.java b/proxy/src/main/java/ru/leymooo/botfilter/BotFilterCommand.java index 351d49c63e..3c3376f863 100644 --- a/proxy/src/main/java/ru/leymooo/botfilter/BotFilterCommand.java +++ b/proxy/src/main/java/ru/leymooo/botfilter/BotFilterCommand.java @@ -35,30 +35,30 @@ public void execute(CommandSender sender, String[] args) if ( args.length == 0 ) { sender.sendMessage( "§r--------------- §bBotFilter §cv" + Settings.IMP.BOT_FILTER_VERSION + "§r-----------------" ); - sender.sendMessage( "§r> §lbotfilter reload §6- §aReload the configuration" ); - sender.sendMessage( "§r> §lbotfilter stat §6- §aShow statistics" ); - sender.sendMessage( "§r> §lbotfilter export §6- §aExport player list what passed the bot filter" ); - sender.sendMessage( "§r> §lbotfilter protection on/off §6- §aEnable or disable manual mode 'under attack'" ); + sender.sendMessage( "§r> §lbotfilter reload §6- §a重载配置文件" ); + sender.sendMessage( "§r> §lbotfilter stat §6- §a显示统计数据" ); + sender.sendMessage( "§r> §lbotfilter export §6- §a导出通过假人验证的玩家列表" ); + sender.sendMessage( "§r> §lbotfilter protection on/off §6- §a手动启用或禁用'受到攻击'模式" ); sender.sendMessage( "§r--------------- §bBotFilter §r-----------------" ); } else if ( args[0].equalsIgnoreCase( "reload" ) ) { BungeeCord.getInstance().getBotFilter().disable(); BungeeCord.getInstance().setBotFilter( new BotFilter( false ) ); - sender.sendMessage( "§aCommand executed" ); + sender.sendMessage( "§a指令已执行" ); } else if ( args[0].equalsIgnoreCase( "stat" ) || args[0].equalsIgnoreCase( "stats" ) || args[0].equalsIgnoreCase( "info" ) ) { sendStat( sender ); } else if ( args[0].equalsIgnoreCase( "export" ) ) { export( sender, args ); - sender.sendMessage( "§aCommand executed" ); + sender.sendMessage( "§a指令已执行" ); } else if ( args[0].equalsIgnoreCase( "protection" ) ) { if ( args.length >= 2 ) { boolean enable = args[1].equalsIgnoreCase( "on" ); BungeeCord.getInstance().getBotFilter().setForceProtectionEnabled( enable ); - sender.sendMessage( "§aProtection " + ( enable ? "enabled" : "§cdisabled" ) ); + sender.sendMessage( "§a保护已 " + ( enable ? "启用" : "§c禁用" ) ); } } } @@ -67,11 +67,12 @@ private void sendStat(CommandSender sender) { BotFilter botFilter = BungeeCord.getInstance().getBotFilter(); sender.sendMessage( "§r----------------- §bBotFilter §cv" + Settings.IMP.BOT_FILTER_VERSION + " §r-----------------" ); - sender.sendMessage( "§r> §lUnder attack: " + ( botFilter.isUnderAttack() ? "§cYes" : "§aNo" ) ); - sender.sendMessage( "§r> §lBots on checking: " + botFilter.getOnlineOnFilter() ); - sender.sendMessage( "§r> §lVerified player(s): " + botFilter.getUsersCount() ); + sender.sendMessage( "§r> §l受到攻击: " + ( botFilter.isUnderAttack() ? "§cYes" : "§aNo" ) ); + sender.sendMessage( "§r> §l验证中的玩家/假人: " + botFilter.getOnlineOnFilter() ); + sender.sendMessage( "§r> §l已通过验证的玩家: " + botFilter.getUsersCount() ); sender.sendMessage( "§r> §lDownload BotFilter(RUS): http://www.rubukkit.org/threads/137038/" ); - sender.sendMessage( "§r> §lDownload BotFilter(ENG): https://github.com/LoyisaSUS/BungeeCord/" ); + sender.sendMessage( "§r> §lDownload BotFilter(ENG): https://github.com/LoyisaSUS/BungeeCord-BotFilter-ENG" ); + sender.sendMessage( "§r> §l下载 BotFilter(简体中文): https://github.com/LoyisaSUS/BungeeCord-BotFilter-ZHCN" ); } private void export(CommandSender sender, String[] args) diff --git a/proxy/src/main/java/ru/leymooo/botfilter/BotFilterThread.java b/proxy/src/main/java/ru/leymooo/botfilter/BotFilterThread.java index 5bf0be28cb..c981b07241 100644 --- a/proxy/src/main/java/ru/leymooo/botfilter/BotFilterThread.java +++ b/proxy/src/main/java/ru/leymooo/botfilter/BotFilterThread.java @@ -50,7 +50,7 @@ public static void start() if ( ( currTime - connector.getJoinTime() ) >= Settings.IMP.TIME_OUT ) { connector.failed( KickType.TIMED_OUT, state == BotFilter.CheckState.CAPTCHA_ON_POSITION_FAILED - ? "Too long fall check" : "Captcha not entered" ); + ? "重力检查超时" : "未输入验证码" ); TO_REMOVE_SET.add( entryset.getKey() ); continue; } else if ( state == BotFilter.CheckState.CAPTCHA_ON_POSITION_FAILED || state == BotFilter.CheckState.ONLY_POSITION ) @@ -66,7 +66,7 @@ public static void start() } catch ( Exception e ) { - bungee.getLogger().log( Level.WARNING, "[BotFilter] Unknown error. Please report it to the developer!", e ); + bungee.getLogger().log( Level.WARNING, "[BotFilter] 未知错误. 请向开发者报告!", e ); } finally { if ( !TO_REMOVE_SET.isEmpty() ) diff --git a/proxy/src/main/java/ru/leymooo/botfilter/Connector.java b/proxy/src/main/java/ru/leymooo/botfilter/Connector.java index 8283d3196b..a5069884fa 100644 --- a/proxy/src/main/java/ru/leymooo/botfilter/Connector.java +++ b/proxy/src/main/java/ru/leymooo/botfilter/Connector.java @@ -104,7 +104,7 @@ public void spawn() PacketUtils.titles[1].writeTitle( channel, version ); } sendPing(); - LOGGER.log( Level.INFO, toString() + " has connected" ); + LOGGER.log( Level.INFO, toString() + " 已连接" ); } @@ -128,7 +128,7 @@ public void handle(PacketWrapper packet) throws Exception //There are no unknown packets which player will send and will be longer than 2048 bytes during check if ( packet.packet == null && packet.buf.readableBytes() > 2048 ) { - failed( KickType.BIG_PACKET, "Sent packet larger than 2048 bytes (" + packet.buf.readableBytes() + ")" ); + failed( KickType.BIG_PACKET, "发送的数据包大于2048字节 (" + packet.buf.readableBytes() + ")" ); } } @@ -140,7 +140,7 @@ public void disconnected(ChannelWrapper channel) throws Exception case ONLY_CAPTCHA: case ONLY_POSITION: case CAPTCHA_POSITION: - String info = "(BF) [" + name + "|" + ip + "] left from server during check"; + String info = "(BF) [" + name + "|" + ip + "] 在验证时退出了服务器"; LOGGER.log( Level.INFO, info ); FailedUtils.addIpToQueue( ip, KickType.LEAVED ); break; @@ -176,7 +176,7 @@ public void completeCheck() changeStateToCaptcha(); } else { - failed( KickType.FAILED_FALLING, "Too fast check passed" ); + failed( KickType.FAILED_FALLING, "过快的通过验证" ); } } return; @@ -184,7 +184,7 @@ public void completeCheck() int devide = lastSend == 0 ? sentPings : sentPings - 1; if ( botFilter.checkBigPing( totalping / ( devide <= 0 ? 1 : devide ) ) ) { - failed( KickType.PING, "Big ping" ); + failed( KickType.PING, "延迟过高" ); return; } state = CheckState.SUCCESSFULLY; @@ -201,7 +201,7 @@ public void completeCheck() userConnection.setNeedLogin( false ); userConnection.getPendingConnection().finishLogin( userConnection, true ); markDisconnected = true; - LOGGER.log( Level.INFO, "[BotFilter] Player (" + name + "|" + ip + ") passed verification successfully" ); + LOGGER.log( Level.INFO, "[BotFilter] 玩家 (" + name + "|" + ip + ") 成功地通过了验证" ); } @Override @@ -227,7 +227,7 @@ public void onMove() changeStateToCaptcha(); } else { - failed( KickType.FAILED_FALLING, "Failed position check" ); + failed( KickType.FAILED_FALLING, "重力检查失败" ); } return; } @@ -281,7 +281,7 @@ private void handleChat(String message) { if ( message.length() > 256 ) { - failed( KickType.FAILED_CAPTCHA, "Too long message" ); + failed( KickType.FAILED_CAPTCHA, "消息过长" ); return; } if ( message.replace( "/", "" ).equals( captchaAnswer ) ) @@ -293,7 +293,7 @@ private void handleChat(String message) sendCaptcha(); } else { - failed( KickType.FAILED_CAPTCHA, "Failed captcha check" ); + failed( KickType.FAILED_CAPTCHA, "验证码检查失败" ); } } } @@ -312,7 +312,7 @@ public void handle(KeepAlive keepAlive) throws Exception { if ( lastSend == 0 ) { - failed( KickType.PING, "Tried send fake ping" ); + failed( KickType.PING, "尝试发送虚假的 keepAlive 包" ); return; } long ping = System.currentTimeMillis() - lastSend; @@ -330,7 +330,7 @@ public void handle(PluginMessage pluginMessage) throws Exception if ( pluginMessagesBytes > MAX_PLUGIN_MESSAGES_BYTES ) { - failed( KickType.BIG_PACKET, "Bad PluginMessage's" ); + failed( KickType.BIG_PACKET, "错误的PluginMessage" ); return; } @@ -384,7 +384,7 @@ public void failed(KickType type, String kickMessage) state = CheckState.FAILED; PacketUtils.kickPlayer( type, Protocol.GAME, userConnection.getCh(), version ); markDisconnected = true; - LOGGER.log( Level.INFO, "(BF) [" + name + "|" + ip + "] check failed: " + kickMessage ); + LOGGER.log( Level.INFO, "(BF) [" + name + "|" + ip + "] 验证失败: " + kickMessage ); if ( type != KickType.BIG_PACKET ) { FailedUtils.addIpToQueue( ip, type ); diff --git a/proxy/src/main/java/ru/leymooo/botfilter/caching/PacketUtils.java b/proxy/src/main/java/ru/leymooo/botfilter/caching/PacketUtils.java index 35c6722949..7c3af4fae2 100644 --- a/proxy/src/main/java/ru/leymooo/botfilter/caching/PacketUtils.java +++ b/proxy/src/main/java/ru/leymooo/botfilter/caching/PacketUtils.java @@ -135,8 +135,8 @@ public static void init() messages = new CachedMessage[] { - new CachedMessage( Settings.IMP.MESSAGES.CHECKING_CAPTCHA_WRONG.replaceFirst( "%s", "2" ).replaceFirst( "%s", "chances" ) ), - new CachedMessage( Settings.IMP.MESSAGES.CHECKING_CAPTCHA_WRONG.replaceFirst( "%s", "1" ).replaceFirst( "%s", "chances" ) ), + new CachedMessage( Settings.IMP.MESSAGES.CHECKING_CAPTCHA_WRONG.replaceFirst( "%s", "2" ).replaceFirst( "%s", "次" ) ), + new CachedMessage( Settings.IMP.MESSAGES.CHECKING_CAPTCHA_WRONG.replaceFirst( "%s", "1" ).replaceFirst( "%s", "次" ) ), new CachedMessage( Settings.IMP.MESSAGES.CHECKING ), new CachedMessage( Settings.IMP.MESSAGES.CHECKING_CAPTCHA ), new CachedMessage( Settings.IMP.MESSAGES.SUCCESSFULLY ) @@ -152,7 +152,7 @@ public static void init() kickMessagesGame.put( KickType.FAILED_FALLING, failedMessage ); kickMessagesGame.put( KickType.TIMED_OUT, failedMessage ); kickMessagesGame.put( KickType.COUNTRY, new CachedPacket( createKickPacket( Settings.IMP.MESSAGES.KICK_COUNTRY ), kickGame ) ); - kickMessagesGame.put( KickType.BIG_PACKET, new CachedPacket( createKickPacket( "§cFailed while checking. Please report it to the administration. (Big packet was sent)" ), kickGame ) ); + kickMessagesGame.put( KickType.BIG_PACKET, new CachedPacket( createKickPacket( "§c验证失败。请向服务器管理员报告。(数据包大小异常)" ), kickGame ) ); kickMessagesLogin.put( KickType.PING, new CachedPacket( createKickPacket( String.join( "", Settings.IMP.SERVER_PING_CHECK.KICK_MESSAGE ) ), kickLogin ) ); kickMessagesLogin.put( KickType.MANYCHECKS, new CachedPacket( createKickPacket( Settings.IMP.MESSAGES.KICK_MANY_CHECKS ), kickLogin ) ); kickMessagesLogin.put( KickType.COUNTRY, new CachedPacket( createKickPacket( Settings.IMP.MESSAGES.KICK_COUNTRY ), kickLogin ) ); @@ -253,7 +253,7 @@ public static int rewriteVersion(int version) int rewritten = VERSION_REWRITE[version]; if ( rewritten == -1 ) { - throw new IllegalArgumentException( "Version is not supported" ); + throw new IllegalArgumentException( "不支持的版本" ); } return rewritten; } diff --git a/proxy/src/main/java/ru/leymooo/botfilter/captcha/CaptchaGeneration.java b/proxy/src/main/java/ru/leymooo/botfilter/captcha/CaptchaGeneration.java index b44049b269..dfac778250 100644 --- a/proxy/src/main/java/ru/leymooo/botfilter/captcha/CaptchaGeneration.java +++ b/proxy/src/main/java/ru/leymooo/botfilter/captcha/CaptchaGeneration.java @@ -54,13 +54,13 @@ public void generateImages() ThreadPoolExecutor ex = (ThreadPoolExecutor) executor; while ( ex.getActiveCount() != 0 ) { - BungeeCord.getInstance().getLogger().log( Level.INFO, "[BotFilter] Generating Captcha... [{0}/900]", 900 - ex.getQueue().size() - ex.getActiveCount() ); + BungeeCord.getInstance().getLogger().log( Level.INFO, "[BotFilter] 生成验证码中... [{0}/900]", 900 - ex.getQueue().size() - ex.getActiveCount() ); try { Thread.sleep( 1000L ); } catch ( InterruptedException ex1 ) { - BungeeCord.getInstance().getLogger().log( Level.WARNING, "[BotFilter] Can't generate the Captcha. Shutting down...", ex1 ); + BungeeCord.getInstance().getLogger().log( Level.WARNING, "[BotFilter] 生成验证码失败! 关闭中...", ex1 ); System.exit( 0 ); return; } @@ -68,7 +68,7 @@ public void generateImages() CachedCaptcha.generated = true; executor.shutdownNow(); System.gc(); - BungeeCord.getInstance().getLogger().log( Level.INFO, "[BotFilter] Captcha was generated in {0} ms", System.currentTimeMillis() - start ); + BungeeCord.getInstance().getLogger().log( Level.INFO, "[BotFilter] 验证码生成成功! 耗时: {0} ms", System.currentTimeMillis() - start ); } diff --git a/proxy/src/main/java/ru/leymooo/botfilter/config/Settings.java b/proxy/src/main/java/ru/leymooo/botfilter/config/Settings.java index 5d2d90cf17..576f842ccc 100644 --- a/proxy/src/main/java/ru/leymooo/botfilter/config/Settings.java +++ b/proxy/src/main/java/ru/leymooo/botfilter/config/Settings.java @@ -13,7 +13,7 @@ public class Settings extends Config @Comment( { - "Please submit all errors, bugs, suggestions and other requests on github " + "请在github上提交所有错误、bug、建议和其他请求 " }) @Final public final String ISSUES = "https://github.com/Leymooo/BungeeCord/issues"; @@ -38,23 +38,23 @@ public class Settings extends Config public SQL SQL; @Comment( { - "How many players / bots should join in a minute, to enable the protection", - "Recommended settings without advertising: ", - "Under 150 players - 25, under 250 - 30, under 350 - 35, under 550 - 40,45, higher - adjust for yourself ", - "During advertising or when just-just setted up the protection, it is recommended to set high these valu. es" + "当1分钟内有多少玩家/假人进入服务器时,自动启用保护", + "无推广/活动时的推荐数值: ", + "低于150名玩家 - 25, 低于250 - 30, 低于350 - 35, 低于550 - 40,45, 更多玩家 - 自行调整 ", + "在推广/活动时期或刚设置保护的时候, 推荐将这些数值调高" }) public int PROTECTION_THRESHOLD = 30; - @Comment("How long is automatic protection active? In milliseconds. 1 second = 1000") + @Comment("自动保护的持续时间, 以毫秒为单位. 1秒=1000毫秒") public int PROTECTION_TIME = 120000; - @Comment("Whether to force check the bot when joining the server during a bot attack, no matter whether the check is passed or not") + @Comment("在被假人攻击时, 进入服务器是否强制检查. 不论通过与否, 都会被强制检查") public boolean FORCE_CHECK_ON_ATTACK = true; - @Comment("Should we show the player count from the filter?") + @Comment("是否在在线人数上加上在过滤器中(验证中)的玩家?") public boolean SHOW_ONLINE = true; - @Comment("How much time does the player have to pass the verification. In milliseconds. 1 second = 1000") + @Comment("玩家必须在多少时间内完成验证, 以毫秒为单位. 1秒=1000毫秒") public int TIME_OUT = 12700; - @Comment("Enable fix for 'Team 'xxx' already exist in this scoreboard'") + @Comment("是否启用客户端 'Team 'xxx' already exist in this scoreboard' 报错的修复?") public boolean FIX_SCOREBOARD_TEAMS = true; - @Comment("Should the IP addresses of the players / bots who failed the verification be logged to a file?") + @Comment("是否将未通过验证的玩家/假人的IP记录到文件中?") public boolean SAVE_FAILED_IPS_TO_FILE = true; public void reload(File file) @@ -63,117 +63,117 @@ public void reload(File file) save( file ); } - @Comment("Please don't use '\\n', use %nl%") + @Comment("请勿使用 '\\n' 来换行, 用 %nl% 替代") public static class MESSAGES { public String PREFIX = "&b&lBot&d&lFilter"; - public String CHECKING = "%prefix%&7>> &aPlease wait for verification to complete..."; - public String CHECKING_CAPTCHA = "%prefix%&7>> &aEnter the number from the image into the chat"; - public String CHECKING_CAPTCHA_WRONG = "%prefix%&7>> &cYou entered the captcha incorrectly, please try again. You have &a%s &c%s"; - public String SUCCESSFULLY = "%prefix%&7>> &aVerification passed"; - public String KICK_MANY_CHECKS = "%prefix%%nl%%nl%&cWe have detected suspicious activity from your ip address%nl%%nl%&6Please try again in 10 minutes"; - public String KICK_NOT_PLAYER = "%prefix%%nl%%nl%&cYou did not pass the verification, maybe you are a bot%nl%&7&oIf that is not so, please try again"; - public String KICK_COUNTRY = "%prefix%%nl%%nl%&cYour country is banned from the server"; - public String KICK_BIG_PING = "%prefix%%nl%%nl%&cYour ping is very high, most likely you are a bot"; + public String CHECKING = "%prefix%&7>> &a请等待验证完成..."; + public String CHECKING_CAPTCHA = "%prefix%&7>> &a请在聊天栏中输入图片中的数字"; + public String CHECKING_CAPTCHA_WRONG = "%prefix%&7>> &c您输入的验证码错误, 请重试. 你还可以尝试 &a%s &c%s"; + public String SUCCESSFULLY = "%prefix%&7>> &a验证成功!"; + public String KICK_MANY_CHECKS = "%prefix%%nl%%nl%&c我们检测到了来自于你的IP地址的可疑活动%nl%%nl%&6请在10分钟后重试"; + public String KICK_NOT_PLAYER = "%prefix%%nl%%nl%&c你没有通过验证, 你是个假人吗?%nl%&7&o如果不是, 请重试"; + public String KICK_COUNTRY = "%prefix%%nl%%nl%&c您所在的国家被禁止进入服务器"; + public String KICK_BIG_PING = "%prefix%%nl%%nl%&c您的延迟过高, 请更换一个更好的网络"; @Comment( { - "Title%nl%Subtitle", "You can leave blank to disable the title (ex: CHECKING_TITLE = \"\") ", - "Disabling titles may slightly improve performance" + "标题%nl%副标题", "您可以留空以禁用标题 (例如: CHECKING_TITLE = \"\") ", + "禁用标题可能会略微提高性能" }) - public String CHECKING_TITLE = "&r&lBot&b&lFilter%nl%&aChecking..."; - public String CHECKING_TITLE_SUS = "&rVerification passed%nl%&aHave a good game"; - public String CHECKING_TITLE_CAPTCHA = " %nl%&rEnter the captcha into the chat!"; + public String CHECKING_TITLE = "&r&lBot&b&lFilter%nl%&a检查中..."; + public String CHECKING_TITLE_SUS = "&r验证通过%nl%&a祝您游戏愉快"; + public String CHECKING_TITLE_CAPTCHA = " %nl%&r请在聊天栏中输入验证码!"; } - @Comment("Enable or disable GeoIp") + @Comment("启用或禁用 GeoIp 检查") public static class GEO_IP { @Comment( { - "When does the check works", - "0 - Always", - "1 - Only during bot attacks", - "2 - Disable" + "在什么时候启用该检查?", + "0 - 总是", + "1 - 只在被假人攻击时", + "2 - 禁用" }) public int MODE = 1; @Comment( { - "How exactly does GeoIp work", - "0 - White list(Only those countries that are on the list can join)", - "1 - Black list(Only countries that are not on the list can join)" + "GeoIp的工作模式", + "0 - 白名单模式(只有在ALLOWED_COUNTRIES列表中的国家才能进入)", + "1 - 黑名单模式(只有不在ALLOWED_COUNTRIES列表中的国家才能进入)" }) public int TYPE = 0; @Comment( { - "Where to download GEOIP from", - "Change the link if for some reason it doesn't download from this one", - "The file must end in .mmdb or be packed into .tar.gz" + "从哪里下载GeoIp数据库?", + "如果该链接因为某些原因无法下载, 请更改它", + "文件必须以 .mmdb 结尾或打包成 .tar.gz" }) public String NEW_GEOIP_DOWNLOAD_URL = "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=%license_key%&suffix=tar.gz"; @Comment( { - "If the key stops working, you need to register at https://www.maxmind.com/", - "and generate a new key here https://www.maxmind.com/en/accounts/current/license-key" + "如果密钥失效, 你需要在 https://www.maxmind.com/ 注册一个账号", + "并在 https://www.maxmind.com/en/accounts/current/license-key 生成一个新的密钥" }) public String MAXMIND_LICENSE_KEY = "P5g0fVdAQIq8yQau"; - @Comment("Разрешённые странны") + @Comment("国家代码列表, 请参考 https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2") public List ALLOWED_COUNTRIES = Arrays.asList( "RU", "UA", "BY", "KZ", "EE", "MD", "KG", "AZ", "LT", "LV", "GE", "PL" ); } - @Comment("Enable or disable high ping check") + @Comment("启用或禁用高延迟检查") public static class PING_CHECK { @Comment( { - "When does the check works", - "0 - Always", - "1 - Only during bot attacks", - "2 - Disable" + "在什么时候启用该检查?", + "0 - 总是", + "1 - 只在被假人攻击时", + "2 - 禁用" }) public int MODE = 1; - @Comment("Maximum allowed ping") + @Comment("最大延迟") public int MAX_PING = 350; } - @Comment("Enable or disable Direct Connect check") + @Comment("启用或禁用直接连接检查") public static class SERVER_PING_CHECK { @Comment( { - "When the check works", - "0 - Always", - "1 - Only during bot attacks", - "2 - Disable", - "Disabled by default, because it is very unstable against strong attacks" + "在什么时候启用该检查?", + "0 - 总是", + "1 - 只在被假人攻击时", + "2 - 禁用", + "由于在面对强力攻击时不稳定, 此检查默认禁用" }) public int MODE = 2; - @Comment("When is it allowed to join the server after receiving server's motd") + @Comment("客户端接收到服务器MOTD后允许多少秒内进入服务器") public int CACHE_TIME = 12; public List KICK_MESSAGE = new ArrayList() { { add( "%nl%" ); add( "%nl%" ); - add( "&cYou've been kicked! Please don't use direct connection" ); + add( "&c你已被踢出! 请不要使用直接连接" ); add( "%nl%" ); add( "%nl%" ); - add( "&bTo join the server:" ); + add( "&b要进入服务器:" ); add( "%nl%" ); - add( "&71) &rAdd the server to the &lserver list." ); + add( "&71) &r将服务器添加到 &l服务器列表中." ); add( "%nl%" ); - add( "&lOur IP &8>> &b&lIP" ); + add( "&l我们的IP &8>> &b&lIP" ); add( "%nl%" ); add( "%nl%" ); - add( "&72) &rRefresh the server list. " ); + add( "&72) &r刷新服务器列表. " ); add( "%nl%" ); - add( "&oTo refresh it, click the &c&lRefresh&r button" ); + add( "&o要刷新服务器列表, 请点击 &c&l刷新&r 按钮" ); add( "%nl%" ); add( "%nl%" ); - add( "&73) &rWait &c1-3&r seconds and join the server!" ); + add( "&73) &r等待 &c1-3&r 秒后进入服务器!" ); } }; @@ -181,33 +181,33 @@ public static class SERVER_PING_CHECK @Comment( { - "Setting up exactly how the protection will work", - "0 - Only check with captcha", - "1 - Fall check + captcha", - "2 - Fall check, if it failed, then captcha" + "设置反假人保护的操作模式", + "0 - 验证码检查", + "1 - 重力检查 + 验证码检查", + "2 - 重力检查, 如果验证失败再进行验证码检查" }) public static class PROTECTION { - @Comment("Operation mode while there is no attack") + @Comment("无攻击时的操作模式") public int NORMAL = 2; - @Comment("Operation mode during the attack") + @Comment("被攻击时的操作模式") public int ON_ATTACK = 1; @Comment( { - "Enable constant checking of the players?", - "When enabling this feature, don't forget to set the protection-threshold value higher" + "是否总是检查玩家?", + "启用此功能时, 请不要忘记将 protection-threshold 的值设置得更高" }) public boolean ALWAYS_CHECK = false; @Comment( { - "Check players with ip 127.0.0.1?", "May be useful when using Geyser", - "0 - check", "1 - don't check", "2 - check every time" + "检查 ip 为 127.0.0.1 的玩家?", "使用 Geyser 时可能会有用", + "0 - 检查", "1 - 不检查", "2 - 总是检查" }) public int CHECK_LOCALHOST = 0; - @Comment("Disable check for Geyser-standalone clients? auth-type must be set to floodgate") + @Comment("禁用 Geyser-standalone 在无攻击时的检查? auth-type必须设置为 floodgate") public boolean SKIP_GEYSER = false; /* @Comment( @@ -222,33 +222,33 @@ public static class PROTECTION */ } - @Comment("Database configuration") + @Comment("数据库设置") public static class SQL { - @Comment("Database type. sqlite or mysql") + @Comment("数据库类型. sqlite或mysql") public String STORAGE_TYPE = "sqlite"; - @Comment("After how many days, remove players from the database who have passed the verification and never logged in again. 0 or less to disable it") + @Comment("从数据库内删除多少天内通过验证且没有再登录过的玩家. 将该值设置为0或更小的值以禁用该功能") public int PURGE_TIME = 14; - @Comment("Mysql configuration") + @Comment("MySQL配置") public String HOSTNAME = "127.0.0.1"; public int PORT = 3306; public String USER = "user"; public String PASSWORD = "password"; public String DATABASE = "database"; - @Comment("Interval in millieseconds. How often it will synchronize data bases if multibungee is used.") + @Comment("多久内同步一次数据库? 以毫秒为单位. 在使用多个BungeeCord时可能会有用") public int SYNC_INTERVAL = -1; } - @Comment("Virtual world settings") + @Comment("虚拟世界设置") public static class DIMENSIONS { @Comment( { - "Which world to use", - "0 - Standard world", - "1 - Nether", - "2 - End" + "使用哪个世界维度?", + "0 - 主世界", + "1 - 下界", + "2 - 末地" }) public int TYPE = 0; } diff --git a/proxy/src/main/java/ru/leymooo/botfilter/utils/FailedUtils.java b/proxy/src/main/java/ru/leymooo/botfilter/utils/FailedUtils.java index bfbdbdc161..737bc2af27 100644 --- a/proxy/src/main/java/ru/leymooo/botfilter/utils/FailedUtils.java +++ b/proxy/src/main/java/ru/leymooo/botfilter/utils/FailedUtils.java @@ -47,7 +47,7 @@ public void flushQueue() } } catch ( Exception e ) { - BungeeCord.getInstance().getLogger().log( Level.WARNING, "[BotFilter] Could not save failed ips to file", e ); + BungeeCord.getInstance().getLogger().log( Level.WARNING, "[BotFilter] 无法将未通过验证的ip保存到文件", e ); } } } diff --git a/proxy/src/main/java/ru/leymooo/botfilter/utils/FakeOnlineUtils.java b/proxy/src/main/java/ru/leymooo/botfilter/utils/FakeOnlineUtils.java index 9f174b9928..6674c6317f 100644 --- a/proxy/src/main/java/ru/leymooo/botfilter/utils/FakeOnlineUtils.java +++ b/proxy/src/main/java/ru/leymooo/botfilter/utils/FakeOnlineUtils.java @@ -28,7 +28,7 @@ public FakeOnlineUtils() multiple = Float.parseFloat( boost ); } catch ( NumberFormatException e ) { - BungeeCord.getInstance().getLogger().log( Level.WARNING, "[BotFilter] Can't enable fake online: {0}", e.getMessage() ); + BungeeCord.getInstance().getLogger().log( Level.WARNING, "[BotFilter] 无法启用虚拟玩家人数: {0}", e.getMessage() ); return; } enabled = true; diff --git a/proxy/src/main/java/ru/leymooo/botfilter/utils/GeoIp.java b/proxy/src/main/java/ru/leymooo/botfilter/utils/GeoIp.java index 1668343bc2..a74aa8264a 100644 --- a/proxy/src/main/java/ru/leymooo/botfilter/utils/GeoIp.java +++ b/proxy/src/main/java/ru/leymooo/botfilter/utils/GeoIp.java @@ -104,7 +104,7 @@ private void setupDataBase(boolean startup) reader = new DatabaseReader.Builder( file ).withCache( new CHMCache( 4096 * 4 ) ).build(); } catch ( IOException ex ) { - LOGGER.log( Level.WARNING, "[BotFilter] Cannot connect to GeoLite2 database. Redownloading...", ex ); + LOGGER.log( Level.WARNING, "[BotFilter] 无法连接到 GeoLite2 数据库. 正在重新下载...", ex ); file.delete(); setupDataBase( true ); } @@ -113,7 +113,7 @@ private void setupDataBase(boolean startup) private void downloadDataBase(final File out) { - LOGGER.log( Level.INFO, "[BotFilter] Downloading GeoLite2 database..." ); + LOGGER.log( Level.INFO, "[BotFilter] 正在下载 GeoLite2 数据库..." ); long start = System.currentTimeMillis(); try { @@ -141,7 +141,7 @@ private void downloadDataBase(final File out) } } else { - throw new IOException( "File type is not supported " ); + throw new IOException( "不支持的文件类型 " ); } } setupDataBase( true ); @@ -151,10 +151,10 @@ private void downloadDataBase(final File out) { setupDataBase( false ); } - LOGGER.log( Level.WARNING, "[BotFilter] Can't download GeoLite2 database", ex ); + LOGGER.log( Level.WARNING, "[BotFilter] 无法下载 GeoLite2 数据库", ex ); return; } - LOGGER.log( Level.INFO, "[BotFilter] GeoLite2 database loaded ({0}ms)", System.currentTimeMillis() - start ); + LOGGER.log( Level.INFO, "[BotFilter] 已加载 GeoLite2 数据库 ({0}ms)", System.currentTimeMillis() - start ); } private void saveToFile(InputStream stream, File out) throws IOException @@ -169,7 +169,7 @@ private void saveToFile(InputStream stream, File out) throws IOException { fis.close(); out.delete(); - LOGGER.log( Level.WARNING, "[BotFilter] Unable to download GeoLite2 database. Removing temp file..." ); + LOGGER.log( Level.WARNING, "[BotFilter] 无法下载 GeoLite2 数据库. 正在删除临时文件......" ); return; } fis.write( buffer, 0, count ); diff --git a/proxy/src/main/java/ru/leymooo/botfilter/utils/Sql.java b/proxy/src/main/java/ru/leymooo/botfilter/utils/Sql.java index 786bd5a737..da98ca1def 100644 --- a/proxy/src/main/java/ru/leymooo/botfilter/utils/Sql.java +++ b/proxy/src/main/java/ru/leymooo/botfilter/utils/Sql.java @@ -57,7 +57,7 @@ private void setupConnect() return; } this.connection = null; - logger.info( "[BotFilter] Connecting to the database..." ); + logger.info( "[BotFilter] 正在连接到数据库..." ); long start = System.currentTimeMillis(); if ( Settings.IMP.SQL.STORAGE_TYPE.equalsIgnoreCase( "mysql" ) ) { @@ -68,7 +68,7 @@ private void setupConnect() Class.forName( "org.sqlite.JDBC" ); connectToDatabase( "JDBC:sqlite:BotFilter/database.db", null, null ); } - logger.log( Level.INFO, "[BotFilter] Database connected ({0} ms)", System.currentTimeMillis() - start ); + logger.log( Level.INFO, "[BotFilter] 数据库已连接 ({0} ms)", System.currentTimeMillis() - start ); createTable(); alterLastJoinColumn(); clearOldUsers(); @@ -77,7 +77,7 @@ private void setupConnect() } catch ( SQLException | ClassNotFoundException e ) { executor.schedule( this::setupConnect, 5, TimeUnit.SECONDS ); - logger.log( Level.WARNING, "Can not connect to database or execute sql: ", e ); + logger.log( Level.WARNING, "无法连接数据库或执行sql: ", e ); if ( connection != null ) { Connection conn = connection; @@ -124,7 +124,7 @@ private void alterLastJoinColumn() } } catch ( Exception e ) { - logger.log( Level.WARNING, "[BotFilter] Error has occurred with adding a column to the table", e ); + logger.log( Level.WARNING, "[BotFilter] 向表中添加列时出错", e ); } } @@ -139,12 +139,12 @@ private void clearOldUsers() throws SQLException long until = calendar.getTimeInMillis(); int before = botFilter.getUsersCount(); botFilter.getUserCache().entrySet().removeIf( (entry) -> entry.getValue().getLastJoin() < until ); - logger.log( Level.INFO, "[BotFilter] Removed {0} accounts from memory", before - botFilter.getUsersCount() ); + logger.log( Level.INFO, "[BotFilter] 从内存中删除了 {0} 个玩家", before - botFilter.getUsersCount() ); if ( this.connection != null ) { try ( PreparedStatement statement = connection.prepareStatement( "DELETE FROM `Users` WHERE `LastJoin` < " + until + ";" ) ) { - logger.log( Level.INFO, "[BotFilter] Removed {0} accounts from the database", statement.executeUpdate() ); + logger.log( Level.INFO, "[BotFilter] 从数据库中删除了 {0} 个玩家", statement.executeUpdate() ); } } } @@ -186,11 +186,11 @@ private void syncUsers() botFilter.addUserToCache( botFilterUser ); i++; } - logger.log( Level.INFO, "[BotFilter] Synchronized ({0}) new checks", i ); + logger.log( Level.INFO, "[BotFilter] 已同步 ({0}) 个检查", i ); lastSync = curr; } catch ( Exception e ) { - logger.log( Level.WARNING, "[BotFilter] Check synchronization failed", e ); + logger.log( Level.WARNING, "[BotFilter] 检查同步失败", e ); setupConnect(); } } @@ -216,7 +216,7 @@ private void loadUsers() throws SQLException botFilter.addUserToCache( botFilterUser ); i++; } - logger.log( Level.INFO, "[BotFilter] Player whitelist loaded successfully ({0})", i ); + logger.log( Level.INFO, "[BotFilter] 玩家列表加载成功 ({0})", i ); } } @@ -270,7 +270,7 @@ public void saveUser(BotFilterUser botFilterUser) } } catch ( SQLException ex ) { - logger.log( Level.WARNING, "[BotFilter] Can't query the database", ex ); + logger.log( Level.WARNING, "[BotFilter] 无法查询数据库", ex ); logger.log( Level.WARNING, sql ); setupConnect(); } @@ -288,7 +288,7 @@ public void tryCleanUP() } catch ( SQLException ex ) { setupConnect(); - logger.log( Level.WARNING, "[BotFilter] Can't clear user list", ex ); + logger.log( Level.WARNING, "[BotFilter] 无法清理玩家列表", ex ); } }