mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
Address code review: fix party max, rename food variable, add ShowServerAddress option
Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com> Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/43388021-4264-47e6-8403-7a1bca66d86f
This commit is contained in:
parent
a2d032b549
commit
8743129e72
3 changed files with 21 additions and 5 deletions
|
|
@ -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())
|
||||
|
|
|
|||
|
|
@ -970,6 +970,15 @@ namespace MinecraftClient {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Show the server address (host and port) in the Discord presence..
|
||||
/// </summary>
|
||||
internal static string ChatBot_DiscordRpc_ShowServerAddress {
|
||||
get {
|
||||
return ResourceManager.GetString("ChatBot.DiscordRpc.ShowServerAddress", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Show elapsed session time in the Discord presence..
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -852,6 +852,9 @@ If the connection to the Minecraft game server is blocked by the firewall, set E
|
|||
<data name="ChatBot.DiscordRpc.SmallImageText" xml:space="preserve">
|
||||
<value>Tooltip text for the small image. Supports placeholders.</value>
|
||||
</data>
|
||||
<data name="ChatBot.DiscordRpc.ShowServerAddress" xml:space="preserve">
|
||||
<value>Show the server address (host and port) in the Discord presence. When disabled, {server_host} and {server_port} are masked for privacy.</value>
|
||||
</data>
|
||||
<data name="ChatBot.DiscordRpc.ShowElapsedTime" xml:space="preserve">
|
||||
<value>Show elapsed session time in the Discord presence.</value>
|
||||
</data>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue