diff --git a/MinecraftClient/ChatBots/DiscordRpc.cs b/MinecraftClient/ChatBots/DiscordRpc.cs index 0e17b910..3daa3ef4 100644 --- a/MinecraftClient/ChatBots/DiscordRpc.cs +++ b/MinecraftClient/ChatBots/DiscordRpc.cs @@ -46,6 +46,9 @@ namespace MinecraftClient.ChatBots [TomlInlineComment("$ChatBot.DiscordRpc.SmallImageText$")] public string SmallImageText = string.Empty; + [TomlInlineComment("$ChatBot.DiscordRpc.ShowServerAddress$")] + public bool ShowServerAddress = true; + [TomlInlineComment("$ChatBot.DiscordRpc.ShowElapsedTime$")] public bool ShowElapsedTime = true; @@ -222,7 +225,7 @@ namespace MinecraftClient.ChatBots { ID = $"mcc_{GetServerHost()}_{GetServerPort()}", Size = playerCount, - Max = Math.Max(playerCount, playerCount) + Max = playerCount }; } } @@ -240,11 +243,12 @@ namespace MinecraftClient.ChatBots if (string.IsNullOrEmpty(template)) return string.Empty; - string serverHost = GetServerHost(); + string serverHost = Config.ShowServerAddress ? GetServerHost() : "Hidden"; int serverPort = GetServerPort(); + string serverPortStr = Config.ShowServerAddress ? serverPort.ToString() : "****"; string username = GetUsername(); float health = Handler.GetHealth(); - int food = Handler.GetSaturation(); + int foodLevel = Handler.GetSaturation(); Location location = GetCurrentLocation(); string[] onlinePlayers = GetOnlinePlayers(); int gamemode = GetGamemode(); @@ -284,11 +288,11 @@ namespace MinecraftClient.ChatBots return template .Replace("{server_host}", serverHost) - .Replace("{server_port}", serverPort.ToString()) + .Replace("{server_port}", serverPortStr) .Replace("{username}", username) .Replace("{health}", ((int)Math.Ceiling(health)).ToString()) .Replace("{max_health}", "20") - .Replace("{food}", food.ToString()) + .Replace("{food}", foodLevel.ToString()) .Replace("{dimension}", dimensionName) .Replace("{gamemode}", gamemodeStr) .Replace("{x}", ((int)location.X).ToString()) diff --git a/MinecraftClient/Resources/ConfigComments/ConfigComments.Designer.cs b/MinecraftClient/Resources/ConfigComments/ConfigComments.Designer.cs index c01667d5..0caddf01 100644 --- a/MinecraftClient/Resources/ConfigComments/ConfigComments.Designer.cs +++ b/MinecraftClient/Resources/ConfigComments/ConfigComments.Designer.cs @@ -970,6 +970,15 @@ namespace MinecraftClient { } } + /// + /// Looks up a localized string similar to Show the server address (host and port) in the Discord presence.. + /// + internal static string ChatBot_DiscordRpc_ShowServerAddress { + get { + return ResourceManager.GetString("ChatBot.DiscordRpc.ShowServerAddress", resourceCulture); + } + } + /// /// Looks up a localized string similar to Show elapsed session time in the Discord presence.. /// diff --git a/MinecraftClient/Resources/ConfigComments/ConfigComments.resx b/MinecraftClient/Resources/ConfigComments/ConfigComments.resx index 0581b79c..2039e499 100644 --- a/MinecraftClient/Resources/ConfigComments/ConfigComments.resx +++ b/MinecraftClient/Resources/ConfigComments/ConfigComments.resx @@ -852,6 +852,9 @@ If the connection to the Minecraft game server is blocked by the firewall, set E Tooltip text for the small image. Supports placeholders. + + Show the server address (host and port) in the Discord presence. When disabled, {server_host} and {server_port} are masked for privacy. + Show elapsed session time in the Discord presence.