blob: b439c998f0d7f3d11974a74b678c6456f74a0c5e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
package com.encrox.twitchbot.client.messages;
import java.io.UnsupportedEncodingException;
import com.encrox.twitchbot.client.Utils;
public class Login extends Message {
private byte id = 1;
private String username, password;
public Login(String username, String password) {
this.username = username;
this.password = password;
}
public Login() {
username = null;
password = null;
}
public void setUsername(String username) {
this.username = username;
}
public void setPassword(String password) {
this.password = password;
}
public byte getID() {
return id;
}
public byte[] getData() {
byte[] output = new byte[160];
try {
byte[] user = Utils.fill(username.getBytes("UTF-8"), 32), pass = Utils.fill(password.getBytes("UTF-8"), 128);
for(int i = 0; i < 32; i++)
output[i] = user[i];
for(int i = 0; i < 128; i++)
output[32+i] = pass[i];
return output;
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return null;
}
}
}
|