From d2d5fccd91bd7d3fc56a3e8678b11fa21414d7b2 Mon Sep 17 00:00:00 2001 From: SerendipityR <48401197+SerendipityR-2022@users.noreply.github.com> Date: Tue, 23 Aug 2022 00:07:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9D=A5=E8=87=AA=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E7=AB=AF=E7=9A=84KeepAlive=E5=BF=83=E8=B7=B3=E5=8C=85?= =?UTF-8?q?=E6=9C=AA=E6=AD=A3=E7=A1=AE=E5=9B=9E=E5=BA=94=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NewVersion/AttackUtils/BotAttack.java | 8 ++++++++ .../NewVersion/AttackUtils/NewBotAttack.java | 13 +++++++++++++ .../OldVersion/AttackUtils/BotAttack.java | 8 ++++++++ 3 files changed, 29 insertions(+) diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/BotAttack.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/BotAttack.java index 22e2184..fa8925e 100644 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/BotAttack.java +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/BotAttack.java @@ -10,10 +10,12 @@ import cn.serendipityr.EndMinecraftPlusV2.VersionControl.VersionSupport578; import com.github.steveice10.mc.protocol.MinecraftProtocol; import com.github.steveice10.mc.protocol.data.message.Message; import com.github.steveice10.mc.protocol.packet.ingame.client.ClientChatPacket; +import com.github.steveice10.mc.protocol.packet.ingame.client.ClientKeepAlivePacket; import com.github.steveice10.mc.protocol.packet.ingame.client.ClientPluginMessagePacket; import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerMovementPacket; import com.github.steveice10.mc.protocol.packet.ingame.server.ServerChatPacket; import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.ServerKeepAlivePacket; import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPluginMessagePacket; import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket; import com.github.steveice10.packetlib.Client; @@ -398,6 +400,12 @@ public class BotAttack extends IAttack { } else { clickVerifiesHandle(chatPacket.getMessage(), session, username); } + } else if (recvPacket instanceof ServerKeepAlivePacket) { + ClientKeepAlivePacket keepAlivePacket = new ClientKeepAlivePacket(((ServerKeepAlivePacket) recvPacket).getPingId()); + session.send(keepAlivePacket); + if (!alivePlayers.contains(username)) { + alivePlayers.add(username); + } } } diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/NewBotAttack.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/NewBotAttack.java index ce52999..baceb64 100644 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/NewBotAttack.java +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/NewBotAttack.java @@ -6,16 +6,20 @@ import cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ACProtocol.A import cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ACProtocol.AntiCheat3; import cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ForgeProtocol.MCForge; import com.github.steveice10.mc.protocol.packet.ingame.client.ClientChatPacket; +import com.github.steveice10.mc.protocol.packet.ingame.client.ClientKeepAlivePacket; import com.github.steveice10.mc.protocol.packet.ingame.client.ClientPluginMessagePacket; import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerMovementPacket; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundCustomPayloadPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundKeepAlivePacket; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundLoginPacket; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerPositionPacket; import com.github.steveice10.mc.protocol.packet.ingame.server.ServerChatPacket; import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.ServerKeepAlivePacket; import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPluginMessagePacket; import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCustomPayloadPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundKeepAlivePacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerStatusOnlyPacket; import com.github.steveice10.packetlib.ProxyInfo; import com.github.steveice10.packetlib.Session; @@ -429,6 +433,9 @@ public class NewBotAttack extends IAttack { alivePlayers.add(username); } } + } else if (recvPacket instanceof ServerKeepAlivePacket) { + ClientKeepAlivePacket keepAlivePacket = new ClientKeepAlivePacket(((ServerKeepAlivePacket) recvPacket).getPingId()); + session.send(keepAlivePacket); } } @@ -468,6 +475,12 @@ public class NewBotAttack extends IAttack { VersionSupport758.sendClientSettingPacket(session, "zh_CN"); VersionSupport758.sendClientPlayerChangeHeldItemPacket(session, 1); + } else if (recvPacket instanceof ClientboundKeepAlivePacket) { + ServerboundKeepAlivePacket keepAlivePacket = new ServerboundKeepAlivePacket(((ClientboundKeepAlivePacket) recvPacket).getPingId()); + session.send(keepAlivePacket); + if (!alivePlayers.contains(username)) { + alivePlayers.add(username); + } } else if (recvPacket instanceof ClientboundPlayerPositionPacket) { try { ClientboundPlayerPositionPacket packet = (ClientboundPlayerPositionPacket) recvPacket; diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/BotAttack.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/BotAttack.java index 889b552..2d06043 100644 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/BotAttack.java +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/BotAttack.java @@ -9,10 +9,12 @@ import io.netty.util.internal.ConcurrentSet; import org.spacehq.mc.protocol.MinecraftProtocol; import org.spacehq.mc.protocol.data.message.Message; import org.spacehq.mc.protocol.packet.ingame.client.ClientChatPacket; +import org.spacehq.mc.protocol.packet.ingame.client.ClientKeepAlivePacket; import org.spacehq.mc.protocol.packet.ingame.client.ClientPluginMessagePacket; import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerMovementPacket; import org.spacehq.mc.protocol.packet.ingame.server.ServerChatPacket; import org.spacehq.mc.protocol.packet.ingame.server.ServerJoinGamePacket; +import org.spacehq.mc.protocol.packet.ingame.server.ServerKeepAlivePacket; import org.spacehq.mc.protocol.packet.ingame.server.ServerPluginMessagePacket; import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket; import org.spacehq.packetlib.Client; @@ -355,6 +357,12 @@ public class BotAttack extends IAttack { } else if (recvPacket instanceof ServerChatPacket) { ServerChatPacket chatPacket = (ServerChatPacket) recvPacket; clickVerifiesHandle(chatPacket.getMessage(), session, username); + } else if (recvPacket instanceof ServerKeepAlivePacket) { + ClientKeepAlivePacket keepAlivePacket = new ClientKeepAlivePacket(((ServerKeepAlivePacket) recvPacket).getPingId()); + session.send(keepAlivePacket); + if (!alivePlayers.contains(username)) { + alivePlayers.add(username); + } } }