Password Hiding

This commit is contained in:
PeytonPlayz595 2024-01-15 19:24:44 +00:00
parent 28c0a7f9d9
commit b713c4e31d
9 changed files with 104288 additions and 104194 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -207,6 +207,10 @@ public class Config {
return Minecraft.getMinecraft().gameSettings.ofDynamicFov; return Minecraft.getMinecraft().gameSettings.ofDynamicFov;
} }
public static boolean isPasswordHidden() {
return Minecraft.getMinecraft().gameSettings.hidePassword;
}
public static int getMipmapType() { public static int getMipmapType() {
switch (Minecraft.getMinecraft().gameSettings.ofMipmapType) { switch (Minecraft.getMinecraft().gameSettings.ofMipmapType) {
case 0: case 0:

View File

@ -14,7 +14,7 @@ public class GuiOther extends GuiScreen implements GuiYesNoCallback {
private GuiScreen prevScreen; private GuiScreen prevScreen;
protected String title; protected String title;
private GameSettings settings; private GameSettings settings;
private static GameSettings.Options[] enumOptions = new GameSettings.Options[] {GameSettings.Options.LAGOMETER, GameSettings.Options.PROFILER, GameSettings.Options.FULLSCREEN, GameSettings.Options.HUD_FPS, GameSettings.Options.HUD_COORDS, GameSettings.Options.HUD_STATS, GameSettings.Options.HUD_WORLD, GameSettings.Options.HUD_PLAYER, GameSettings.Options.HUD_24H, GameSettings.Options.ANAGLYPH}; private static GameSettings.Options[] enumOptions = new GameSettings.Options[] {GameSettings.Options.LAGOMETER, GameSettings.Options.PROFILER, GameSettings.Options.FULLSCREEN, GameSettings.Options.HUD_FPS, GameSettings.Options.HUD_COORDS, GameSettings.Options.HUD_STATS, GameSettings.Options.HUD_WORLD, GameSettings.Options.HUD_PLAYER, GameSettings.Options.HUD_24H, GameSettings.Options.ANAGLYPH, GameSettings.Options.HIDE_PASSWORD};
public GuiOther(GuiScreen p_i51_1_) { public GuiOther(GuiScreen p_i51_1_) {
this.prevScreen = p_i51_1_; this.prevScreen = p_i51_1_;

View File

@ -7,6 +7,7 @@ import org.apache.commons.lang3.StringUtils;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import net.PeytonPlayz585.shadow.Config;
import net.lax1dude.eaglercraft.v1_8.Keyboard; import net.lax1dude.eaglercraft.v1_8.Keyboard;
import net.lax1dude.eaglercraft.v1_8.Mouse; import net.lax1dude.eaglercraft.v1_8.Mouse;
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager; import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
@ -286,6 +287,9 @@ public class GuiChat extends GuiScreen {
public void drawScreen(int i, int j, float f) { public void drawScreen(int i, int j, float f) {
drawRect(2, this.height - 14, this.width - 2, this.height - 2, Integer.MIN_VALUE); drawRect(2, this.height - 14, this.width - 2, this.height - 2, Integer.MIN_VALUE);
this.inputField.drawTextBox(); this.inputField.drawTextBox();
if (this.inputField.isTypingPassword && Config.isPasswordHidden()) {
this.mc.fontRendererObj.drawStringWithShadow("Password Hidden", 2, this.height - 25, 16770425);
}
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
IChatComponent ichatcomponent = this.mc.ingameGUI.getChatGUI().getChatComponent(Mouse.getX(), Mouse.getY()); IChatComponent ichatcomponent = this.mc.ingameGUI.getChatGUI().getChatComponent(Mouse.getX(), Mouse.getY());
if (ichatcomponent != null && ichatcomponent.getChatStyle().getChatHoverEvent() != null) { if (ichatcomponent != null && ichatcomponent.getChatStyle().getChatHoverEvent() != null) {

View File

@ -5,6 +5,7 @@ import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import net.PeytonPlayz585.shadow.Config;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager; import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer; import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
@ -67,6 +68,8 @@ public class GuiTextField extends Gui {
private GuiPageButtonList.GuiResponder field_175210_x; private GuiPageButtonList.GuiResponder field_175210_x;
private Predicate<String> field_175209_y = Predicates.alwaysTrue(); 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) { public GuiTextField(int componentId, FontRenderer fontrendererObj, int x, int y, int par5Width, int par6Height) {
this.id = componentId; this.id = componentId;
this.fontRendererInstance = fontrendererObj; this.fontRendererInstance = fontrendererObj;
@ -461,7 +464,45 @@ public class GuiTextField extends Gui {
if (s.length() > 0) { if (s.length() > 0) {
String s1 = flag ? s.substring(0, j) : s; String s1 = flag ? s.substring(0, j) : s;
j1 = this.fontRendererInstance.drawStringWithShadow(s1, (float) l, (float) i1, i); String s2 = s1;
if(Config.isPasswordHidden()) {
if (s1.startsWith("/l ") || s1.startsWith("/login ") || s1.startsWith("/log ") || s1.startsWith("/register ")) {
s2 = "";
String 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(5);
}
if(s1.startsWith("/register ")) {
s2 = s1.substring(0, 10);
password = s1.substring(10);
}
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);
} }
boolean flag2 = this.cursorPosition < this.text.length() || this.text.length() >= this.getMaxStringLength(); boolean flag2 = this.cursorPosition < this.text.length() || this.text.length() >= this.getMaxStringLength();

View File

@ -258,6 +258,7 @@ public class GameSettings {
public boolean chunkBorders = false; public boolean chunkBorders = false;
public boolean ofLagometer = false; public boolean ofLagometer = false;
public boolean ofProfiler = false; public boolean ofProfiler = false;
public boolean hidePassword = true;
public GameSettings(Minecraft mcIn) { public GameSettings(Minecraft mcIn) {
this.keyBindings = (KeyBinding[]) ArrayUtils.addAll(new KeyBinding[] { this.keyBindAttack, this.keyBindUseItem, this.keyBindings = (KeyBinding[]) ArrayUtils.addAll(new KeyBinding[] { this.keyBindAttack, this.keyBindUseItem,
@ -786,6 +787,10 @@ public class GameSettings {
this.ofProfiler = !this.ofProfiler; this.ofProfiler = !this.ofProfiler;
} }
if (parOptions == GameSettings.Options.HIDE_PASSWORD) {
this.hidePassword = !this.hidePassword;
}
this.saveOptions(); this.saveOptions();
} }
@ -878,6 +883,8 @@ public class GameSettings {
return ofLagometer; return ofLagometer;
case PROFILER: case PROFILER:
return ofProfiler; return ofProfiler;
case HIDE_PASSWORD:
return hidePassword;
default: default:
return false; return false;
} }
@ -1146,6 +1153,8 @@ public class GameSettings {
return this.ofLagometer ? s + "ON" : s + "OFF"; return this.ofLagometer ? s + "ON" : s + "OFF";
} else if (parOptions == GameSettings.Options.PROFILER) { } else if (parOptions == GameSettings.Options.PROFILER) {
return this.ofProfiler ? s + "ON" : s + "OFF"; return this.ofProfiler ? s + "ON" : s + "OFF";
} else if (parOptions == GameSettings.Options.HIDE_PASSWORD) {
return hidePassword ? s + "ON" : s + "OFF";
} else { } else {
return s; return s;
} }
@ -1639,6 +1648,10 @@ public class GameSettings {
this.ofProfiler = Boolean.valueOf(astring[1]).booleanValue(); this.ofProfiler = Boolean.valueOf(astring[1]).booleanValue();
} }
if (astring[0].equals("hidePassword") && astring.length >= 2) {
this.hidePassword = Boolean.valueOf(astring[1]).booleanValue();
}
Keyboard.setFunctionKeyModifier(keyBindFunction.getKeyCode()); Keyboard.setFunctionKeyModifier(keyBindFunction.getKeyCode());
for (SoundCategory soundcategory : SoundCategory.values()) { for (SoundCategory soundcategory : SoundCategory.values()) {
@ -1793,6 +1806,7 @@ public class GameSettings {
printwriter.println("toggleSprint:" + toggleSprint); printwriter.println("toggleSprint:" + toggleSprint);
printwriter.println("ofLagometer:" + this.ofLagometer); printwriter.println("ofLagometer:" + this.ofLagometer);
printwriter.println("ofProfiler:" + this.ofProfiler); printwriter.println("ofProfiler:" + this.ofProfiler);
printwriter.println("hidePassword:" + this.hidePassword);
for (KeyBinding keybinding : this.keyBindings) { for (KeyBinding keybinding : this.keyBindings) {
printwriter.println("key_" + keybinding.getKeyDescription() + ":" + keybinding.getKeyCode()); printwriter.println("key_" + keybinding.getKeyDescription() + ":" + keybinding.getKeyCode());
@ -1985,7 +1999,8 @@ public class GameSettings {
TOGGLE_SPRINT("Sprint", false, false), TOGGLE_SPRINT("Sprint", false, false),
LEFT_HAND("Main Hand", false, false), LEFT_HAND("Main Hand", false, false),
LAGOMETER("Lagometer", false, false), LAGOMETER("Lagometer", false, false),
PROFILER("Profiler", false, false); PROFILER("Profiler", false, false),
HIDE_PASSWORD("Hide Password", false, false);
private final boolean enumFloat; private final boolean enumFloat;
private final boolean enumBoolean; private final boolean enumBoolean;