package com.encrox.twitchbot.client; import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; import com.encrox.twitchbot.client.Plugin; import com.encrox.twitchbot.client.messages.Login; public class Core { public static String username, password; private static BufferedReader br; public static Client client; public static void main(String[] args) { br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Twitchbot-client build 201510042114"); System.out.println("Setting up..."); setup(); System.out.println("Connecting to the server..."); client = new Client(); if(client.connect() != MessageTypes.OK) { System.out.println("Failed to connect to the server!"); return; } Login login = new Login(); do { System.out.println("Encrox username: "); try { login.setUsername(br.readLine()); } catch (IOException e) { e.printStackTrace(); } System.out.println("Encrox password: "); try { login.setPassword(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } while(client.send(login) != MessageTypes.OK); client.login(); new PluginHandler(client); } public static void setup() { File plugindir = new File("plugins/"); if(!plugindir.exists()) { plugindir.mkdir(); } } }