Advertisement
Guest User

Untitled

a guest
Jun 25th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.69 KB | None | 0 0
  1. package me.callofcaos.lorien.altmanager;
  2.  
  3. import java.io.IOException;
  4. import java.util.List;
  5. import java.util.Random;
  6. import net.minecraft.client.Minecraft;
  7. import net.minecraft.client.gui.FontRenderer;
  8. import net.minecraft.client.gui.GuiButton;
  9. import net.minecraft.client.gui.GuiScreen;
  10. import net.minecraft.client.gui.GuiTextField;
  11. import net.minecraft.util.Session;
  12. import org.lwjgl.input.Keyboard;
  13.  
  14. import me.callofcaos.lorien.utils.LorienUtils;
  15. import me.callofcaos.lorien.utils.Values;
  16.  
  17. public class GuiDirectLogin
  18. extends GuiScreen
  19. {
  20. public GuiScreen parent;
  21. public GuiTextField usernameBox;
  22. public GuiTextField passwordBox;
  23. public GuiTextField sessionBox;
  24.  
  25. public GuiDirectLogin(GuiScreen paramScreen)
  26. {
  27. this.parent = paramScreen;
  28. }
  29.  
  30. public void initGui()
  31. {
  32. Keyboard.enableRepeatEvents(true);
  33. this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 96 + 12, "Login"));
  34. this.buttonList.add(new GuiButton(3, this.width / 2 - 100, this.height / 4 + 96 + 36, "Relog"));
  35. this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 96 + 70, "Random Alt"));
  36. this.buttonList.add(new GuiButton(2, this.width / 2 - 100, this.height / 4 + 96 + 106, "Back"));
  37. this.usernameBox = new GuiTextField(3, this.mc.fontRendererObj, this.width / 2 - 100, 51, 200, 20);
  38. this.passwordBox = new GuiTextField(4, this.mc.fontRendererObj, this.width / 2 - 100, 91, 200, 20);
  39. }
  40.  
  41. public void onGuiClosed()
  42. {
  43. Keyboard.enableRepeatEvents(false);
  44. }
  45.  
  46. public void updateScreen()
  47. {
  48. this.usernameBox.updateCursorCounter();
  49. this.passwordBox.updateCursorCounter();
  50. }
  51.  
  52. public void mouseClicked(int x, int y, int b)
  53. {
  54. this.usernameBox.mouseClicked(x, y, b);
  55. this.passwordBox.mouseClicked(x, y, b);
  56. try
  57. {
  58. super.mouseClicked(x, y, b);
  59. }
  60. catch (IOException e)
  61. {
  62. e.printStackTrace();
  63. }
  64. }
  65.  
  66. public static String lastusername = "";
  67. public static String lastpassword = "";
  68.  
  69. protected void actionPerformed(GuiButton par1GuiButton)
  70. {
  71. if (par1GuiButton.id == 1)
  72. {
  73. if (this.usernameBox.getText().length() > 0) {
  74. new Thread()
  75. {
  76. public void run()
  77. {
  78. GuiDirectLogin.lastusername = GuiDirectLogin.this.usernameBox.getText();
  79. GuiDirectLogin.lastpassword = GuiDirectLogin.this.passwordBox.getText();
  80. Values.premium = LorienUtils.login(GuiDirectLogin.this.usernameBox.getText(), GuiDirectLogin.this.passwordBox.getText());
  81. }
  82. }.start();
  83. }
  84. }
  85. else if (par1GuiButton.id == 2)
  86. {
  87. Minecraft.getMinecraft().displayGuiScreen(this.parent);
  88. }
  89. else if (par1GuiButton.id == 3)
  90. {
  91. new Thread()
  92. {
  93. public void run()
  94. {
  95. Values.premium = LorienUtils.login(GuiDirectLogin.lastusername, GuiDirectLogin.lastpassword);
  96. }
  97. }.start();
  98. }
  99. else if (par1GuiButton.id == 4)
  100. {
  101. final Random r = new Random();
  102. }
  103. }
  104.  
  105.  
  106.  
  107.  
  108. public void keyTyped(char ch, int key)
  109. {
  110. if (key == 1) {
  111. Minecraft.getMinecraft().displayGuiScreen(this.parent);
  112. }
  113. this.usernameBox.textboxKeyTyped(ch, key);
  114. this.passwordBox.textboxKeyTyped(ch, key);
  115. if (key == 15) {
  116. if (this.usernameBox.isFocused())
  117. {
  118. this.usernameBox.setFocused(false);
  119. this.passwordBox.setFocused(true);
  120. }
  121. else
  122. {
  123. this.usernameBox.setFocused(true);
  124. this.passwordBox.setFocused(false);
  125. }
  126. }
  127. if (key == 28) {
  128. actionPerformed((GuiButton)this.buttonList.get(0));
  129. }
  130. if (key == 13) {
  131. actionPerformed((GuiButton)this.buttonList.get(0));
  132. }
  133. ((GuiButton)this.buttonList.get(0)).enabled = (this.usernameBox.getText().length() > 3);
  134. }
  135.  
  136. public void drawScreen(int x, int y, float f)
  137. {
  138. drawDefaultBackground();
  139. drawString(this.mc.fontRendererObj, "Username", this.width / 2 - 100, 38, 10526880);
  140. drawString(this.mc.fontRendererObj, "§4*", this.width / 2 - 106, 38, 10526880);
  141. drawString(this.mc.fontRendererObj, "Password", this.width / 2 - 100, 79, 10526880);
  142. if (Values.premium) {
  143. this.mc.fontRendererObj.drawString("Username: §7" + this.mc.session.getUsername(), 3, 3, 16777215);
  144. } else {
  145. this.mc.fontRendererObj.drawString("Cracked as: §7" + this.mc.session.getUsername(), 3, 3, 16777215);
  146. }
  147. try
  148. {
  149. this.usernameBox.drawTextBox();
  150. this.passwordBox.drawTextBox();
  151. }
  152. catch (Exception err)
  153. {
  154. err.printStackTrace();
  155. }
  156. super.drawScreen(x, y, f);
  157. }
  158. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement