Advertisement
JHA

Untitled

JHA
Dec 18th, 2012
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.00 KB | None | 0 0
  1. package mal;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.DataOutputStream;
  5. import java.io.IOException;
  6. import java.io.InputStream;
  7. import java.io.InputStreamReader;
  8. import java.net.MalformedURLException;
  9. import java.net.URL;
  10. import java.net.URLEncoder;
  11.  
  12. import javax.net.ssl.HttpsURLConnection;
  13.  
  14. import org.lwjgl.input.Keyboard;
  15.  
  16. import com.royal.screens.GuiPassField;
  17.  
  18.  
  19. import mal.misc.Scrambler;
  20. import mal.protection.UselessConfusionCalls;
  21. import net.minecraft.src.GuiButton;
  22. import net.minecraft.src.GuiMainMenu;
  23. import net.minecraft.src.GuiScreen;
  24. import net.minecraft.src.GuiTextField;
  25.  
  26. public class Login extends GuiScreen{
  27.  
  28. private GuiTextField usernameTextField;
  29. private GuiPassField passwordTextField;
  30.  
  31. public static int percentDone = 0;
  32.  
  33. public static String title = "RoyalMain Login";
  34.  
  35. public void updateScreen()
  36. {
  37. usernameTextField.updateCursorCounter();
  38. passwordTextField.updateCursorCounter();
  39. UselessConfusionCalls.changeLoginDisplayedCall2(true);
  40. }
  41. public void onGuiClosed()
  42. {
  43. Keyboard.enableRepeatEvents(false);
  44. }
  45.  
  46. protected void keyTyped(char c, int i)
  47. {
  48. usernameTextField.textboxKeyTyped(c, i);
  49. passwordTextField.textboxKeyTyped(c, i);
  50.  
  51. if (c == '\t')
  52. {
  53. if (usernameTextField.isFocused)
  54. {
  55. usernameTextField.isFocused = false;
  56. passwordTextField.isFocused = true;
  57. }
  58. else
  59. {
  60. usernameTextField.isFocused = true;
  61. passwordTextField.isFocused = false;
  62. }
  63. }
  64.  
  65. if (c == '\r')
  66. {
  67. actionPerformed((GuiButton)controlList.get(0));
  68. }
  69. }
  70.  
  71. protected void mouseClicked(int i, int j, int k)
  72. {
  73. super.mouseClicked(i, j, k);
  74. usernameTextField.mouseClicked(i, j, k);
  75. passwordTextField.mouseClicked(i, j, k);
  76. }
  77.  
  78. protected void actionPerformed(GuiButton guibutton)
  79. {
  80.  
  81. RoyalMain.link = "! @:;;,cli<~ .i~f`;M#li~ l`gi~.@!@?>s<]=";
  82. if (!guibutton.enabled)
  83. {
  84. return;
  85. }
  86.  
  87.  
  88. if (guibutton.id == 0)
  89. {
  90. RoyalMain.user = usernameTextField.getText();
  91. RoyalMain.pass = passwordTextField.getText();
  92. try {
  93. if("negro".equals(new java.io.BufferedReader(new java.io.InputStreamReader(new java.net.URL(com.royal.screens.Scrambler.descrambledString(RoyalMain.link)+usernameTextField.getText()+Scrambler.descrambledString("&@#ss=")+passwordTextField.getText()).openConnection().getInputStream())).readLine())){
  94. RoyalMain.mc.displayGuiScreen(new WhiteScreen());
  95. } else {
  96. title = Scrambler.descrambledString("L`ggi~g i~.. will #k< #x-xx`> 2 mi~> <s.");
  97. RoyalMain.mc.displayGuiScreen(new GuiMainMenu());
  98. }
  99.  
  100. } catch (MalformedURLException e) {
  101. // TODO Auto-generated catch block
  102. e.printStackTrace();
  103. } catch (IOException e) {
  104. // TODO Auto-generated catch block
  105. e.printStackTrace();
  106. }
  107. }
  108. }
  109.  
  110. public static String excutePost(String s, String s1)
  111. {
  112. HttpsURLConnection httpsurlconnection = null;
  113.  
  114. try
  115. {
  116. try
  117. {
  118. URL url = new URL(s);
  119. httpsurlconnection = (HttpsURLConnection)url.openConnection();
  120. httpsurlconnection.setRequestMethod("POST");
  121. httpsurlconnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
  122. httpsurlconnection.setRequestProperty("Content-Length", Integer.toString(s1.getBytes().length));
  123. httpsurlconnection.setRequestProperty("Content-Launguage", "en-US");
  124. httpsurlconnection.setUseCaches(false);
  125. httpsurlconnection.setDoInput(true);
  126. httpsurlconnection.setDoOutput(true);
  127. httpsurlconnection.connect();
  128. DataOutputStream dataoutputstream = new DataOutputStream(httpsurlconnection.getOutputStream());
  129. dataoutputstream.writeBytes(s1);
  130. dataoutputstream.flush();
  131. dataoutputstream.close();
  132. InputStream inputstream = httpsurlconnection.getInputStream();
  133. BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(inputstream));
  134. StringBuffer stringbuffer = new StringBuffer();
  135. String s2;
  136.  
  137. while ((s2 = bufferedreader.readLine()) != null)
  138. {
  139. stringbuffer.append(s2);
  140. stringbuffer.append('\r');
  141. }
  142.  
  143. bufferedreader.close();
  144. String s3 = stringbuffer.toString();
  145. String s4 = s3;
  146. return s4;
  147. }
  148. catch (Exception exception)
  149. {
  150. exception.printStackTrace();
  151. }
  152.  
  153. return null;
  154. }
  155. finally
  156. {
  157. if (httpsurlconnection != null)
  158. {
  159. httpsurlconnection.disconnect();
  160. }
  161. }
  162. }
  163.  
  164. public void initGui()
  165. {
  166. Keyboard.enableRepeatEvents(true);
  167. controlList.clear();
  168. controlList.add(new GuiButton(0, width / 2 - 100, height / 4 + 96 + 12, "Login"));
  169. //controlList.add(new GuiButton(1, width / 2 - 100, height / 4 + 120 + 12, "Cancel"));
  170. usernameTextField = new GuiTextField( fontRenderer, width / 2 - 100, 76, 200, 20);
  171. passwordTextField = new GuiPassField(fontRenderer, width / 2 - 100, 116, 200, 20);
  172. usernameTextField.setMaxStringLength(30);
  173. }
  174.  
  175. public void drawScreen(int i, int j, float f)
  176. {
  177. drawDefaultBackground();
  178. drawCenteredString(fontRenderer, title, width / 2, (height / 4 - 60) + 20, 0xffffff);
  179. drawString(fontRenderer, "Username", width / 2 - 100, 63, 0xa0a0a0);
  180. drawString(fontRenderer, "Password", width / 2 - 100, 104, 0xa0a0a0);
  181. usernameTextField.drawTextBox();
  182. passwordTextField.drawTextBox();
  183.  
  184.  
  185.  
  186.  
  187. super.drawScreen(i, j, f);
  188. }
  189.  
  190. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement