Modernize lock object declarations from object to System.Threading.Lock

Replace all lock object declarations using 'object' type with the C# 13
System.Threading.Lock type across 12 files. The Lock type provides a
more efficient locking mechanism - when used with lock(), the compiler
automatically uses Lock.EnterScope() instead of Monitor.Enter/Exit.

Also made two previously non-readonly lock fields readonly:
- McClient.DigLock
- Protocol18.MessageSigningLock

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-03-24 00:15:21 +00:00
parent e09b997cdf
commit 74def7c512
12 changed files with 24 additions and 16 deletions

View file

@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Threading;
using MinecraftClient.CommandHandler;
using MinecraftClient.Scripting;
using Tomlet.Attributes;
@ -50,7 +51,7 @@ namespace MinecraftClient.ChatBots
private bool saveChat = true;
private bool savePrivate = true;
private bool saveInternal = true;
private readonly object logfileLock = new();
private readonly Lock logfileLock = new();
/// <summary>
/// This bot saves the messages received in the specified file, with some filters and date/time tagging.