diff --git a/src/main/java/minegame159/meteorclient/gui/screens/ProxiesScreen.java b/src/main/java/minegame159/meteorclient/gui/screens/ProxiesScreen.java index 022b88cb16..97eaab445d 100644 --- a/src/main/java/minegame159/meteorclient/gui/screens/ProxiesScreen.java +++ b/src/main/java/minegame159/meteorclient/gui/screens/ProxiesScreen.java @@ -66,6 +66,10 @@ private void initWidgets() { checkboxes.get(index).checked = checked; }; + // Name + WLabel name = table.add(theme.label(proxy.name)).widget(); + name.color = theme.textColor(); + // Type WLabel type = table.add(theme.label("(" + proxy.type + ")")).widget(); type.color = theme.textSecondaryColor(); @@ -108,6 +112,12 @@ public EditProxyScreen(GuiTheme theme, Proxy p) { // General WTable general = add(theme.table()).expandX().widget(); + // Name + general.add(theme.label("Proxy Name:")); + WTextBox name = general.add(theme.textBox(proxy.name)).expandX().widget(); + name.action = () -> proxy.name = name.get(); + general.row(); + // Type general.add(theme.label("Type:")); WDropdown type = general.add(theme.dropdown(proxy.type)).widget(); diff --git a/src/main/java/minegame159/meteorclient/mixin/MultiplayerScreenMixin.java b/src/main/java/minegame159/meteorclient/mixin/MultiplayerScreenMixin.java index 91b10e8e70..c22e7aea57 100644 --- a/src/main/java/minegame159/meteorclient/mixin/MultiplayerScreenMixin.java +++ b/src/main/java/minegame159/meteorclient/mixin/MultiplayerScreenMixin.java @@ -66,7 +66,7 @@ private void onRender(MatrixStack matrices, int mouseX, int mouseY, float delta, Proxy proxy = Proxies.get().getEnabled(); String left = proxy != null ? "Using proxy " : "Not using a proxy"; - String right = proxy != null ? proxy.ip + ":" + proxy.port : null; + String right = proxy != null ? "(" + proxy.name + ") " + proxy.ip + ":" + proxy.port : null; textRenderer.drawWithShadow(matrices, left, x, y, textColor1); if (right != null) textRenderer.drawWithShadow(matrices, right, x + textRenderer.getWidth(left), y, textColor2); diff --git a/src/main/java/minegame159/meteorclient/systems/proxies/Proxy.java b/src/main/java/minegame159/meteorclient/systems/proxies/Proxy.java index ae1310de2a..ee85f54f42 100644 --- a/src/main/java/minegame159/meteorclient/systems/proxies/Proxy.java +++ b/src/main/java/minegame159/meteorclient/systems/proxies/Proxy.java @@ -17,13 +17,14 @@ public class Proxy implements ISerializable { public String ip = ""; public int port = 0; + public String name = ""; public String username = ""; public String password = ""; public boolean enabled = false; public boolean isValid() { - return IP_PATTERN.matcher(ip).matches() && port >= 0 && port <= 65535; + return IP_PATTERN.matcher(ip).matches() && port >= 0 && port <= 65535 && !name.isEmpty(); } @Override @@ -34,6 +35,7 @@ public CompoundTag toTag() { tag.putString("ip", ip); tag.putInt("port", port); + tag.putString("name", name); tag.putString("username", username); tag.putString("password", password); @@ -48,6 +50,7 @@ public Proxy fromTag(CompoundTag tag) { ip = tag.getString("ip"); port = tag.getInt("port"); + name = tag.getString("name"); username = tag.getString("username"); password = tag.getString("password");