mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-29 13:04:59 +00:00
refactor: convert == null / != null to is null / is not null in 31 files
Replace old-style null comparisons with modern C# pattern matching syntax across Commands, Protocol, Mapping, ChatBots, Physics, Inventory, Logger, CommandHandler, Scripting, Crypto, and other modules. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
446c6e7739
commit
c7bc25aa17
31 changed files with 77 additions and 77 deletions
|
|
@ -92,7 +92,7 @@ namespace MinecraftClient.Commands
|
|||
sb.Append('\n');
|
||||
|
||||
sb.AppendLine(string.Format(Translations.cmd_chunk_current, current, current.ChunkX, current.ChunkZ));
|
||||
if (markedChunkPos != null)
|
||||
if (markedChunkPos is not null)
|
||||
{
|
||||
sb.Append(Translations.cmd_chunk_marked);
|
||||
if (pos.HasValue)
|
||||
|
|
@ -120,7 +120,7 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
for (int x = startX; x <= endX; ++x)
|
||||
{
|
||||
if (world[x, z] != null)
|
||||
if (world[x, z] is not null)
|
||||
{
|
||||
leftMost = Math.Min(leftMost, x);
|
||||
rightMost = Math.Max(rightMost, x);
|
||||
|
|
@ -184,7 +184,7 @@ namespace MinecraftClient.Commands
|
|||
}
|
||||
|
||||
// Try to include the marker chunk
|
||||
if (markedChunkPos != null &&
|
||||
if (markedChunkPos is not null &&
|
||||
(((Math.Max(bottomMost, markChunkZ) - Math.Min(topMost, markChunkZ) + 1) > consoleHeight) ||
|
||||
((Math.Max(rightMost, markChunkX) - Math.Min(leftMost, markChunkX) + 1) > consoleWidth)))
|
||||
sb.AppendLine(Translations.cmd_chunk_outside);
|
||||
|
|
@ -212,7 +212,7 @@ namespace MinecraftClient.Commands
|
|||
sb.Append("§§4"); // Marked chunk: background red
|
||||
|
||||
ChunkColumn? chunkColumn = world[x, z];
|
||||
if (chunkColumn == null)
|
||||
if (chunkColumn is null)
|
||||
sb.Append(chunkStatusStr[0]);
|
||||
else if (chunkColumn.FullyLoaded)
|
||||
sb.Append(chunkStatusStr[2]);
|
||||
|
|
@ -242,10 +242,10 @@ namespace MinecraftClient.Commands
|
|||
handler.Log.Info(Translations.cmd_chunk_for_debug);
|
||||
(int chunkX, int chunkZ) = markedChunkPos ?? new(pos!.Value.ChunkX, pos!.Value.ChunkZ);
|
||||
ChunkColumn? chunkColumn = handler.GetWorld()[chunkX, chunkZ];
|
||||
if (chunkColumn != null)
|
||||
if (chunkColumn is not null)
|
||||
chunkColumn.FullyLoaded = false;
|
||||
|
||||
if (chunkColumn == null)
|
||||
if (chunkColumn is null)
|
||||
return r.SetAndReturn(Status.Fail, "Fail: chunk dosen't exist!");
|
||||
else
|
||||
return r.SetAndReturn(Status.Done, string.Format("Successfully marked chunk ({0}, {1}) as loading.", chunkX, chunkZ));
|
||||
|
|
@ -262,10 +262,10 @@ namespace MinecraftClient.Commands
|
|||
handler.Log.Info(Translations.cmd_chunk_for_debug);
|
||||
(int chunkX, int chunkZ) = markedChunkPos ?? new(pos!.Value.ChunkX, pos!.Value.ChunkZ);
|
||||
ChunkColumn? chunkColumn = handler.GetWorld()[chunkX, chunkZ];
|
||||
if (chunkColumn != null)
|
||||
if (chunkColumn is not null)
|
||||
chunkColumn.FullyLoaded = false;
|
||||
|
||||
if (chunkColumn == null)
|
||||
if (chunkColumn is null)
|
||||
return r.SetAndReturn(Status.Fail, "Fail: chunk dosen't exist!");
|
||||
else
|
||||
return r.SetAndReturn(Status.Done, string.Format("Successfully marked chunk ({0}, {1}) as loaded.", chunkX, chunkZ));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue