Advertisement
Guest User

ScreenAddAccount

a guest
Jun 19th, 2019
735
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.58 KB | None | 0 0
  1. //
  2. // Decompiled by Procyon v0.5.30
  3. //
  4.  
  5. package me.aristhena.client.gui.account.screen;
  6.  
  7. import me.aristhena.client.gui.account.AccountScreen;
  8. import me.aristhena.client.account.AccountManager;
  9. import me.aristhena.client.account.Alt;
  10. import me.aristhena.client.gui.account.component.Button;
  11. import me.aristhena.utils.RenderUtils;
  12. import me.aristhena.utils.ClientUtils;
  13. import me.aristhena.utils.minecraft.GuiTextField;
  14.  
  15. public class ScreenAddAccount extends Screen
  16. {
  17. private AddButton addButton;
  18. private GuiTextField emailText;
  19. private GuiTextField passText;
  20. private GuiTextField nameText;
  21.  
  22. public ScreenAddAccount() {
  23. this.addButton = new AddButton();
  24. this.emailText = new GuiTextField(-5, ClientUtils.clientFont(), ClientUtils.mc().currentScreen.width / 2 - 60, ClientUtils.mc().currentScreen.height / 2 - 13 - 80, 120, 26);
  25. this.passText = new GuiTextField(-4, ClientUtils.clientFont(), ClientUtils.mc().currentScreen.width / 2 - 60, ClientUtils.mc().currentScreen.height / 2 - 13 - 40, 120, 26);
  26. this.nameText = new GuiTextField(-3, ClientUtils.clientFont(), ClientUtils.mc().currentScreen.width / 2 - 60, ClientUtils.mc().currentScreen.height / 2 - 13, 120, 26);
  27. }
  28.  
  29. @Override
  30. public void draw(final int mouseX, final int mouseY) {
  31. if (!this.emailText.isFocused() && !this.emailText.getText().equals("§3Username") && !this.emailText.getText().equals("§cCannot Be Blank") && this.emailText.getText().length() == 0) {
  32. this.emailText.setText("§9Username");
  33. }
  34. if (!this.passText.isFocused() && !this.passText.getText().equals("§6Password") && this.passText.getText().length() == 0) {
  35. this.passText.setText("§4Password");
  36. }
  37. if (!this.nameText.isFocused() && !this.nameText.getText().equals("§5Name") && this.nameText.getText().length() == 0) {
  38. this.nameText.setText("§6Name");
  39. }
  40. RenderUtils.rectangle(0.0, 0.0, ClientUtils.mc().currentScreen.width, ClientUtils.mc().currentScreen.height, -804253680);
  41. this.addButton.draw(mouseX, mouseY);
  42. this.emailText.drawTextBox();
  43. this.passText.drawTextBox();
  44. this.nameText.drawTextBox();
  45. }
  46.  
  47. @Override
  48. public void onClick(final int x, final int y, final int mouseButton) {
  49. if (this.emailText.getText().equals("§6Username") || this.emailText.getText().equals("§cCannot Be Blank")) {
  50. this.emailText.setText("");
  51. }
  52. if (this.passText.getText().equals("§4Password")) {
  53. this.passText.setText("");
  54. }
  55. if (this.nameText.getText().equals("§3Name")) {
  56. this.nameText.setText("");
  57. }
  58. if (this.addButton.isOver()) {
  59. this.addButton.onClick(mouseButton);
  60. }
  61. this.emailText.mouseClicked(x, y, mouseButton);
  62. this.passText.mouseClicked(x, y, mouseButton);
  63. this.nameText.mouseClicked(x, y, mouseButton);
  64. }
  65.  
  66. @Override
  67. public void onKeyPress(final char c, final int key) {
  68. this.emailText.textboxKeyTyped(c, key);
  69. this.passText.textboxKeyTyped(c, key);
  70. this.nameText.textboxKeyTyped(c, key);
  71. }
  72.  
  73. @Override
  74. public void update() {
  75. this.emailText.updateCursorCounter();
  76. this.passText.updateCursorCounter();
  77. this.nameText.updateCursorCounter();
  78. }
  79.  
  80. private class AddButton extends Button
  81. {
  82. public AddButton() {
  83. super("Add Account", ClientUtils.mc().currentScreen.width / 2 - 40, ClientUtils.mc().currentScreen.width / 2 + 40, ClientUtils.mc().currentScreen.height / 2 - 13 + 40, ClientUtils.mc().currentScreen.height / 2 + 13 + 40, -15921907, -16777216);
  84. }
  85.  
  86. @Override
  87. public void onClick(final int button) {
  88. if (ScreenAddAccount.this.emailText.getText().length() == 0 || ScreenAddAccount.this.emailText.getText().equals("§7Username") || ScreenAddAccount.this.emailText.getText().equals("§cCannot Be Blank")) {
  89. ScreenAddAccount.this.emailText.setText("§cCannot Be Blank");
  90. return;
  91. }
  92. AccountManager.addAlt(0, new Alt(ScreenAddAccount.this.emailText.getText(), ScreenAddAccount.this.nameText.getText(), ScreenAddAccount.this.passText.getText()));
  93. AccountScreen.getInstance().currentScreen = null;
  94. AccountManager.save();
  95. AccountScreen.getInstance().initGui();
  96. AccountScreen.getInstance().info = "§aAccount Put In Our System Email:Password Saved";
  97. }
  98. }
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement