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; } } }