允许自定义BotName随机方式 加入配置文件版本校验

This commit is contained in:
SerendipityR 2022-08-23 14:02:59 +08:00 committed by GitHub
parent 8686f7943c
commit f286881ab6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 58 additions and 6 deletions

View File

@ -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) {

View File

@ -42,6 +42,7 @@ public class BotAttack extends IAttack {
public static int rejoin = 0;
public static int clickVerifies = 0;
public static List<String> alivePlayers = new ArrayList<>();
public static HashMap<Session, ServerPlayerPositionRotationPacket> positionPacket = new HashMap<>();
protected boolean attack_motdbefore;
protected boolean attack_tab;
protected Map<String, String> 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) {

View File

@ -46,6 +46,8 @@ public class NewBotAttack extends IAttack {
public static int rejoin = 0;
public static int clickVerifies = 0;
public static List<String> alivePlayers = new ArrayList<>();
public static HashMap<Session,ServerPlayerPositionRotationPacket> positionPacket = new HashMap<>();
public static HashMap<Session,ClientboundPlayerPositionPacket> newPositionPacket = new HashMap<>();
protected boolean attack_motdbefore;
protected boolean attack_tab;
protected Map<String, String> 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<String> result = VersionSupport760.clickVerifiesHandle(recvPacket, session, ConfigUtil.ClickVerifiesDetect, null);