diff --git a/NitroxClient/MonoBehaviours/Gui/MainMenu/MainMenuServerListPanel.cs b/NitroxClient/MonoBehaviours/Gui/MainMenu/MainMenuServerListPanel.cs
index 0e8d050aa..0819466e7 100644
--- a/NitroxClient/MonoBehaviours/Gui/MainMenu/MainMenuServerListPanel.cs
+++ b/NitroxClient/MonoBehaviours/Gui/MainMenu/MainMenuServerListPanel.cs
@@ -1,4 +1,6 @@
+using System;
using System.Net;
+using System.Text;
using System.Threading.Tasks;
using FMODUnity;
using NitroxClient.Communication;
@@ -235,14 +237,22 @@ void AddButton(IPEndPoint serverEndPoint)
public void CreateServerButton(string serverName, string address, int port, bool isReadOnly = false)
{
- string HideIfNecessary(object text) => NitroxPrefs.HideIp.Value ? "****" : $"{text}";
-
GameObject multiplayerButtonInst = Instantiate(multiplayerButtonRef, serverAreaContent, false);
multiplayerButtonInst.name = $"NitroxServer_{serverAreaContent.childCount - 1}";
- string text = $"{Language.main.Get("Nitrox_ConnectTo")} {serverName}\n{HideIfNecessary(address)}:{HideIfNecessary(port)}";
+ StringBuilder buttonText = new();
+ buttonText.Append(Language.main.Get("Nitrox_ConnectTo")).Append(" ").Append(serverName).AppendLine("");
+ if (NitroxPrefs.HideIp.Value)
+ {
+ buttonText.AppendLine("***.***.***.***").AppendLine("*****");
+ }
+ else
+ {
+ buttonText.Append(address[^Math.Min(address.Length, 25)..]).Append(':').Append(port);
+ }
+
MainMenuServerButton serverButton = multiplayerButtonInst.AddComponent();
- serverButton.Init(text, address, port, isReadOnly);
+ serverButton.Init(buttonText.ToString(), address, port, isReadOnly);
EventTrigger[] eventTriggers = multiplayerButtonInst.GetComponentsInChildren(true); // One from the normal and one from the delete button
ForwardTriggerScrollToScrollRect(eventTriggers[0]);