mirror of
https://github.com/SerendipityR-2022/EndMinecraftPlusV2.git
synced 2024-10-31 20:08:00 +00:00
修复来自服务端的KeepAlive心跳包未正确回应的问题
This commit is contained in:
parent
f0b86a5ddd
commit
d2d5fccd91
@ -10,10 +10,12 @@ import cn.serendipityr.EndMinecraftPlusV2.VersionControl.VersionSupport578;
|
|||||||
import com.github.steveice10.mc.protocol.MinecraftProtocol;
|
import com.github.steveice10.mc.protocol.MinecraftProtocol;
|
||||||
import com.github.steveice10.mc.protocol.data.message.Message;
|
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.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.ClientPluginMessagePacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerMovementPacket;
|
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.ServerChatPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
|
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.ServerPluginMessagePacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket;
|
||||||
import com.github.steveice10.packetlib.Client;
|
import com.github.steveice10.packetlib.Client;
|
||||||
@ -398,6 +400,12 @@ public class BotAttack extends IAttack {
|
|||||||
} else {
|
} else {
|
||||||
clickVerifiesHandle(chatPacket.getMessage(), session, username);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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.ACProtocol.AntiCheat3;
|
||||||
import cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ForgeProtocol.MCForge;
|
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.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.ClientPluginMessagePacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerMovementPacket;
|
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.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.ClientboundLoginPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerPositionPacket;
|
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.ServerChatPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
|
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.ServerPluginMessagePacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket;
|
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.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.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerStatusOnlyPacket;
|
||||||
import com.github.steveice10.packetlib.ProxyInfo;
|
import com.github.steveice10.packetlib.ProxyInfo;
|
||||||
import com.github.steveice10.packetlib.Session;
|
import com.github.steveice10.packetlib.Session;
|
||||||
@ -429,6 +433,9 @@ public class NewBotAttack extends IAttack {
|
|||||||
alivePlayers.add(username);
|
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.sendClientSettingPacket(session, "zh_CN");
|
||||||
VersionSupport758.sendClientPlayerChangeHeldItemPacket(session, 1);
|
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) {
|
} else if (recvPacket instanceof ClientboundPlayerPositionPacket) {
|
||||||
try {
|
try {
|
||||||
ClientboundPlayerPositionPacket packet = (ClientboundPlayerPositionPacket) recvPacket;
|
ClientboundPlayerPositionPacket packet = (ClientboundPlayerPositionPacket) recvPacket;
|
||||||
|
@ -9,10 +9,12 @@ import io.netty.util.internal.ConcurrentSet;
|
|||||||
import org.spacehq.mc.protocol.MinecraftProtocol;
|
import org.spacehq.mc.protocol.MinecraftProtocol;
|
||||||
import org.spacehq.mc.protocol.data.message.Message;
|
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.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.ClientPluginMessagePacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerMovementPacket;
|
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.ServerChatPacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
|
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.ServerPluginMessagePacket;
|
||||||
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket;
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket;
|
||||||
import org.spacehq.packetlib.Client;
|
import org.spacehq.packetlib.Client;
|
||||||
@ -355,6 +357,12 @@ public class BotAttack extends IAttack {
|
|||||||
} else if (recvPacket instanceof ServerChatPacket) {
|
} else if (recvPacket instanceof ServerChatPacket) {
|
||||||
ServerChatPacket chatPacket = (ServerChatPacket) recvPacket;
|
ServerChatPacket chatPacket = (ServerChatPacket) recvPacket;
|
||||||
clickVerifiesHandle(chatPacket.getMessage(), session, username);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user