Advertisement
Guest User

Untitled

a guest
Feb 3rd, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 46.94 KB | None | 0 0
  1. import java.io.BufferedReader;
  2. import java.io.ByteArrayOutputStream;
  3. import java.io.DataInputStream;
  4. import java.io.DataOutputStream;
  5. import java.io.FileNotFoundException;
  6. import java.io.IOException;
  7. import java.io.UnsupportedEncodingException;
  8. import java.math.BigInteger;
  9. import java.net.Socket;
  10. import java.net.UnknownHostException;
  11. import java.nio.ByteBuffer;
  12. import java.nio.channels.Channels;
  13. import java.nio.channels.ReadableByteChannel;
  14. import java.nio.channels.WritableByteChannel;
  15. import java.nio.charset.Charset;
  16. import java.sql.Timestamp;
  17. import java.util.ArrayList;
  18. import java.util.Arrays;
  19. import java.util.HashMap;
  20. import java.util.Iterator;
  21. import java.util.LinkedHashMap;
  22. import java.util.Map;
  23. import java.util.Map.Entry;
  24. import java.util.Random;
  25. import java.util.concurrent.Executors;
  26. import java.util.concurrent.ScheduledExecutorService;
  27. import java.util.concurrent.TimeUnit;
  28. import java.util.concurrent.locks.Lock;
  29. import java.util.concurrent.locks.ReentrantLock;
  30. import java.util.regex.Matcher;
  31. import java.util.regex.Pattern;
  32. import java.util.*;
  33.  
  34. /**
  35. * @author Jon Rollins Synaptic Studios Jp - 2015
  36. * Chatango Room Client
  37. * Screen name DigitalClay
  38. * Bot name MentalEncryption
  39. */
  40. public class Room {
  41.  
  42.  
  43. /**
  44. * Server, port, and socket
  45. */
  46. String host = "";
  47. private String uid = "";
  48. int port = 5228;
  49. static Socket socket;
  50.  
  51. /**
  52. * Default Room name
  53. */
  54. String roomame = "projectmath";
  55.  
  56.  
  57. /**
  58. * Input and output - for reading and writing to and from server
  59. */
  60. static ByteArrayOutputStream baos;
  61. static DataOutputStream sockOutput;
  62. static WritableByteChannel channel;
  63. BufferedReader inputReader;
  64.  
  65. /**
  66. * Write Lock - One Write or read at a time
  67. */
  68. private final static Lock writeLock = new ReentrantLock();
  69.  
  70.  
  71. /**
  72. * Used for the ping task when bot is idle
  73. */
  74. private final ScheduledExecutorService executorService =
  75. Executors.newSingleThreadScheduledExecutor();
  76.  
  77.  
  78. /**
  79. * default credentals
  80. */
  81. private String user_id = "Ashurei";
  82. private String password = "3236730112aA";
  83.  
  84.  
  85. /**
  86. * used in logging in as anon or with account
  87. * 0 = default , 1 = anon , 2 = account
  88. */
  89. int x = 0;
  90.  
  91. /**
  92. * First Command boolean
  93. */
  94. static boolean firstCommand = true;
  95.  
  96. /**
  97. * Server weights
  98. */
  99. static LinkedHashMap<String,Integer> _chatangoTagserver=new LinkedHashMap<String, Integer>();
  100. private int sv10 = 110;
  101. private int sv12=116;
  102. private int w12=75;
  103. private int sv8=101;
  104. private int sv6=104;
  105. private int sv4=110;
  106. private int sv2=95;
  107.  
  108.  
  109. /**
  110. * Chat room info
  111. */
  112. private static ArrayList<String> mods = new ArrayList<String>();
  113. private static String owner;
  114. private static ArrayList<String> participants = new ArrayList<String>();
  115. private static String count;
  116. static ArrayList<String> banlist = new ArrayList<String>();
  117. private boolean useBG = true;
  118.  
  119.  
  120. /**
  121. * Font face, color, size
  122. * Name color
  123. */
  124. private static String fontFace = "Typewriter";
  125. private static String fontSize = "12";
  126. private static String fontColor = "ffffff";
  127. //private static String nameColor = "093";
  128. private static String nameColor = "ffffff";
  129.  
  130. /**
  131. * Used when flood ban / warning
  132. */
  133. static boolean quiet = false;
  134.  
  135.  
  136. /**
  137. * Default constructor ***unused***
  138. * @throws UnknownHostException
  139. * @throws IOException
  140. */
  141. public Room() throws UnknownHostException, IOException {
  142. connect();
  143. }
  144.  
  145.  
  146. /**
  147. * Constructor to login as anon
  148. * @param roomS
  149. * @throws UnknownHostException
  150. * @throws IOException
  151. */
  152. public Room(String roomS) throws UnknownHostException, IOException{
  153. roomame = roomS;
  154. x = 1;
  155. connect();
  156.  
  157.  
  158. }
  159.  
  160.  
  161. /**
  162. * Constructor to login with account
  163. * @param roomS
  164. * @param userS
  165. * @param passS
  166. * @throws UnknownHostException
  167. * @throws IOException
  168. */
  169. public Room(String roomS, String userS, String passS) throws UnknownHostException, IOException{
  170. roomame = roomS;
  171. user_id = userS;
  172. password = passS;
  173. x = 2;
  174. connect();
  175. }
  176.  
  177. /**
  178. * Connect to chatroom
  179. * @throws UnknownHostException
  180. * @throws IOException
  181. */
  182. private void connect() throws UnknownHostException, IOException{
  183.  
  184. //Tag server weights//
  185. _chatangoTagserver.put("5", w12);
  186. _chatangoTagserver.put("6", w12);
  187. _chatangoTagserver.put("7", w12);
  188. _chatangoTagserver.put("8", w12);
  189. _chatangoTagserver.put("16", w12);
  190. _chatangoTagserver.put("17", w12);
  191. _chatangoTagserver.put("18", w12);
  192. _chatangoTagserver.put("9", sv2);
  193. _chatangoTagserver.put("11", sv2);
  194. _chatangoTagserver.put("12", sv2);
  195. _chatangoTagserver.put("13", sv2);
  196. _chatangoTagserver.put("14", sv2);
  197. _chatangoTagserver.put("15", sv2);
  198. _chatangoTagserver.put("19", sv4);
  199. _chatangoTagserver.put("23", sv4);
  200. _chatangoTagserver.put("24", sv4);
  201. _chatangoTagserver.put("25", sv4);
  202. _chatangoTagserver.put("26", sv4);
  203. _chatangoTagserver.put("28", sv6);
  204. _chatangoTagserver.put("29", sv6);
  205. _chatangoTagserver.put("30", sv6);
  206. _chatangoTagserver.put("31", sv6);
  207. _chatangoTagserver.put("32", sv6);
  208. _chatangoTagserver.put("33", sv6);
  209. _chatangoTagserver.put("35", sv8);
  210. _chatangoTagserver.put("36", sv8);
  211. _chatangoTagserver.put("37", sv8);
  212. _chatangoTagserver.put("38", sv8);
  213. _chatangoTagserver.put("39", sv8);
  214. _chatangoTagserver.put("40", sv8);
  215. _chatangoTagserver.put("41", sv8);
  216. _chatangoTagserver.put("42", sv8);
  217. _chatangoTagserver.put("43", sv8);
  218. _chatangoTagserver.put("44", sv8);
  219. _chatangoTagserver.put("45", sv8);
  220. _chatangoTagserver.put("46", sv8);
  221. _chatangoTagserver.put("47", sv8);
  222. _chatangoTagserver.put("48", sv8);
  223. _chatangoTagserver.put("49", sv8);
  224. _chatangoTagserver.put("50", sv8);
  225. _chatangoTagserver.put("52", sv10);
  226. _chatangoTagserver.put("53", sv10);
  227. _chatangoTagserver.put("55", sv10);
  228. _chatangoTagserver.put("57", sv10);
  229. _chatangoTagserver.put("58", sv10);
  230. _chatangoTagserver.put("59", sv10);
  231. _chatangoTagserver.put("60", sv10);
  232. _chatangoTagserver.put("61", sv10);
  233. _chatangoTagserver.put("62", sv10);
  234. _chatangoTagserver.put("63", sv10);
  235. _chatangoTagserver.put("64", sv10);
  236. _chatangoTagserver.put("65", sv10);
  237. _chatangoTagserver.put("66", sv10);
  238. _chatangoTagserver.put("68", sv2);
  239. _chatangoTagserver.put("71", sv12);
  240. _chatangoTagserver.put("72", sv12);
  241. _chatangoTagserver.put("73", sv12);
  242. _chatangoTagserver.put("74", sv12);
  243. _chatangoTagserver.put("75", sv12);
  244. _chatangoTagserver.put("76", sv12);
  245. _chatangoTagserver.put("77", sv12);
  246. _chatangoTagserver.put("78", sv12);
  247. _chatangoTagserver.put("79", sv12);
  248. _chatangoTagserver.put("80", sv12);
  249. _chatangoTagserver.put("81", sv12);
  250. _chatangoTagserver.put("82", sv12);
  251. _chatangoTagserver.put("83", sv12);
  252. _chatangoTagserver.put("84", sv12);
  253.  
  254. System.out.println("[Room]Tagserver Weights : "+_chatangoTagserver);
  255.  
  256.  
  257. //user id//
  258. uid = generateUID();
  259.  
  260. //socket//
  261. host = "s"+getServerId(roomame)+".chatango.com";
  262. System.out.println("[Room] Host : "+host);
  263. Bot.print("[Room] Host : "+host);
  264. socket = createSocket(host, port);
  265.  
  266. //start reading loop - response from server//
  267. readResponse();
  268.  
  269. //Start login//
  270. String loginStr = "";
  271.  
  272. //Login as anon//
  273. if(x == 1){
  274. loginStr = "bauth:"+roomame+":"+ uid;
  275. }
  276. //login with account//
  277. if(x == 2){
  278. loginStr = "bauth:"+roomame+":"+ uid+":"+ user_id+":"+ password;
  279. }
  280.  
  281. //default *unused*//
  282. if(x == 0){
  283. loginStr = "bauth:"+roomame+":"+ uid+":"+ user_id+":"+ password;
  284. }
  285.  
  286. //Send login command//
  287. sendLoginCommand(loginStr);
  288.  
  289. //Start idle ping//
  290. startIdlePing();
  291.  
  292. //Delay before posting msg to chatroom//
  293. try {
  294. TimeUnit.SECONDS.sleep(1);
  295. } catch (InterruptedException e) {
  296. e.printStackTrace();
  297. }
  298.  
  299. //Post login msg to chatroom//
  300. //sendMsg("Hello, I've logged in successfully. ");
  301.  
  302. }
  303.  
  304.  
  305. /**
  306. * Read response from server - Loop
  307. * @throws IOException
  308. */
  309. private void readResponse() throws IOException {
  310. //Read Loop Thread//
  311. Thread readThread = new Thread(new Runnable() {
  312. @Override
  313. public void run() {
  314. try {
  315. //Innput reader and channel/
  316. DataInputStream sockInput = new DataInputStream(socket.getInputStream());
  317. ReadableByteChannel readChannel = Channels.newChannel(sockInput);
  318.  
  319. while (true) {
  320. // see if any message has been received//
  321. ByteBuffer bufferA = ByteBuffer.allocate(10000000);
  322.  
  323. @SuppressWarnings("unused")
  324. int count = 0;
  325.  
  326. //empty message//
  327. String message = "";
  328.  
  329. //Read bytes//
  330. while ((count = readChannel.read(bufferA)) > 0) {
  331. // flip the byte buffer to start reading//
  332. bufferA.flip();
  333. //decode bytes and add each char-construct message//
  334. message += Charset.defaultCharset().decode(bufferA);
  335.  
  336. }
  337. //check if message had data//
  338. if (message.length() > 0 && !message.trim().isEmpty()) {
  339.  
  340. ///////////////////////////////////////
  341. //SERVER COMMANDS/////////////////////
  342.  
  343. //on login//
  344. if(message.trim().toLowerCase().startsWith("ok:")){
  345. onConnectRcv(message);
  346. }
  347.  
  348. //on login fail//
  349. if(message.trim().toLowerCase().startsWith("denied:")){
  350. onConnectFailRcv();
  351. }
  352.  
  353. //On init//
  354. if(message.trim().toLowerCase().contains("inited")){
  355. onInitRcv(message);
  356. }
  357.  
  358. //message//
  359. if(message.trim().toLowerCase().startsWith("b:")){
  360. String clean = cleanMSG(message);
  361. String sender = getSender(message);
  362. Bot.print("[Room message] "+sender+" : "+clean);
  363. System.out.println("[Room message] "+sender+" : "+clean);
  364.  
  365.  
  366.  
  367. String flooder = Bot.flooderName.getText().toString();
  368. String counterMsg = Bot.counterMsg.getText().toString();
  369.  
  370.  
  371. //if(sender.equalsIgnoreCase("ChainSawLipStick")||sender.equalsIgnoreCase("TrainToForever")||sender.equalsIgnoreCase(flooder)){
  372. // if(sender.equalsIgnoreCase("ChainSawLipStick")||sender.equalsIgnoreCase("TrainToForever")||sender.equals(null)||sender.equals("")||sender.equalsIgnoreCase(flooder)){
  373.  
  374.  
  375.  
  376.  
  377. try{
  378.  
  379. if(sender.equalsIgnoreCase("qiueuayhjasdgjg29327367")){
  380.  
  381. TimeUnit.SECONDS.sleep(3);
  382. Room.sendMsg("\r+++++++++++++++\r+++++++++++++++\r+++++++++++++++\r\r+++++++++++++++\r+++++++++++++++\r+++++++++++++++\r++++++ RIP ++++++\r\rWe used to be frightened and scared to try\rOf things we don't really understand why\rWe laugh for a moment and start to cry\rWe were crazy\r\rNow that the end is already here\rWe reminisce 'bout old yells and cheers\rEven if our last hurrahs were never clear\r\rFarewell to you my friends\rWe'll see each other again\rDon't cry 'cause it's not the end of everything\rI may be miles away\rBut here is where my heart will stay\rWith you, my friends with you\r\rYesterday's a treasure, today is here\rTomorrows' on it's way, the sky is clear\rThank you for the mem'ries of all the laughters and tears\rAnd not to mention our doubts and our fears\rThe hypertension we gave to our peers\rIt's really funny to look back after all of these years\r\rFarewell to you my friends\rWe'll see each other again\rDon't worry 'cause it's not the end of everything\rI may be miles away\rBut here is where my heart will stay\rWith you, my friends with you\r\rFarewell to you my friends\rWe'll see each other again\rDon't worry 'cause it's not the end of everything\rI may be oceans away\rBut here is where my heart will stay\rWith you, my friends with you\rWith you my friends, with only you\r+++++++++++++++\r+++++++++++++++\r+++++++++++++++\r\r+++++++++++++++\r+++++++++++++++\r+++++++++++++++\r++++++ RIP ++++++");
  383.  
  384. }else{
  385. TimeUnit.SECONDS.sleep(3);
  386. Room.sendMsg("\r+++++++++++++++\r+++++++++++++++\r+++++++++++++++\r\r+++++++++++++++\r+++++++++++++++\r+++++++++++++++\r++++++ RIP ++++++\r\rWe used to be frightened and scared to try\rOf things we don't really understand why\rWe laugh for a moment and start to cry\rWe were crazy\r\rNow that the end is already here\rWe reminisce 'bout old yells and cheers\rEven if our last hurrahs were never clear\r\rFarewell to you my friends\rWe'll see each other again\rDon't cry 'cause it's not the end of everything\rI may be miles away\rBut here is where my heart will stay\rWith you, my friends with you\r\rYesterday's a treasure, today is here\rTomorrows' on it's way, the sky is clear\rThank you for the mem'ries of all the laughters and tears\rAnd not to mention our doubts and our fears\rThe hypertension we gave to our peers\rIt's really funny to look back after all of these years\r\rFarewell to you my friends\rWe'll see each other again\rDon't worry 'cause it's not the end of everything\rI may be miles away\rBut here is where my heart will stay\rWith you, my friends with you\r\rFarewell to you my friends\rWe'll see each other again\rDon't worry 'cause it's not the end of everything\rI may be oceans away\rBut here is where my heart will stay\rWith you, my friends with you\rWith you my friends, with only you\r+++++++++++++++\r+++++++++++++++\r+++++++++++++++\r\r+++++++++++++++\r+++++++++++++++\r+++++++++++++++\r++++++ RIP ++++++");
  387. }
  388.  
  389.  
  390.  
  391. }catch(Exception e){
  392. e.printStackTrace();
  393. }
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402. if(sender.equalsIgnoreCase(flooder)){
  403. // sendMsg("Chain kung ang lahat ng tao nag mula sa unggoy, bat mukha kang kabayo? @anon9313 *lol* http://ust.chatango.com/um/m/a/math/img/l_1043.jpg Shout out kay eeesieeeyeeen Happy 20th birthday - From Pantasya Family.");
  404. //sendMsg("Si Chain ay gurang 39 years old! At ganyan po ang pagiisip nya! \"NAKIKITEENAGER SI GURANG\"");
  405. //sendMsg("how to be a teenager again? step1 . mag flood sa room at mag papansin sa kabataan step2.wag tumigil hanggang hindi napapansin step3.magpa cute kahit sinabihan kanang pangit ng magulang mo step4.gayahin ang pormahan ni chain");
  406.  
  407. //if(sender.equals(null)||sender.equals("")){
  408. // Room.sendMsg("Lipat dito : http://biblegroupstudy.chatango.com/");
  409.  
  410. /**
  411. final String[] proper_noun = {"Chain kung ang lahat ng tao nag mula sa unggoy, bat mukha kang kabayo? @anon9313 *lol* http://ust.chatango.com/um/m/a/math/img/l_1043.jpg","Si Chain ay gurang 39 years old! At ganyan po ang pagiisip nya! \"NAKIKITEENAGER SI GURANG\"","how to be a teenager again? step1 . mag flood sa room at mag papansin sa kabataan step2.wag tumigil hanggang hindi napapansin step3.magpa cute kahit sinabihan kanang pangit ng magulang mo step4.gayahin ang pormahan ni chain.","Me : Chain Totoo pala ang multo no? Chain : Bakit? Me : Simula kasi nung nakita kita naniwala na ako. *lol* http://ust.chatango.com/um/m/a/math/img/l_1043.jpg",""};
  412. Random random = new Random();
  413. int index = random.nextInt(proper_noun.length);
  414.  
  415. String randomString = proper_noun[(int)(Math.random() * proper_noun.length)];
  416. //Room.sendMsg(proper_noun[index]);
  417.  
  418. Room.sendMsg(randomString);
  419. **/
  420. /* if(!counterMsg.equalsIgnoreCase("Message na gustong i mention sa mga post ni Chain")){
  421. try{
  422. TimeUnit.SECONDS.sleep(1);
  423. //Room.sendMsg(counterMsg);
  424. //Room.sendMsg("dfsdf \r asdasd");
  425. }catch(Exception e){
  426. e.printStackTrace();
  427. }
  428. }else{
  429. try{
  430. TimeUnit.SECONDS.sleep(1);
  431. //Room.sendMsg("");
  432.  
  433.  
  434.  
  435. }catch(Exception e){
  436. e.printStackTrace();
  437. }
  438. } */
  439.  
  440.  
  441.  
  442.  
  443. }
  444.  
  445. checkCmd(clean,sender);
  446. }
  447. //group count
  448. if(message.trim().toLowerCase().startsWith("n:")){
  449. onCountRcv(message);
  450. }
  451. //mod names
  452. if(message.trim().toLowerCase().startsWith("mods:")){
  453. onModsRcv(message);
  454. }
  455. //on leave
  456. if(message.trim().toLowerCase().startsWith("participant:0")){
  457. onLeaveRcv(message);
  458. }
  459. //on join
  460. if(message.trim().toLowerCase().startsWith("participant:1")){
  461. onJoinRcv(message);
  462. }
  463. //group names
  464. if(message.trim().toLowerCase().startsWith("g_participants:")){
  465. onRoomNamesRcv(message);
  466. }
  467. //banned
  468. if(message.trim().toLowerCase().startsWith("blocked:")){
  469. onBanRcv(message);
  470. }
  471. //unbanned
  472. if(message.trim().toLowerCase().startsWith("unblocked:")){
  473. onUnbanRcv(message);
  474. }
  475. //past msgs
  476. if(message.trim().toLowerCase().startsWith("i:")){
  477. onPastMsgRcv(message);
  478. }
  479. //Ban List
  480. if(message.trim().toLowerCase().startsWith("blocklist:")){
  481. onBlocklistRcv(message);
  482. }
  483. //message deleted
  484. if(message.trim().toLowerCase().startsWith("delete:")){
  485. onMsgDeleteRcv(message);
  486. }
  487. //Flood Warning//
  488. if(message.trim().toLowerCase().startsWith("show_fw:")){
  489. onFloodWarningRcv(message);
  490. }
  491. //Flood Ban//
  492. if(message.trim().toLowerCase().startsWith("show_tb:")){
  493. onFloodBanRcv(message);
  494. }
  495. //Flood Ban repeat//
  496. if(message.trim().toLowerCase().startsWith("tb:")){
  497. onFloodBanRepeatRcv(message);
  498. }
  499. //premium//
  500. if(message.trim().toLowerCase().startsWith("premium:")){
  501. onPremiumRcv(message);
  502. }
  503. //on all messages delete//
  504. if(message.trim().toLowerCase().startsWith("deleteall:")){
  505. onAllMsgDeleteRcv(message);
  506. }
  507.  
  508. //System.out.println("[Room] Room debug : "+message);
  509. //Bot.print("[Room] Room debug : "+message);
  510.  
  511. //Reset message//
  512. message = "";
  513.  
  514.  
  515. }
  516. }
  517. } catch (IOException e) {
  518. e.printStackTrace();
  519. }
  520. }
  521.  
  522.  
  523. });
  524. readThread.start();
  525. }
  526.  
  527. ////////////////////////////////////////
  528. //SERVER COMMAND EVENTS////////////////
  529.  
  530.  
  531. /**
  532. * Called When all of a users messages are deleted
  533. * @param message
  534. * @throws IOException
  535. */
  536. protected void onAllMsgDeleteRcv(String message) throws IOException {
  537. System.out.println("[Room] All MSG Deleted : "+message);
  538. Bot.print("[Room] All MSG Deleted : "+message);
  539. //sendMsg("All Clear ^.^");
  540. }
  541.  
  542.  
  543. /**
  544. * On Premium
  545. * @param message
  546. * @throws IOException
  547. */
  548. protected void onPremiumRcv(String message) throws IOException {
  549.  
  550. String bgTime = message.split(":")[2];
  551.  
  552. Timestamp currentTimeMil = new Timestamp(System.currentTimeMillis());
  553.  
  554. long g = Long.parseLong(bgTime.trim());
  555. Timestamp bgEnd = new Timestamp(g*1000);
  556.  
  557. //test if user accounnt has time left on premium//
  558. if(bgEnd.getTime() > currentTimeMil.getTime() &&useBG ){
  559. System.out.println("[Room] Using premium : "+message);
  560. Bot.print("[Room] Using premium : "+message);
  561. setBG();//set bg//
  562. setMedia();//set media//
  563. }else{
  564. System.out.println("[Room] Not using premium : ");
  565. Bot.print("[Room] Not using premium : "+message);
  566. }
  567. }
  568.  
  569. /**
  570. * On Flood Ban Repeat
  571. * @param message
  572. * @throws FileNotFoundException
  573. * @throws UnsupportedEncodingException
  574. */
  575. protected void onFloodBanRepeatRcv(String message) throws FileNotFoundException, UnsupportedEncodingException {
  576. System.out.println("[Room] Flood Ban Repeat : "+message);
  577. Bot.print("[Room] Flood Ban Repeat : "+message);
  578. if(quiet == false){
  579. quiet = true;
  580. Thread t = new Thread(new Runnable() {
  581. @Override
  582. public void run() {
  583. try {
  584. Thread.sleep(120000);
  585. } catch (InterruptedException e) {
  586. e.printStackTrace();
  587. }finally{
  588. quiet = false;
  589. System.out.println("[Room] Flood Banned : Over ");
  590. try {
  591. Bot.print("[Room] Flood Banned : Over");
  592. } catch (FileNotFoundException e) {
  593. e.printStackTrace();
  594. } catch (UnsupportedEncodingException e) {
  595. e.printStackTrace();
  596. }
  597. }
  598.  
  599. }
  600. });
  601. t.start();
  602. }
  603. }
  604.  
  605. /**
  606. * On Flood ban
  607. * @param message
  608. * @throws FileNotFoundException
  609. * @throws UnsupportedEncodingException
  610. */
  611. protected void onFloodBanRcv(String message) throws FileNotFoundException, UnsupportedEncodingException {
  612. System.out.println("[Room] Flood Ban : "+message);
  613. Bot.print("[Room] Flood Ban : "+message);
  614. if(quiet == false){
  615. quiet = true;
  616. Thread t = new Thread(new Runnable() {
  617. @Override
  618. public void run() {
  619. try {
  620. Thread.sleep(500000);
  621. } catch (InterruptedException e) {
  622. e.printStackTrace();
  623. }finally{
  624. quiet = false;
  625. System.out.println("[Room] Flood Banned : Over ");
  626. try {
  627. Bot.print("[Room] Flood Banned : Over");
  628. } catch (FileNotFoundException e) {
  629. e.printStackTrace();
  630. } catch (UnsupportedEncodingException e) {
  631. e.printStackTrace();
  632. }
  633. }
  634.  
  635. }
  636. });
  637. t.start();
  638. }
  639. }
  640.  
  641. /**
  642. * On Flood Ban Warning
  643. * @param message
  644. * @throws FileNotFoundException
  645. * @throws UnsupportedEncodingException
  646. */
  647. protected void onFloodWarningRcv(String message) throws FileNotFoundException, UnsupportedEncodingException {
  648. System.out.println("[Room] Flood Warning : "+message);
  649. Bot.print("[Room] Flood Warning : "+message);
  650. if(quiet == false){
  651. quiet = true;
  652. Thread t = new Thread(new Runnable() {
  653. @Override
  654. public void run() {
  655. try {
  656. Thread.sleep(120000);
  657. } catch (InterruptedException e) {
  658. e.printStackTrace();
  659. }finally{
  660. quiet = false;
  661. System.out.println("[Room] Flood Warning : Over ");
  662. try {
  663. Bot.print("[Room] Flood Warning : Over");
  664. } catch (FileNotFoundException e) {
  665. e.printStackTrace();
  666. } catch (UnsupportedEncodingException e) {
  667. e.printStackTrace();
  668. }
  669. }
  670.  
  671. }
  672. });
  673. t.start();
  674. }
  675. }
  676.  
  677. /**
  678. * On Message delete
  679. * @param message
  680. * @throws FileNotFoundException
  681. * @throws UnsupportedEncodingException
  682. */
  683. protected void onMsgDeleteRcv(String message) throws FileNotFoundException, UnsupportedEncodingException {
  684. System.out.println("[Room] Message Deleted : "+message);
  685. Bot.print("[Room] Message Deleted : "+message);
  686. }
  687.  
  688. /**
  689. * On User Join
  690. * @param message
  691. * @throws IOException
  692. */
  693. protected void onJoinRcv(String message) throws IOException {
  694. String user = message.split(":")[4];
  695. System.out.println("[Room] Joined : "+user);
  696. Bot.print("[Room] Joined : "+user);
  697. //sendMsg("Welcome back "+user);
  698. participants.add(user);
  699. }
  700.  
  701. /**
  702. * On User Leave
  703. * @param message
  704. * @throws IOException
  705. */
  706. private void onLeaveRcv(String message) throws IOException {
  707. if(message.contains(":")){
  708. String user = message.split(":")[4];
  709. System.out.println("[Room] Left : "+user);
  710. Bot.print("[Room] left : "+user);
  711. //sendMsg("Bye "+user);
  712. participants.remove(user);
  713. }
  714.  
  715. }
  716.  
  717. /**
  718. * On Block List Recive
  719. * @param message
  720. * @throws FileNotFoundException
  721. * @throws UnsupportedEncodingException
  722. */
  723. protected void onBlocklistRcv(String message) throws FileNotFoundException, UnsupportedEncodingException {
  724. message = message.replace("blocklist:", "");
  725. //check if list is empty//
  726. if(message.contains(";")&&message.contains(":")){
  727. String[] parts = message.split(";");
  728. for(int i = 0;i < parts.length;i++){
  729. banlist.add(parts[i].split(":")[2]);
  730. }
  731. }
  732. System.out.println("[Room] Block List : "+banlist);
  733. Bot.print("[Room] Block List : "+banlist);
  734. }
  735.  
  736. /**
  737. * On Init
  738. * @param message
  739. * @throws IOException
  740. */
  741. protected void onInitRcv(String message) throws IOException {
  742. getPremium();
  743. getRoomUsers();
  744. getBlockList();
  745. }
  746.  
  747. /**
  748. * On Connect Fail
  749. */
  750. protected void onConnectFailRcv() {
  751. System.out.println("[Room] Error : Connect failled");
  752. }
  753.  
  754. /**
  755. * On Login Fail
  756. */
  757. protected void onLoginFail() {
  758. System.out.println("[Room] Error : login failled");
  759. }
  760.  
  761.  
  762. /**
  763. * On Connect
  764. * @param message
  765. * @throws UnsupportedEncodingException
  766. * @throws FileNotFoundException
  767. */
  768. protected void onConnectRcv(String message) throws FileNotFoundException, UnsupportedEncodingException {
  769. //check if empty//
  770. if(message.contains(":")){
  771. //Get Owner//
  772. owner = message.split(":")[1];
  773. System.out.println("[Room] Owner : "+owner);
  774. Bot.print("[Room] Owner : "+owner);
  775. }
  776. //Get Mods//
  777. if(!message.contains("M:")){
  778. onLoginFail();
  779. return;
  780. }
  781. try{
  782. String[] msgPartsB = message.split("M:");
  783. String[] msgPartsB2 = msgPartsB[1].split(":");
  784. String[] modsFull = msgPartsB2[3].split(";");
  785. for(int m=0; m < modsFull.length;m++){
  786. mods.add(modsFull[m].split(",")[0]);
  787. }
  788. }catch(Exception e){
  789. e.printStackTrace();
  790. }
  791. System.out.println("[Room] Mods : "+mods);
  792. Bot.print("[Room] Mods : "+mods);
  793. }
  794.  
  795. /**
  796. * On Past Messages
  797. * @param message
  798. */
  799. protected void onPastMsgRcv(String message) {
  800. //Currently Unused//
  801. }
  802.  
  803.  
  804. /**
  805. * On Unban
  806. * @param message
  807. * @throws IOException
  808. */
  809. protected void onUnbanRcv(String message) throws IOException {
  810. String banned = message.split(":")[3];
  811. String banner = message.split(":")[4];
  812. banlist.remove(banned);
  813. System.out.println("[Room] Unban : "+banned+" By : "+banner);
  814. Bot.print("[Room] Unban : "+banned+" By : "+banner);
  815. sendMsg("UnBan : "+banned+" __ By :"+banner);
  816. }
  817.  
  818. /**
  819. * On Ban
  820. * @param message
  821. * @throws IOException
  822. */
  823. protected void onBanRcv(String message) throws IOException {
  824. String banned = message.split(":")[3];
  825. String banner = message.split(":")[4];
  826. banlist.add(banned);
  827. System.out.println("[Room] Ban : "+banned+" By : "+banner);
  828. Bot.print("[Room] Ban : "+banned+" By : "+banner);
  829. sendMsg("Banned : "+banned+" __ By :"+banner);
  830. }
  831.  
  832. /**
  833. * A mod has been added or removed
  834. * @param message
  835. * @throws IOException
  836. */
  837. protected void onModsRcv(String message) throws IOException {
  838.  
  839. message = message.replace("mods:", "");
  840. if(!message.contains(":")){
  841. return;
  842. }
  843. String[] parts = message.split(":");
  844.  
  845. ArrayList<String> j = new ArrayList<String>();
  846.  
  847. for(int m=0; m < parts.length;m++){
  848. j.add(parts[m].split(",")[0]);
  849. }
  850. if(mods.size() < j.size()){
  851. mods = j;
  852. sendMsg("A mod has been removed ___ Mods : "+mods);
  853. System.out.println("[Room] Mod Removed : "+mods);
  854. Bot.print("[Room] Mod Removed : "+mods);
  855. }
  856. if(mods.size() > j.size()){
  857. mods= j;
  858. sendMsg("A mod has been added ___ Mods : "+mods);
  859. System.out.println("[Room] Mod added : "+mods);
  860. Bot.print("[Room] Mod added : "+mods);
  861. }
  862.  
  863.  
  864. }
  865.  
  866.  
  867. /**
  868. * Chat room participants
  869. * @param message
  870. * @throws FileNotFoundException
  871. * @throws UnsupportedEncodingException
  872. */
  873. protected void onRoomNamesRcv(String message) throws FileNotFoundException, UnsupportedEncodingException {
  874. message = message.replace("g_participants:","");
  875.  
  876. String[] parts = message.split(";");
  877.  
  878. for(int i = 0;i<parts.length;i++){
  879. participants.add(parts[i].split(":")[3]);
  880. }
  881. System.out.println("[Room] Participants : "+participants);
  882. Bot.print("[Room] Participants : "+participants);
  883. }
  884.  
  885.  
  886.  
  887. /**
  888. * Chat room count
  889. * @param message
  890. * @throws FileNotFoundException
  891. * @throws UnsupportedEncodingException
  892. */
  893. protected void onCountRcv(String message) throws FileNotFoundException, UnsupportedEncodingException {
  894. count = message.split("n:")[1];
  895. System.out.println("[Room message] Room Count : "+count);
  896. Bot.print("[Room message] Room Count : "+count);
  897. }
  898.  
  899.  
  900. //////////////////////////////
  901. //Bot Commands///////////////
  902.  
  903. /**
  904. * Commands
  905. *
  906. * @param clean
  907. * @param sender
  908. * @throws IOException
  909. */
  910. private void checkCmd(String clean, String sender) throws IOException {
  911.  
  912. //Check if ~ is used and return if not//
  913. if(!clean.startsWith("~")){
  914. return;
  915. }
  916.  
  917. //Trim and lowercase message//
  918. String cleanB = clean.toLowerCase().trim();
  919.  
  920. //Getting cmd and arguments//
  921. String cmd = "";
  922. String args = "";
  923. String msg = cleanB;
  924. if(cleanB.contains(" ")){
  925. String[] msgArray = cleanB.split(" ");
  926. if(msgArray.length > 1){
  927. cmd = msgArray[0].trim();
  928. args = msgArray[1].trim();
  929. }
  930. }else{
  931. cmd = cleanB;
  932. args= "";
  933. }
  934.  
  935.  
  936.  
  937. // end of if-else
  938. // if(cmd.equals("~join") && !args.equals("")){
  939. // Bot.joinRoom(args, user_id, password);
  940. // }
  941. }
  942.  
  943.  
  944. /////////////////////////////
  945. //Message Utilities/////////
  946.  
  947. /**
  948. * Get message sender.
  949. *
  950. * @param message
  951. * @return
  952. */
  953. protected String getSender(String message) {
  954. String[] parts = message.split("b:");
  955. String a = parts[1];
  956. parts = a.split(":");
  957. return parts[1];
  958. }
  959.  
  960. /**
  961. * Clean message
  962. *
  963. * @param in
  964. * @return
  965. */
  966. private String cleanMSG(String in) {
  967. String patt = "<.*?>";
  968. Pattern pattern = Pattern.compile(patt);
  969. Matcher match = pattern.matcher(in);
  970. in = match.replaceAll("");
  971. String[] parts = in.split(":");
  972. String b = parts[parts.length-1];
  973. String patt2 = "¦";
  974. Pattern pattern2 = Pattern.compile(patt2);
  975. Matcher match2 = pattern2.matcher(b);
  976. b = match2.replaceAll("");
  977. String patt3 = "¦";
  978. Pattern pattern3 = Pattern.compile(patt3);
  979. Matcher match3 = pattern3.matcher(b);
  980. b = match3.replaceAll("");
  981. b = b.toLowerCase().trim();
  982. b = b.replace("&lt;", "<");
  983. b = b.replace("&gt;", ">");
  984. b = b.replace("&quot;", "\"");
  985. b = b.replace("&apos;", "'");
  986. b = b.replace("&amp;", "&");
  987. return b;
  988. }
  989.  
  990.  
  991.  
  992. /////////////////////////////////
  993. //Connection Utilities//////////
  994.  
  995. /**
  996. * Create a new Socket.
  997. *
  998. * @param host2
  999. * @param port2
  1000. * @return
  1001. * @throws UnknownHostException
  1002. * @throws IOException
  1003. */
  1004. private Socket createSocket(String host2, int port2) throws UnknownHostException, IOException {
  1005. socket = new Socket(host2,port2);
  1006. socket.setKeepAlive(true);
  1007. return socket;
  1008. }
  1009.  
  1010. /**
  1011. * Get the server Id
  1012. * @param name
  1013. * @return
  1014. */
  1015. private static String getServerId(String name) {
  1016.  
  1017. //replace [^0-9a-z] with q
  1018. name = name.toLowerCase().replace("-", "q").replace("_","q");
  1019.  
  1020.  
  1021.  
  1022. //get the minimum number _ 5 or if name.length() _ whatever is smallest
  1023. int mins = Math.min(5, name.length());
  1024.  
  1025. //get a substring starting at 0 place and ending at mins
  1026. //example: 0 - 5 of string digitalmasterminds = digit
  1027. String substr = name.substring(0, mins);
  1028.  
  1029. //cast big int .intvalue() with string value
  1030. //of substr and radix of 36 to float
  1031. float fnv = (float) new BigInteger(substr, 36).intValue();
  1032.  
  1033. int lnv = 1000;
  1034. //if name length larger than 6
  1035. if(name.length() > 6) {
  1036. //basicly the same as above in one line
  1037. lnv = new BigInteger(name.substring(6, 6 + Math.min(3, name.length() - 5)), 36).intValue();
  1038. //get the max number _ 1000 or lnv _ whatever is largest
  1039. lnv = Math.max(lnv, 1000);
  1040. }
  1041.  
  1042. //num = mod of fnv and lnv divided by lnv
  1043. float num = (fnv % lnv) / lnv;
  1044.  
  1045.  
  1046. //variable to iterate map
  1047. Iterator<Entry<String, Integer>> it = _chatangoTagserver.entrySet().iterator();
  1048.  
  1049. //maxnum starting point
  1050. int maxnum=0;
  1051.  
  1052. //loop while map has data left
  1053. while (it.hasNext()) {
  1054. //set entry
  1055. Map.Entry<String, Integer> pair = it.next();
  1056. //add up entry values
  1057. maxnum = maxnum + (int)pair.getValue();
  1058.  
  1059. }
  1060.  
  1061. float sumfreq = 0;//sum
  1062. String sn = "";//serv num
  1063.  
  1064. //map iterator
  1065. Iterator<Entry<String, Integer>> it2 = _chatangoTagserver.entrySet().iterator();
  1066.  
  1067. //loop map
  1068. while(it2.hasNext()) {
  1069.  
  1070. //set entry
  1071. Map.Entry<String, Integer> pair2 = it2.next();
  1072.  
  1073. //add up pair value / maxnum
  1074. sumfreq += ((float) pair2.getValue()) / maxnum;
  1075.  
  1076. //if num <= sumfreq
  1077. if(num <= sumfreq) {
  1078. //parse key
  1079. sn = pair2.getKey();
  1080. break;
  1081. }
  1082. }
  1083. //return server number
  1084. return sn;
  1085. }
  1086.  
  1087.  
  1088.  
  1089. /**
  1090. * GENERATE UID
  1091. *
  1092. * -Generate a UID with 16 characters
  1093. *
  1094. * @return id
  1095. */
  1096. private String generateUID() {
  1097. String id = "";
  1098. Random random = new Random();
  1099. while(id.length() < 16) {
  1100. id += random.nextInt(10);
  1101. }
  1102. return id;
  1103. }
  1104.  
  1105.  
  1106. //////////////////////////////////
  1107. //Send To Server Utilities///////
  1108.  
  1109. /**
  1110. * Send data to server.
  1111. *
  1112. * @param data
  1113. * @throws IOException
  1114. */
  1115. private static void writeToServer(String data) throws IOException{
  1116. writeLock.lock();
  1117. baos = new ByteArrayOutputStream();
  1118.  
  1119. if (firstCommand) {
  1120. baos.write(data.getBytes());
  1121. baos.write(0x00);
  1122.  
  1123. } else {
  1124. baos.write(data.getBytes());
  1125. }
  1126. sockOutput = new DataOutputStream(socket.getOutputStream());
  1127. channel = Channels.newChannel(sockOutput);
  1128. channel.write(ByteBuffer.wrap(baos.toByteArray()));
  1129. sockOutput.flush();
  1130. writeLock.unlock();
  1131. }
  1132.  
  1133. /**
  1134. * Idle ping
  1135. *
  1136. * @throws IOException
  1137. */
  1138. private void startIdlePing() throws IOException {
  1139. executorService.scheduleWithFixedDelay(new Runnable() {
  1140. @Override
  1141. public void run() {
  1142. try {
  1143. sendPing();
  1144. } catch (IOException e) {
  1145. e.printStackTrace();
  1146. }
  1147. }
  1148. }, 20L, 20L, TimeUnit.SECONDS);
  1149. }
  1150.  
  1151. /**
  1152. * Send Ping.
  1153. *
  1154. * @throws IOException
  1155. */
  1156. private void sendPing() throws IOException {
  1157. writeToServer("\r\n");
  1158. }
  1159.  
  1160. /**
  1161. * Send login command.
  1162. *
  1163. * @param login
  1164. * @throws IOException
  1165. */
  1166. private void sendLoginCommand(String login) throws IOException {
  1167. writeToServer(login);
  1168. Bot.print("[Room] Login sent to server : "+baos);
  1169. System.out.println("[Room] Login sent to server : "+baos);
  1170. firstCommand = false;
  1171. }
  1172.  
  1173. /**
  1174. * Post a message to the chat.
  1175. *
  1176. * @param msg
  1177. * @throws IOException
  1178. */
  1179. private static void sendMsg(String msg) throws IOException {
  1180. if(quiet){
  1181. return;
  1182. }
  1183. if(!quiet){
  1184. msg = "bmsg:tl2r:"+"<n"+nameColor+"/><f x"+fontSize+fontColor+"=\""+fontFace+"\">"+msg+"\r\n";
  1185. writeToServer(msg);
  1186. }
  1187. }
  1188.  
  1189. /**
  1190. * Get Blocklist
  1191. * @throws IOException
  1192. */
  1193. private void getBlockList() throws IOException {
  1194. writeToServer("blocklist:block::next:500\r\n");
  1195. }
  1196.  
  1197. /**
  1198. * Get Premium
  1199. * @throws IOException
  1200. */
  1201. private void getPremium() throws IOException {
  1202. writeToServer("getpremium:1\r\n");
  1203. }
  1204.  
  1205.  
  1206. /**
  1207. * Set Media - Video/Audio Recording
  1208. * @throws IOException
  1209. */
  1210. private void setMedia() throws IOException {
  1211. writeToServer("msgmedia:1\r\n");
  1212. }
  1213.  
  1214. /**
  1215. * Get Room Users
  1216. * @throws IOException
  1217. */
  1218. private void getRoomUsers() throws IOException {
  1219. writeToServer("g_participants:start\r\n");
  1220. }
  1221.  
  1222. /**
  1223. * Set to use the BG
  1224. * @throws IOException
  1225. */
  1226. private void setBG() throws IOException {
  1227. writeToServer("msgbg:1\r\n");
  1228. }
  1229.  
  1230. /**
  1231. * Add Mod
  1232. * @param name
  1233. * @throws IOException
  1234. */
  1235. private void addMod(String name) throws IOException{
  1236. writeToServer("addmod:"+name+"\r\n");
  1237. }
  1238.  
  1239. /**
  1240. * Remove Mod
  1241. * @param name
  1242. * @throws IOException
  1243. */
  1244. private void removeMod(String name) throws IOException{
  1245. writeToServer("removemod:"+name+"\r\n");
  1246. }
  1247.  
  1248. /**
  1249. * Ban a User
  1250. * @param userID
  1251. * @param ip
  1252. * @param name
  1253. * @throws IOException
  1254. */
  1255. private void ban(String userID,String ip, String name) throws IOException{
  1256. writeToServer("block:"+userID+":"+ip+":"+name+"\r\n");
  1257. }
  1258.  
  1259. /**
  1260. * Unban a User
  1261. * @param userID
  1262. * @param ip
  1263. * @param name
  1264. * @throws IOException
  1265. */
  1266. private void unBan(String userID,String ip, String name) throws IOException{
  1267. writeToServer("removeblock:"+userID+":"+ip+":"+name+"\r\n");
  1268. }
  1269.  
  1270. /**
  1271. * Delete a message
  1272. * @param msgId
  1273. * @throws IOException
  1274. */
  1275. private void deleteMsg(String msgId) throws IOException{
  1276. writeToServer("delmsg:"+msgId+"\r\n");
  1277. }
  1278.  
  1279. /**
  1280. * Delete all a users messages
  1281. * @param userId
  1282. * @throws IOException
  1283. */
  1284. private void deleteUserAllMsg(String userId) throws IOException{
  1285. writeToServer("delallmsg:"+userId+"\r\n");
  1286. }
  1287.  
  1288. /**
  1289. * Flag a user
  1290. * @param msgId
  1291. * @throws IOException
  1292. */
  1293. private void flag(String msgId) throws IOException{
  1294. writeToServer("g_flag:"+msgId+"\r\n");
  1295. }
  1296.  
  1297. /**
  1298. * Flag a user
  1299. * @param msgId
  1300. * @throws IOException
  1301. */
  1302. private void clearAllMsg() throws IOException{
  1303. writeToServer("clearall:\r\n");
  1304. }
  1305.  
  1306. /**
  1307. * Send a message from the GUI or use a console command
  1308. * @param text
  1309. * @throws IOException
  1310. */
  1311. public static void sendFieldText(String text) throws IOException {
  1312. //If text starts with /cmd: - use a console command//
  1313. if(text.toLowerCase().trim().startsWith("/cmd")){
  1314. //Use console command//
  1315. consoleCommands(text);
  1316. }else{
  1317. //If not a console cmd post msg in all chatrooms//
  1318. sendMsg(text);
  1319. }
  1320. }
  1321.  
  1322.  
  1323. /**
  1324. * Console Commands - commands entered into the bots GUI.
  1325. * All console commands must start with /cmd:
  1326. * followed by the command:
  1327. * and then the single or multiple arguments all parts seperated by :
  1328. *
  1329. * @param text
  1330. * @throws FileNotFoundException
  1331. * @throws UnsupportedEncodingException
  1332. */
  1333. private static void consoleCommands(String text) throws FileNotFoundException, UnsupportedEncodingException {
  1334.  
  1335. //lower and trim text//
  1336. text = text.toLowerCase().trim();
  1337.  
  1338. //check if valid cmd - contains ://
  1339. if(!text.contains(":")){
  1340. Bot.print("[Console CMD] Error : invalid console cmd");
  1341. System.out.println("[Console CMD] Error : invalid console cmd");
  1342. return;//return//
  1343. }
  1344.  
  1345. //split text at : after checking if it contains ://
  1346. String[] parts = text.split(":");
  1347.  
  1348. //cmd and args//
  1349. String conCmd = "";
  1350. String conArgs = "";
  1351. String conArgs2 = "";
  1352.  
  1353. System.out.println("[Console CMD Debug] Room;: "+Arrays.toString(parts)+parts.length);
  1354.  
  1355. //check if valid cmd - lenght of cmd less than 3 parts//
  1356. if(parts.length < 2){
  1357. Bot.print("[Console CMD] Error : invalid console cmd");
  1358. System.out.println("[Console CMD] Error : invalid console cmd");
  1359. return;//return//
  1360. }
  1361.  
  1362. //if command is a no args command//
  1363. if(parts.length == 2){
  1364. conCmd = parts[1];//command//
  1365. }
  1366.  
  1367. //if command is a single args command//
  1368. if(parts.length == 3){
  1369. conCmd = parts[1];//command//
  1370. conArgs = parts[2];//first arg//
  1371. }
  1372.  
  1373. //if command is a multi args command//
  1374. if(parts.length == 4){
  1375. conCmd = parts[1];//command//
  1376. conArgs = parts[2];//first args//
  1377. conArgs2 = parts[3];//second args//
  1378. }
  1379.  
  1380. ////////////////////////////////////////////
  1381. //Console commands/////////////////////////
  1382.  
  1383. //set quiet//
  1384. if(conCmd.trim().equals("quiet") && !conArgs.equals("")){
  1385. if(conArgs.equals("true")){
  1386. quiet = true;
  1387. Bot.print("[Console CMD] Quiet : " + quiet);
  1388. System.out.println("[Console CMD] Quiet : " + quiet);
  1389. }else if(conArgs.equals("false")){
  1390. quiet = false;
  1391. Bot.print("[Console CMD] Quiet : " + quiet);
  1392. System.out.println("[Console CMD] Quiet : " + quiet);
  1393. }
  1394. }
  1395. //set font color//
  1396. if(conCmd.trim().equals("fontcolor") && !conArgs.equals("")){
  1397. fontColor = conArgs;
  1398. }
  1399. //set font face//
  1400. if(conCmd.trim().equals("fontface") && !conArgs.equals("")){
  1401. fontFace = conArgs;
  1402. }
  1403. //set fornt size//
  1404. if(conCmd.trim().equals("fontsize") && !conArgs.equals("")){
  1405. fontSize = conArgs;
  1406. }
  1407. //set name color//
  1408. if(conCmd.trim().equals("namecolor")&& !conArgs.equals("")){
  1409. nameColor = conArgs;
  1410. }
  1411. //add a mod//
  1412. if(conCmd.trim().equals("addmod")&& !conArgs.equals("")){
  1413.  
  1414. }
  1415. //remove a mod//
  1416. if(conCmd.trim().equals("removemod")&& !conArgs.equals("")){
  1417.  
  1418. }
  1419. //ban a user//
  1420. if(conCmd.trim().equals("ban")&& !conArgs.equals("")){
  1421.  
  1422. }
  1423. //unban a user//
  1424. if(conCmd.trim().equals("unban")&& !conArgs.equals("")){
  1425.  
  1426. }
  1427. if(conCmd.trim().equals("join")&& !conArgs.equals("")){
  1428.  
  1429. }
  1430. if(conCmd.trim().equals("leave")&& !conArgs.equals("")){
  1431.  
  1432. }
  1433. if(conCmd.trim().equals("post")&& !conArgs.equals("") && !conArgs2.equals("")){
  1434.  
  1435. }
  1436. //get banlist//
  1437. if(conCmd.trim().equals("getbanlist")){
  1438. Bot.print("[Console CMD] BanList : " + banlist);
  1439. System.out.println("[Console CMD] BanList : " + banlist);
  1440. }
  1441. //get mods//
  1442. if(conCmd.trim().equals("getmods")){
  1443. Bot.print("[Console CMD] Mods : " + mods);
  1444. System.out.println("[Console CMD] Mods : " + mods);
  1445. }
  1446. //get owner//
  1447. if(conCmd.trim().equals("getowner")){
  1448. Bot.print("[Console CMD] Owner : " + owner);
  1449. System.out.println("[Console CMD] Owner : " + owner);
  1450. }
  1451. //get count//
  1452. if(conCmd.trim().equals("getcount")){
  1453. Bot.print("[Console CMD] Count : " + count);
  1454. System.out.println("[Console CMD] Count : " + count);
  1455. }
  1456. //get chatlist//
  1457. if(conCmd.trim().equals("getchatlist")){
  1458. Bot.print("[Console CMD] Chat List : " + participants);
  1459. System.out.println("[Console CMD] Chat List : " + participants);
  1460. }
  1461. }
  1462.  
  1463.  
  1464. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement