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_serverbound;
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!(LoginStart, EncryptionResponse, PluginResponse);
18 
19 class LoginStart : Java393Packet
20 {
21 
22     enum uint ID = 0;
23 
24     enum bool CLIENTBOUND = false;
25     enum bool SERVERBOUND = true;
26 
27     enum string[] __fields = ["username"];
28 
29     string username;
30 
31     this() pure nothrow @safe @nogc {}
32 
33     this(string username) pure nothrow @safe @nogc
34     {
35         this.username = username;
36     }
37 
38     mixin Make;
39 
40     public static typeof(this) fromBuffer(ubyte[] buffer)
41     {
42         LoginStart ret = new LoginStart();
43         ret.decode(buffer);
44         return ret;
45     }
46 
47     override string toString()
48     {
49         return "LoginStart(username: " ~ std.conv.to!string(this.username) ~ ")";
50     }
51 
52 }
53 
54 class EncryptionResponse : Java393Packet
55 {
56 
57     enum uint ID = 1;
58 
59     enum bool CLIENTBOUND = false;
60     enum bool SERVERBOUND = true;
61 
62     enum string[] __fields = ["sharedSecret", "verifyToken"];
63 
64     ubyte[] sharedSecret;
65     ubyte[] verifyToken;
66 
67     this() pure nothrow @safe @nogc {}
68 
69     this(ubyte[] sharedSecret, ubyte[] verifyToken=(ubyte[]).init) pure nothrow @safe @nogc
70     {
71         this.sharedSecret = sharedSecret;
72         this.verifyToken = verifyToken;
73     }
74 
75     mixin Make;
76 
77     public static typeof(this) fromBuffer(ubyte[] buffer)
78     {
79         EncryptionResponse ret = new EncryptionResponse();
80         ret.decode(buffer);
81         return ret;
82     }
83 
84     override string toString()
85     {
86         return "EncryptionResponse(sharedSecret: " ~ std.conv.to!string(this.sharedSecret) ~ ", verifyToken: " ~ std.conv.to!string(this.verifyToken) ~ ")";
87     }
88 
89 }
90 
91 class PluginResponse : Java393Packet
92 {
93 
94     enum uint ID = 2;
95 
96     enum bool CLIENTBOUND = false;
97     enum bool SERVERBOUND = true;
98 
99     enum string[] __fields = ["messageId", "successful", "data"];
100 
101     @Var uint messageId;
102     bool successful;
103     @Condition("successful==true") @NoLength ubyte[] data;
104 
105     this() pure nothrow @safe @nogc {}
106 
107     this(uint messageId, bool successful=bool.init, ubyte[] data=(ubyte[]).init) pure nothrow @safe @nogc
108     {
109         this.messageId = messageId;
110         this.successful = successful;
111         this.data = data;
112     }
113 
114     mixin Make;
115 
116     public static typeof(this) fromBuffer(ubyte[] buffer)
117     {
118         PluginResponse ret = new PluginResponse();
119         ret.decode(buffer);
120         return ret;
121     }
122 
123     override string toString()
124     {
125         return "PluginResponse(messageId: " ~ std.conv.to!string(this.messageId) ~ ", successful: " ~ std.conv.to!string(this.successful) ~ ", data: " ~ std.conv.to!string(this.data) ~ ")";
126     }
127 
128 }