1 /* 2 * This file has been automatically generated by Soupply and released under the MIT license. 3 * Generated from data/java393.xml 4 */ 5 module soupply.java393.protocol.login_clientbound; 6 7 static import std.conv; 8 import std.typetuple : TypeTuple; 9 import xpacket; 10 11 import soupply.util; 12 import soupply.java393.metadata : Metadata; 13 import soupply.java393.packet : Java393Packet; 14 15 static import soupply.java393.types; 16 17 alias Packets = TypeTuple!(Disconnect, EncryptionRequest, LoginSuccess, SetCompression, PluginRequest); 18 19 class Disconnect : Java393Packet 20 { 21 22 enum uint ID = 0; 23 24 enum bool CLIENTBOUND = true; 25 enum bool SERVERBOUND = false; 26 27 enum string[] __fields = ["reason"]; 28 29 string reason; 30 31 this() pure nothrow @safe @nogc {} 32 33 this(string reason) pure nothrow @safe @nogc 34 { 35 this.reason = reason; 36 } 37 38 mixin Make; 39 40 public static typeof(this) fromBuffer(ubyte[] buffer) 41 { 42 Disconnect ret = new Disconnect(); 43 ret.decode(buffer); 44 return ret; 45 } 46 47 override string toString() 48 { 49 return "Disconnect(reason: " ~ std.conv.to!string(this.reason) ~ ")"; 50 } 51 52 } 53 54 class EncryptionRequest : Java393Packet 55 { 56 57 enum uint ID = 1; 58 59 enum bool CLIENTBOUND = true; 60 enum bool SERVERBOUND = false; 61 62 enum string[] __fields = ["serverId", "publicKey", "verifyToken"]; 63 64 string serverId; 65 ubyte[] publicKey; 66 ubyte[] verifyToken; 67 68 this() pure nothrow @safe @nogc {} 69 70 this(string serverId, ubyte[] publicKey=(ubyte[]).init, ubyte[] verifyToken=(ubyte[]).init) pure nothrow @safe @nogc 71 { 72 this.serverId = serverId; 73 this.publicKey = publicKey; 74 this.verifyToken = verifyToken; 75 } 76 77 mixin Make; 78 79 public static typeof(this) fromBuffer(ubyte[] buffer) 80 { 81 EncryptionRequest ret = new EncryptionRequest(); 82 ret.decode(buffer); 83 return ret; 84 } 85 86 override string toString() 87 { 88 return "EncryptionRequest(serverId: " ~ std.conv.to!string(this.serverId) ~ ", publicKey: " ~ std.conv.to!string(this.publicKey) ~ ", verifyToken: " ~ std.conv.to!string(this.verifyToken) ~ ")"; 89 } 90 91 } 92 93 class LoginSuccess : Java393Packet 94 { 95 96 enum uint ID = 2; 97 98 enum bool CLIENTBOUND = true; 99 enum bool SERVERBOUND = false; 100 101 enum string[] __fields = ["uuid", "username"]; 102 103 string uuid; 104 string username; 105 106 this() pure nothrow @safe @nogc {} 107 108 this(string uuid, string username=string.init) pure nothrow @safe @nogc 109 { 110 this.uuid = uuid; 111 this.username = username; 112 } 113 114 mixin Make; 115 116 public static typeof(this) fromBuffer(ubyte[] buffer) 117 { 118 LoginSuccess ret = new LoginSuccess(); 119 ret.decode(buffer); 120 return ret; 121 } 122 123 override string toString() 124 { 125 return "LoginSuccess(uuid: " ~ std.conv.to!string(this.uuid) ~ ", username: " ~ std.conv.to!string(this.username) ~ ")"; 126 } 127 128 } 129 130 class SetCompression : Java393Packet 131 { 132 133 enum uint ID = 3; 134 135 enum bool CLIENTBOUND = true; 136 enum bool SERVERBOUND = false; 137 138 enum string[] __fields = ["thresold"]; 139 140 @Var uint thresold; 141 142 this() pure nothrow @safe @nogc {} 143 144 this(uint thresold) pure nothrow @safe @nogc 145 { 146 this.thresold = thresold; 147 } 148 149 mixin Make; 150 151 public static typeof(this) fromBuffer(ubyte[] buffer) 152 { 153 SetCompression ret = new SetCompression(); 154 ret.decode(buffer); 155 return ret; 156 } 157 158 override string toString() 159 { 160 return "SetCompression(thresold: " ~ std.conv.to!string(this.thresold) ~ ")"; 161 } 162 163 } 164 165 class PluginRequest : Java393Packet 166 { 167 168 enum uint ID = 4; 169 170 enum bool CLIENTBOUND = true; 171 enum bool SERVERBOUND = false; 172 173 enum string[] __fields = ["messageId", "channel", "data"]; 174 175 @Var uint messageId; 176 string channel; 177 @NoLength ubyte[] data; 178 179 this() pure nothrow @safe @nogc {} 180 181 this(uint messageId, string channel=string.init, ubyte[] data=(ubyte[]).init) pure nothrow @safe @nogc 182 { 183 this.messageId = messageId; 184 this.channel = channel; 185 this.data = data; 186 } 187 188 mixin Make; 189 190 public static typeof(this) fromBuffer(ubyte[] buffer) 191 { 192 PluginRequest ret = new PluginRequest(); 193 ret.decode(buffer); 194 return ret; 195 } 196 197 override string toString() 198 { 199 return "PluginRequest(messageId: " ~ std.conv.to!string(this.messageId) ~ ", channel: " ~ std.conv.to!string(this.channel) ~ ", data: " ~ std.conv.to!string(this.data) ~ ")"; 200 } 201 202 }