mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
refactor: use pattern matching for null checks (is null / is not null)
Convert remaining == null to is null and != null to is not null across 17 files in CommandHandler/ArgumentType, StructuredComponents, and DeclareCommands for idiomatic C# style. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
c7bc25aa17
commit
94bf42710a
17 changed files with 33 additions and 33 deletions
|
|
@ -44,7 +44,7 @@ public class BlockPredicateSubcomponent(DataTypes dataTypes, SubComponentRegistr
|
|||
data.AddRange(DataTypes.GetBool(HasBlocks));
|
||||
if (HasBlocks)
|
||||
{
|
||||
if(BlockSet == null)
|
||||
if(BlockSet is null)
|
||||
throw new ArgumentNullException($"Can not serialize a BlockPredicate when the BlockSet is empty but HasBlocks is true!");
|
||||
|
||||
data.AddRange(BlockSet.Serialize());
|
||||
|
|
@ -54,7 +54,7 @@ public class BlockPredicateSubcomponent(DataTypes dataTypes, SubComponentRegistr
|
|||
data.AddRange(DataTypes.GetBool(HasProperities));
|
||||
if (HasProperities)
|
||||
{
|
||||
if(Properties == null || Properties.Count == 0)
|
||||
if(Properties is null || Properties.Count == 0)
|
||||
throw new ArgumentNullException($"Can not serialize a BlockPredicate when the Properties is empty but HasProperties is true!");
|
||||
|
||||
data.AddRange(DataTypes.GetVarInt(Properties.Count));
|
||||
|
|
@ -66,7 +66,7 @@ public class BlockPredicateSubcomponent(DataTypes dataTypes, SubComponentRegistr
|
|||
data.AddRange(DataTypes.GetBool(HasNbt));
|
||||
if (HasNbt)
|
||||
{
|
||||
if(Nbt == null)
|
||||
if(Nbt is null)
|
||||
throw new ArgumentNullException($"Can not serialize a BlockPredicate when the Nbt is empty but HasNbt is true!");
|
||||
|
||||
data.AddRange(DataTypes.GetNbt(Nbt));
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public class BlockSetSubcomponent(DataTypes dataTypes, SubComponentRegistry subC
|
|||
|
||||
if (Type == 0) return new Queue<byte>(data);
|
||||
|
||||
if(BlockIds == null || BlockIds.Count == 0)
|
||||
if(BlockIds is null || BlockIds.Count == 0)
|
||||
throw new ArgumentNullException($"Can not serialize an empty list of Block IDs in a Block Set when the type is not 0!");
|
||||
|
||||
for(var i = 0; i < Type - 1; i++)
|
||||
|
|
|
|||
|
|
@ -47,12 +47,12 @@ public class PropertySubComponent(DataTypes dataTypes, SubComponentRegistry subC
|
|||
}
|
||||
else
|
||||
{
|
||||
data.AddRange(DataTypes.GetBool(MinValue != null));
|
||||
if (MinValue != null)
|
||||
data.AddRange(DataTypes.GetBool(MinValue is not null));
|
||||
if (MinValue is not null)
|
||||
data.AddRange(DataTypes.GetString(MinValue));
|
||||
|
||||
data.AddRange(DataTypes.GetBool(MaxValue != null));
|
||||
if (MaxValue != null)
|
||||
data.AddRange(DataTypes.GetBool(MaxValue is not null));
|
||||
if (MaxValue is not null)
|
||||
data.AddRange(DataTypes.GetString(MaxValue));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue