package bot;

import java.io.IOException;
import java.io.PrintStream;
import java.net.Socket;
import java.util.Scanner;

public class Server {
	
	// Fields
	public Scanner in;
	public PrintStream out;
	private Socket socket;
	
	
	public void connectTo(String address, int port){
		if(socket != null){
			try {
				socket.close();
				
			} 
			catch (IOException e) {
				e.printStackTrace();
			}
		}
		try{
			socket = new Socket(address, port);
			in = new Scanner(socket.getInputStream());
			out = new PrintStream(socket.getOutputStream());
		}
		catch(Exception e){
			e.printStackTrace();
		}
	}
	
	public void send(String s){
		out.println(s + "\r\n");
		out.flush();
	}
	
	public void pm(String target, String message){
		if(target.equals("#r9kmode")){
			String addition =  "           0,0," + (int)Math.floor(Math.random()*1000000);
			
			message = message + addition;
		}
		send(String.format("PRIVMSG %s :%s", target, message));
	}
	
	public void notice(String target, String message){
		send(String.format("NOTICE %s :%s", target, message));
	}
}

@@ -726,165 +726,8 @@
 e)%7B%0A
-%09%09if(target.equals(%22#r9kmode%22))%7B%0A%09%09%09String addition =  %22           %030,0,%22 + (int)Math.floor(Math.random()*1000000);%0A%09%09%09%0A%09%09%09message = message + addition;%0A%09%09%7D%0A
 %09%09se

remove r9kmode