fix password hiding
This commit is contained in:
parent
c501b8899d
commit
9f853cf993
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -13,3 +13,4 @@ desktopRuntime/hs_err_*
|
|||
desktopRuntime/crash-reports/*
|
||||
desktopRuntime/options.txt
|
||||
desktopRuntime/_eagstorage*
|
||||
/.metadata/
|
||||
|
|
|
@ -284,6 +284,9 @@ public class GuiChat extends GuiScreen {
|
|||
GlUtils.startTranslate(0, 29 - (int) animation.getValue());
|
||||
drawRect(2, this.height - 14, this.width - 2, this.height - 2, Integer.MIN_VALUE);
|
||||
this.inputField.drawTextBox();
|
||||
if (this.inputField.isTypingPassword)
|
||||
this.mc.fontRendererObj.drawStringWithShadow("Password Hidden", 2, this.height - 25, 16770425);
|
||||
|
||||
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
IChatComponent ichatcomponent = this.mc.ingameGUI.getChatGUI().getChatComponent(Mouse.getX(), Mouse.getY());
|
||||
if (ichatcomponent != null && ichatcomponent.getChatStyle().getChatHoverEvent() != null) {
|
||||
|
|
|
@ -67,6 +67,8 @@ public class GuiTextField extends Gui {
|
|||
private GuiPageButtonList.GuiResponder field_175210_x;
|
||||
private Predicate<String> field_175209_y = Predicates.alwaysTrue();
|
||||
|
||||
public boolean isTypingPassword = false;
|
||||
|
||||
public GuiTextField(int componentId, FontRenderer fontrendererObj, int x, int y, int par5Width, int par6Height) {
|
||||
this.id = componentId;
|
||||
this.fontRendererInstance = fontrendererObj;
|
||||
|
@ -451,9 +453,48 @@ public class GuiTextField extends Gui {
|
|||
k = s.length();
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (s.length() > 0) {
|
||||
String s1 = flag ? s.substring(0, j) : s;
|
||||
String s2 = s1.startsWith("/login ") ? "/login *" : s1.startsWith("/l ") ? "/l *" : s1;
|
||||
|
||||
String s1 = flag ? s.substring(0, j) : s;
|
||||
String s2 = s1;
|
||||
|
||||
if (s1.startsWith("/l ") || s1.startsWith("/login ") || s1.startsWith("/log ")) {
|
||||
s2 = "";
|
||||
String password = "";
|
||||
// password isnt sent anywhere, its just used for counting how many "*" you need for hiding the password.
|
||||
|
||||
if (s1.startsWith("/l ")) {
|
||||
s2 = s1.substring(0, 3);
|
||||
password = s1.substring(3);
|
||||
}
|
||||
|
||||
if (s1.startsWith("/login ")) {
|
||||
s2 = s1.substring(0, 7);
|
||||
password = s1.substring(7);
|
||||
}
|
||||
|
||||
if (s1.startsWith("/log ")) {
|
||||
s2 = s1.substring(0, 5);
|
||||
password = s1.substring(7);
|
||||
}
|
||||
|
||||
if (password.length() > 0) {
|
||||
isTypingPassword = true;
|
||||
for (int n = 0; n < password.length(); n++) {
|
||||
s2 += "*";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
isTypingPassword = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
j1 = this.fontRendererInstance.drawStringWithShadow(s2, (float) l, (float) i1, i);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user