mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
Implement console chat visibility controls
Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/159bd460-7950-4afe-9e69-4892220665e1 Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
This commit is contained in:
parent
9c994de2ee
commit
7bf342baab
14 changed files with 226 additions and 2 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
|
@ -61,6 +62,11 @@ namespace MinecraftClient
|
|||
/// </summary>
|
||||
public static bool EnableTimestamps = false;
|
||||
|
||||
/// <summary>
|
||||
/// Determine whether chat lines should be displayed in the console.
|
||||
/// </summary>
|
||||
public static bool ChatVisible = true;
|
||||
|
||||
/// <summary>
|
||||
/// Specify a generic log line prefix for WriteLogLine()
|
||||
/// </summary>
|
||||
|
|
@ -155,6 +161,17 @@ namespace MinecraftClient
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write a formatted chat line to the console when chat output is enabled.
|
||||
/// </summary>
|
||||
public static void WriteChatLineFormatted(string str, bool acceptnewlines = false, bool? displayTimestamp = null)
|
||||
{
|
||||
if (!ChatVisible)
|
||||
return;
|
||||
|
||||
WriteLineFormatted(str, acceptnewlines, displayTimestamp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write a prefixed log line. Prefix is set in LogPrefix.
|
||||
/// </summary>
|
||||
|
|
@ -178,6 +195,30 @@ namespace MinecraftClient
|
|||
Backend.ClearInputBuffer();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clear the visible console output.
|
||||
/// </summary>
|
||||
public static void ClearConsole()
|
||||
{
|
||||
if (BasicIO || Backend is null)
|
||||
{
|
||||
try
|
||||
{
|
||||
Console.Clear();
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
}
|
||||
catch (PlatformNotSupportedException)
|
||||
{
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Backend.ClearScreen();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
internal static bool AutoCompleteDone = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue