Automate the stress testing of a Minecraft server network using bots
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #5 from x4n4th/main

Support for 1.19.2

authored by

PureGero and committed by
GitHub
5c7a2a49 e13d3d5b

+10 -9
+1 -1
README.md
··· 1 1 # minecraft-stress-test 2 2 3 - Automate the stress testing of your 1.18 Minecraft server with bots. 3 + Automate the stress testing of your 1.19.2 Minecraft server with bots. 4 4 This project will log offline-mode bots into the specified server which will 5 5 fly around and explore the world. 6 6
+9 -8
src/main/java/com/github/puregero/minecraftstresstest/Bot.java
··· 11 11 import java.util.concurrent.TimeUnit; 12 12 13 13 public class Bot extends ChannelInboundHandlerAdapter { 14 - private static final int PROTOCOL_VERSION = Integer.parseInt(System.getProperty("bot.protocol.version", "759")); // 759 is 1.19 https://wiki.vg/Protocol_version_numbers 14 + private static final int PROTOCOL_VERSION = Integer.parseInt(System.getProperty("bot.protocol.version", "760")); // 760 is 1.19.2 https://wiki.vg/Protocol_version_numbers 15 15 private static final double RADIUS = Double.parseDouble(System.getProperty("bot.radius", "1000")); 16 16 private static final double CENTER_X = Double.parseDouble(System.getProperty("bot.x", "0")); 17 17 private static final double CENTER_Z = Double.parseDouble(System.getProperty("bot.z", "0")); ··· 56 56 FriendlyByteBuf loginStartPacket = new FriendlyByteBuf(ctx.alloc().buffer()); 57 57 loginStartPacket.writeVarInt(0x00); 58 58 loginStartPacket.writeUtf(username); 59 + loginStartPacket.writeBoolean(false); 59 60 loginStartPacket.writeBoolean(false); 60 61 ctx.writeAndFlush(loginStartPacket); 61 62 } ··· 108 109 109 110 CompletableFuture.delayedExecutor(1000,TimeUnit.MILLISECONDS).execute(() -> { 110 111 FriendlyByteBuf settingsPacket = new FriendlyByteBuf(ctx.alloc().buffer()); 111 - settingsPacket.writeVarInt(0x07); 112 + settingsPacket.writeVarInt(0x08); 112 113 settingsPacket.writeUtf("en_GB"); 113 114 settingsPacket.writeByte(2); 114 115 settingsPacket.writeVarInt(0); ··· 164 165 } 165 166 166 167 FriendlyByteBuf movePacket = new FriendlyByteBuf(ctx.alloc().buffer()); 167 - movePacket.writeVarInt(0x14); 168 + movePacket.writeVarInt(0x15); 168 169 movePacket.writeDouble(x); 169 170 movePacket.writeDouble(y); 170 171 movePacket.writeDouble(z); ··· 178 179 int packetId = byteBuf.readVarInt(); 179 180 // System.out.println("id 0x" + Integer.toHexString(packetId) + " (" + (dataLength == 0 ? length : dataLength) + ")"); 180 181 181 - if (packetId == 0x17) { 182 + if (packetId == 0x19) { 182 183 System.out.println(username + " (" + uuid + ") was kicked due to " + byteBuf.readUtf()); 183 184 ctx.close(); 184 - } else if (packetId == 0x1E) { 185 + } else if (packetId == 0x20) { 185 186 long id = byteBuf.readLong(); 186 187 187 188 FriendlyByteBuf keepAlivePacket = new FriendlyByteBuf(ctx.alloc().buffer()); 188 - keepAlivePacket.writeVarInt(0x11); 189 + keepAlivePacket.writeVarInt(0x12); 189 190 keepAlivePacket.writeLong(id); 190 191 ctx.writeAndFlush(keepAlivePacket); 191 192 } else if (packetId == 0x2D) { ··· 195 196 keepAlivePacket.writeVarInt(0x1F); 196 197 keepAlivePacket.writeInt(id); 197 198 ctx.writeAndFlush(keepAlivePacket); 198 - } else if (packetId == 0x36) { 199 + } else if (packetId == 0x39) { 199 200 double dx = byteBuf.readDouble(); 200 201 double dy = byteBuf.readDouble(); 201 202 double dz = byteBuf.readDouble(); ··· 228 229 teleportConfirmPacket.writeVarInt(0x00); 229 230 teleportConfirmPacket.writeVarInt(id); 230 231 ctx.writeAndFlush(teleportConfirmPacket); 231 - } else if (packetId == 0x3A) { 232 + } else if (packetId == 0x3D) { 232 233 String url = byteBuf.readUtf(); 233 234 String hash = byteBuf.readUtf(); 234 235 boolean forced = byteBuf.readBoolean();