diff --git a/MinecraftClient/Settings.cs b/MinecraftClient/Settings.cs index a956e1df..0c25adb8 100644 --- a/MinecraftClient/Settings.cs +++ b/MinecraftClient/Settings.cs @@ -1174,10 +1174,10 @@ namespace MinecraftClient string varname = var_name.ToString(); string varname_lower = Settings.ToLowerIfNeed(varname); i = i + varname.Length + 1; - + if (TryGetReadOnlyVar(varname_lower, out object? readOnlyVar)) { - result.Append(readOnlyVar?.ToString()); + result.Append(readOnlyVar.ToString()); } else if (localVars is not null && localVars.ContainsKey(varname_lower)) { diff --git a/docs/guide/creating-text-script.md b/docs/guide/creating-text-script.md index 9ae2a6fb..ff07b67d 100644 --- a/docs/guide/creating-text-script.md +++ b/docs/guide/creating-text-script.md @@ -6,7 +6,7 @@ title: Creating Simple Script A simple script is a text file with one command per line. See the [Internal Commands](usage.md#internal-commands) section, or type `/help` in the console to see the available commands. Any line beginning with `#` is ignored and treated as a comment. -Application variables defined with the `set` command or in the `[AppVars]` config section can be used. The following read-only variables are also available: `%username%`, `%login%`, `%serverip%`, `%serverport%`, `%datetime%`, `%players%` (`%players%` expands to the current online player names separated by commas). +Application variables defined with the `set` command or in the `[AppVars]` config section can be used. The following read-only variables are also available: `%username%`, `%login%`, `%serverip%`, `%serverport%`, `%datetime%`, `%players%` (`%players%` expands to the current online player names separated by commas, or an empty string when not connected). ## Example