假人自动重生
This commit is contained in:
parent
80d4942fe3
commit
75d82e44bd
|
@ -93,5 +93,6 @@
|
||||||
<SOURCES />
|
<SOURCES />
|
||||||
</library>
|
</library>
|
||||||
</orderEntry>
|
</orderEntry>
|
||||||
|
<orderEntry type="module" module-name="VersionSupport-107" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="module-library">
|
||||||
|
<library>
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MODULE_DIR$/../libs/adventure-api-4.11.0.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</orderEntry>
|
||||||
|
<orderEntry type="module-library">
|
||||||
|
<library>
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MODULE_DIR$/../libs/adventure-text-serializer-plain-4.11.0.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</orderEntry>
|
||||||
|
<orderEntry type="module-library">
|
||||||
|
<library>
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MODULE_DIR$/../libs/MC-1.12.2.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</orderEntry>
|
||||||
|
</component>
|
||||||
|
</module>
|
|
@ -0,0 +1,21 @@
|
||||||
|
package cn.serendipityr.EndMinecraftPlusV2.VersionControl;
|
||||||
|
|
||||||
|
import org.spacehq.mc.protocol.data.game.ClientRequest;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.ClientKeepAlivePacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.client.ClientRequestPacket;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.ServerKeepAlivePacket;
|
||||||
|
import org.spacehq.packetlib.Session;
|
||||||
|
|
||||||
|
public class VersionSupport107 {
|
||||||
|
public static void sendRespawnPacket(Session session) {
|
||||||
|
ClientRequestPacket clientRequestPacket = new ClientRequestPacket(ClientRequest.RESPAWN);
|
||||||
|
|
||||||
|
session.send(clientRequestPacket);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void sendKeepAlivePacket(Session session, ServerKeepAlivePacket packet) {
|
||||||
|
ClientKeepAlivePacket clientKeepAlivePacket = new ClientKeepAlivePacket(packet.getPingId());
|
||||||
|
|
||||||
|
session.send(clientKeepAlivePacket);
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package cn.serendipityr.EndMinecraftPlusV2.VersionControl;
|
||||||
|
|
||||||
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.server.ServerKeepAlivePacket;
|
||||||
import com.github.steveice10.packetlib.ProxyInfo;
|
import com.github.steveice10.packetlib.ProxyInfo;
|
||||||
import com.github.steveice10.packetlib.Session;
|
import com.github.steveice10.packetlib.Session;
|
||||||
import com.github.steveice10.packetlib.tcp.TcpSessionFactory;
|
import com.github.steveice10.packetlib.tcp.TcpSessionFactory;
|
||||||
|
|
|
@ -8,7 +8,7 @@ import cn.serendipityr.EndMinecraftPlusV2.VersionControl.AttackManager;
|
||||||
import cn.serendipityr.EndMinecraftPlusV2.VersionControl.ProtocolLibs;
|
import cn.serendipityr.EndMinecraftPlusV2.VersionControl.ProtocolLibs;
|
||||||
|
|
||||||
public class EndMinecraftPlusV2 {
|
public class EndMinecraftPlusV2 {
|
||||||
public static String ver = "1.4.5";
|
public static String ver = "1.4.6";
|
||||||
public static Integer CfgVer = 6;
|
public static Integer CfgVer = 6;
|
||||||
public static Boolean isLinux = false;
|
public static Boolean isLinux = false;
|
||||||
|
|
||||||
|
|
|
@ -7,16 +7,19 @@ import cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.ACProtocol.A
|
||||||
import cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.ACProtocol.AntiCheat3;
|
import cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.ACProtocol.AntiCheat3;
|
||||||
import cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.CatAntiCheat.CatAntiCheat;
|
import cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.CatAntiCheat.CatAntiCheat;
|
||||||
import cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.ForgeProtocol.MCForge;
|
import cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.ForgeProtocol.MCForge;
|
||||||
|
import cn.serendipityr.EndMinecraftPlusV2.VersionControl.VersionSupport107;
|
||||||
import io.netty.util.internal.ConcurrentSet;
|
import io.netty.util.internal.ConcurrentSet;
|
||||||
import org.spacehq.mc.protocol.MinecraftProtocol;
|
import org.spacehq.mc.protocol.MinecraftProtocol;
|
||||||
import org.spacehq.mc.protocol.data.game.ItemStack;
|
import org.spacehq.mc.protocol.data.game.ItemStack;
|
||||||
import org.spacehq.mc.protocol.data.game.values.ClientRequest;
|
import org.spacehq.mc.protocol.data.game.values.ClientRequest;
|
||||||
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.ClientRequestPacket;
|
import org.spacehq.mc.protocol.packet.ingame.client.ClientRequestPacket;
|
||||||
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.*;
|
import org.spacehq.mc.protocol.packet.ingame.server.*;
|
||||||
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerPlayerHealthPacket;
|
||||||
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.mc.protocol.packet.ingame.server.entity.player.ServerUpdateHealthPacket;
|
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerUpdateHealthPacket;
|
||||||
import org.spacehq.opennbt.NBTIO;
|
import org.spacehq.opennbt.NBTIO;
|
||||||
|
@ -27,6 +30,9 @@ import org.spacehq.opennbt.tag.builtin.Tag;
|
||||||
import org.spacehq.packetlib.Client;
|
import org.spacehq.packetlib.Client;
|
||||||
import org.spacehq.packetlib.Session;
|
import org.spacehq.packetlib.Session;
|
||||||
import org.spacehq.packetlib.event.session.*;
|
import org.spacehq.packetlib.event.session.*;
|
||||||
|
import org.spacehq.packetlib.io.NetInput;
|
||||||
|
import org.spacehq.packetlib.io.buffer.ByteBufferNetInput;
|
||||||
|
import org.spacehq.packetlib.io.stream.StreamNetInput;
|
||||||
import org.spacehq.packetlib.io.stream.StreamNetOutput;
|
import org.spacehq.packetlib.io.stream.StreamNetOutput;
|
||||||
import org.spacehq.packetlib.packet.Packet;
|
import org.spacehq.packetlib.packet.Packet;
|
||||||
import org.spacehq.packetlib.tcp.TcpSessionFactory;
|
import org.spacehq.packetlib.tcp.TcpSessionFactory;
|
||||||
|
@ -38,6 +44,7 @@ import java.io.OutputStream;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.Proxy;
|
import java.net.Proxy;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
@ -506,8 +513,15 @@ public class BotAttack extends IAttack {
|
||||||
LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + message.getFullText(), "BotAttack");
|
LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + message.getFullText(), "BotAttack");
|
||||||
}
|
}
|
||||||
} else if (recvPacket instanceof ServerKeepAlivePacket) {
|
} else if (recvPacket instanceof ServerKeepAlivePacket) {
|
||||||
// ClientKeepAlivePacket keepAlivePacket = new ClientKeepAlivePacket(((ServerKeepAlivePacket) recvPacket).getPingId());
|
if (MCForge.getProtocolVersion() >= 107) {
|
||||||
// session.send(keepAlivePacket);
|
VersionSupport107.sendKeepAlivePacket(session, (ServerKeepAlivePacket) recvPacket);
|
||||||
|
} else {
|
||||||
|
ClientKeepAlivePacket keepAlivePacket = new ClientKeepAlivePacket(((ServerKeepAlivePacket) recvPacket).getPingId());
|
||||||
|
session.send(keepAlivePacket);
|
||||||
|
}
|
||||||
|
|
||||||
|
// LogUtil.doLog(0, "[" + username + "] 已发送KeepAlive数据包。", "BotAttack");
|
||||||
|
|
||||||
if (!joinedPlayers.contains(session)) {
|
if (!joinedPlayers.contains(session)) {
|
||||||
joinedPlayers.add(session);
|
joinedPlayers.add(session);
|
||||||
}
|
}
|
||||||
|
@ -515,11 +529,17 @@ public class BotAttack extends IAttack {
|
||||||
if (!alivePlayers.contains(session)) {
|
if (!alivePlayers.contains(session)) {
|
||||||
alivePlayers.add(session);
|
alivePlayers.add(session);
|
||||||
}
|
}
|
||||||
} else if (recvPacket instanceof ServerUpdateHealthPacket) {
|
} else if (recvPacket.getClass().getSimpleName().equals("ServerPlayerHealthPacket")) {
|
||||||
|
if (recvPacket instanceof ServerPlayerHealthPacket && ((ServerPlayerHealthPacket) recvPacket).getHealth() <= 0) {
|
||||||
|
VersionSupport107.sendRespawnPacket(session);
|
||||||
|
|
||||||
|
LogUtil.doLog(0, "[" + username + "] " + "假人于服务器中死亡,已重生。", "BotAttack");
|
||||||
|
}
|
||||||
|
} else if (recvPacket.getClass().getSimpleName().equals("ServerUpdateHealthPacket")) {
|
||||||
if (((ServerUpdateHealthPacket) recvPacket).getHealth() <= 0) {
|
if (((ServerUpdateHealthPacket) recvPacket).getHealth() <= 0) {
|
||||||
ClientRequestPacket clientRequestPacket = new ClientRequestPacket(ClientRequest.RESPAWN);
|
ClientRequestPacket clientRequestPacket = new ClientRequestPacket(ClientRequest.RESPAWN);
|
||||||
|
|
||||||
session.send(clientRequestPacket);
|
session.send(clientRequestPacket);
|
||||||
|
LogUtil.doLog(0, "[" + username + "] " + "假人于服务器中死亡,已重生。", "BotAttack");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue