From f286881ab6c892c3238514c16e305b3952663045 Mon Sep 17 00:00:00 2001 From: SerendipityR <48401197+SerendipityR-2022@users.noreply.github.com> Date: Tue, 23 Aug 2022 14:02:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=81=E8=AE=B8=E8=87=AA=E5=AE=9A=E4=B9=89Bo?= =?UTF-8?q?tName=E9=9A=8F=E6=9C=BA=E6=96=B9=E5=BC=8F=20=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E7=89=88=E6=9C=AC=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EndMinecraftPlusV2/Tools/ConfigUtil.java | 10 +++--- .../NewVersion/AttackUtils/BotAttack.java | 18 +++++++++- .../NewVersion/AttackUtils/NewBotAttack.java | 36 +++++++++++++++++++ 3 files changed, 58 insertions(+), 6 deletions(-) diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ConfigUtil.java b/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ConfigUtil.java index ab4d504..bc00ef6 100644 --- a/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ConfigUtil.java +++ b/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ConfigUtil.java @@ -62,11 +62,6 @@ public class ConfigUtil { CfgVer = config.getInt("CfgVer"); - if (!EndMinecraftPlusV2.CfgVer.equals(CfgVer)) { - LogUtil.doLog(1, "载入配置文件失败! 配置文件版本不匹配,请前往发布页更新配置文件。", null); - EndMinecraftPlusV2.Exit(); - } - AttackAddress = config.getString("AttackSettings.Address"); AttackPort = config.getInt("AttackSettings.Port"); AttackMethod = config.getInt("AttackSettings.Method"); @@ -144,6 +139,11 @@ public class ConfigUtil { loadConfig(); } + + if (!EndMinecraftPlusV2.CfgVer.equals(CfgVer)) { + LogUtil.doLog(1, "载入配置文件失败! 配置文件版本不匹配,请前往发布页更新配置文件。", null); + EndMinecraftPlusV2.Exit(); + } } public static String getFileCharset(File file) { diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/BotAttack.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/BotAttack.java index 6a5866e..3840441 100644 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/BotAttack.java +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/BotAttack.java @@ -42,6 +42,7 @@ public class BotAttack extends IAttack { public static int rejoin = 0; public static int clickVerifies = 0; public static List alivePlayers = new ArrayList<>(); + public static HashMap positionPacket = new HashMap<>(); protected boolean attack_motdbefore; protected boolean attack_tab; protected Map modList; @@ -80,9 +81,23 @@ public class BotAttack extends IAttack { if (c.getSession().hasFlag("login")) { if (ConfigUtil.ChatSpam) { c.getSession().send(new ClientChatPacket(getRandMessage(clientName.get(c)))); + OtherUtils.doSleep(ConfigUtil.ChatDelay); } - OtherUtils.doSleep(ConfigUtil.ChatDelay); + if (ConfigUtil.RandomTeleport) { + ServerPlayerPositionRotationPacket positionRotationPacket = positionPacket.get(c.getSession()); + if (c.getSession().isConnected() && positionRotationPacket != null) { + new Thread(() -> { + try { + cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.MultiVersionPacket.sendPosPacket(c.getSession(), positionRotationPacket.getX() + OtherUtils.getRandomInt(-10, 10), positionRotationPacket.getY() + OtherUtils.getRandomInt(2, 8), positionRotationPacket.getZ() + OtherUtils.getRandomInt(-10, 10), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00)); + Thread.sleep(500); + cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.MultiVersionPacket.sendPosPacket(c.getSession(), positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00)); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + }).start(); + } + } } else if (c.getSession().hasFlag("join")) { if (ConfigUtil.RegisterAndLogin) { for (String cmd:ConfigUtil.RegisterCommands) { @@ -399,6 +414,7 @@ public class BotAttack extends IAttack { MultiVersionPacket.sendPosPacket(session, packet.getX(), packet.getY(), packet.getZ(), packet.getYaw(), packet.getYaw()); session.send(new ClientPlayerMovementPacket(true)); MultiVersionPacket.sendClientTeleportConfirmPacket(session, packet); + positionPacket.put(session, packet); } catch (Exception ignored) {} } else if (recvPacket instanceof ServerChatPacket) { diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/NewBotAttack.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/NewBotAttack.java index 880ef5a..c984cb9 100644 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/NewBotAttack.java +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/NewBotAttack.java @@ -46,6 +46,8 @@ public class NewBotAttack extends IAttack { public static int rejoin = 0; public static int clickVerifies = 0; public static List alivePlayers = new ArrayList<>(); + public static HashMap positionPacket = new HashMap<>(); + public static HashMap newPositionPacket = new HashMap<>(); protected boolean attack_motdbefore; protected boolean attack_tab; protected Map modList; @@ -95,6 +97,38 @@ public class NewBotAttack extends IAttack { OtherUtils.doSleep(ConfigUtil.ChatDelay); } + + if (ConfigUtil.RandomTeleport) { + if (ProtocolLibs.adaptAfter758) { + ClientboundPlayerPositionPacket positionRotationPacket = newPositionPacket.get(c); + + if (c.isConnected() && positionRotationPacket != null) { + new Thread(() -> { + try { + VersionSupport758.sendPosPacket(c, positionRotationPacket.getX() + OtherUtils.getRandomInt(-10, 10), positionRotationPacket.getY() + OtherUtils.getRandomInt(2, 8), positionRotationPacket.getZ() + OtherUtils.getRandomInt(-10, 10), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00)); + Thread.sleep(500); + VersionSupport758.sendPosPacket(c, positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00)); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + }).start(); + } + } else { + ServerPlayerPositionRotationPacket positionRotationPacket = positionPacket.get(c); + + if (c.isConnected() && positionRotationPacket != null) { + new Thread(() -> { + try { + cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.MultiVersionPacket.sendPosPacket(c, positionRotationPacket.getX() + OtherUtils.getRandomInt(-10, 10), positionRotationPacket.getY() + OtherUtils.getRandomInt(2, 8), positionRotationPacket.getZ() + OtherUtils.getRandomInt(-10, 10), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00)); + Thread.sleep(500); + cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.MultiVersionPacket.sendPosPacket(c, positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00)); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + }).start(); + } + } + } } else if (c.hasFlag("join")) { if (ConfigUtil.RegisterAndLogin) { for (String cmd:ConfigUtil.RegisterCommands) { @@ -439,6 +473,7 @@ public class NewBotAttack extends IAttack { MultiVersionPacket.sendPosPacket(session, packet.getX(), packet.getY(), packet.getZ(), packet.getYaw(), packet.getYaw()); session.send(new ClientPlayerMovementPacket(true)); MultiVersionPacket.sendClientTeleportConfirmPacket(session, packet); + positionPacket.put(session, packet); } catch (Exception ignored) {} } else if (recvPacket instanceof ServerChatPacket) { @@ -508,6 +543,7 @@ public class NewBotAttack extends IAttack { VersionSupport758.sendPosPacket(session, packet.getX(), packet.getY(), packet.getZ(), packet.getYaw(), packet.getYaw()); session.send(new ServerboundMovePlayerStatusOnlyPacket(true)); VersionSupport758.sendClientTeleportConfirmPacket(session, packet); + newPositionPacket.put(session,packet); } catch (Exception ignored) {} } else if (ProtocolLibs.adaptAfter760 && VersionSupport760.checkServerChatPacket(recvPacket)) { List result = VersionSupport760.clickVerifiesHandle(recvPacket, session, ConfigUtil.ClickVerifiesDetect, null);