diff options
| author | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
|---|---|---|
| committer | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
| commit | b691c43c44ff180d10e7d4a9afc83b98551ff586 (patch) | |
| tree | 3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.World/ClientProtocolPacket.h | |
| parent | def8cb415354ac390b7e89052a50605285f1aca9 (diff) | |
Initial commit
Diffstat (limited to 'Minecraft.World/ClientProtocolPacket.h')
| -rw-r--r-- | Minecraft.World/ClientProtocolPacket.h | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/Minecraft.World/ClientProtocolPacket.h b/Minecraft.World/ClientProtocolPacket.h new file mode 100644 index 00000000..9b708d16 --- /dev/null +++ b/Minecraft.World/ClientProtocolPacket.h @@ -0,0 +1,74 @@ +#pragma once + +#include "Packet.h" + +class ClientProtocolPacket : public Packet +{ +#if 0 + private int protocolVersion; + private String userName; + + // [EB]: Two fields below exist because we used to have a feature where we sent this + // information so people with dynamic proxies know where to connect us to. + private String hostName; + private int port; + + public ClientProtocolPacket() { + // Needed + } + + public ClientProtocolPacket(final int protocolVersion, final String userName, final String hostName, final int port) { + this.protocolVersion = protocolVersion; + this.userName = userName; + this.hostName = hostName; + this.port = port; + } + + @Override + public void read(DataInputStream dis) throws IOException { + protocolVersion = dis.readByte(); + userName = readUtf(dis, Player.MAX_NAME_LENGTH); + hostName = readUtf(dis, 255); + port = dis.readInt(); + } + + @Override + public void write(DataOutputStream dos) throws IOException { + dos.writeByte(protocolVersion); + writeUtf(userName, dos); + writeUtf(hostName, dos); + dos.writeInt(port); + } + + @Override + public void handle(PacketListener listener) { + listener.handleClientProtocolPacket(this); + } + + @Override + public int getEstimatedSize() { + return 1 + 2 + 2 * userName.length(); + } + + public int getProtocolVersion() { + return protocolVersion; + } + + public String getUserName() { + return userName; + } + + public String getHostName() { + return hostName; + } + + public int getPort() { + return port; + } + + @Override + public String getDebugInfo() { + return String.format("ver=%d, name='%s'", protocolVersion, userName); + } +#endif +};
\ No newline at end of file |
