summaryrefslogtreecommitdiff
path: root/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-04-13 22:06:07 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-04-13 22:06:07 -0400
commit2765e3f9b379f0dc2a5732c1ca9ba23dbe2a7f15 (patch)
tree3b97dd4aa6e9b7971dafa139c64a39c31e841fe6 /src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World
parentaa7b0caf4656d65ee156c3cf5ea786f561b850bb (diff)
downloadSMAPI-2765e3f9b379f0dc2a5732c1ca9ba23dbe2a7f15.tar.gz
SMAPI-2765e3f9b379f0dc2a5732c1ca9ba23dbe2a7f15.tar.bz2
SMAPI-2765e3f9b379f0dc2a5732c1ca9ba23dbe2a7f15.zip
enable nullable annotations in bundled mods (#837)
Diffstat (limited to 'src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World')
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs23
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/DownMineLevelCommand.cs2
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/FreezeTimeCommand.cs2
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/HurryAllCommand.cs2
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetDayCommand.cs2
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetMineLevelCommand.cs2
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetSeasonCommand.cs4
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetTimeCommand.cs2
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetYearCommand.cs2
9 files changed, 12 insertions, 29 deletions
diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs
index 92c73e08..4905b89a 100644
--- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs
+++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs
@@ -1,8 +1,7 @@
-#nullable disable
-
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
+using Microsoft.Xna.Framework;
using StardewValley;
using StardewValley.Locations;
using StardewValley.Objects;
@@ -53,13 +52,13 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.World
}
// parse arguments
- if (!args.TryGet(0, "location", out string locationName, required: true))
+ if (!args.TryGet(0, "location", out string? locationName, required: true))
return;
- if (!args.TryGet(1, "object type", out string type, required: true, oneOf: this.ValidTypes))
+ if (!args.TryGet(1, "object type", out string? type, required: true, oneOf: this.ValidTypes))
return;
// get target location
- GameLocation location = Game1.locations.FirstOrDefault(p => p.Name != null && p.Name.Equals(locationName, StringComparison.OrdinalIgnoreCase));
+ GameLocation? location = Game1.locations.FirstOrDefault(p => p.Name != null && p.Name.Equals(locationName, StringComparison.OrdinalIgnoreCase));
if (location == null && locationName == "current")
location = Game1.currentLocation;
if (location == null)
@@ -168,11 +167,11 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.World
{
int removed = 0;
- foreach (var pair in location.Objects.Pairs.ToArray())
+ foreach ((Vector2 tile, SObject? obj) in location.Objects.Pairs.ToArray())
{
- if (shouldRemove(pair.Value))
+ if (shouldRemove(obj))
{
- location.Objects.Remove(pair.Key);
+ location.Objects.Remove(tile);
removed++;
}
}
@@ -188,11 +187,11 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.World
{
int removed = 0;
- foreach (var pair in location.terrainFeatures.Pairs.ToArray())
+ foreach ((Vector2 tile, TerrainFeature? feature) in location.terrainFeatures.Pairs.ToArray())
{
- if (shouldRemove(pair.Value))
+ if (shouldRemove(feature))
{
- location.terrainFeatures.Remove(pair.Key);
+ location.terrainFeatures.Remove(tile);
removed++;
}
}
@@ -228,7 +227,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.World
{
int removed = 0;
- foreach (var clump in location.resourceClumps.Where(shouldRemove).ToArray())
+ foreach (ResourceClump clump in location.resourceClumps.Where(shouldRemove).ToArray())
{
location.resourceClumps.Remove(clump);
removed++;
diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/DownMineLevelCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/DownMineLevelCommand.cs
index 0f18c760..5b1a4a13 100644
--- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/DownMineLevelCommand.cs
+++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/DownMineLevelCommand.cs
@@ -1,5 +1,3 @@
-#nullable disable
-
using System.Diagnostics.CodeAnalysis;
using StardewValley;
using StardewValley.Locations;
diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/FreezeTimeCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/FreezeTimeCommand.cs
index 8808fe35..16faa2fe 100644
--- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/FreezeTimeCommand.cs
+++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/FreezeTimeCommand.cs
@@ -1,5 +1,3 @@
-#nullable disable
-
using System.Linq;
using StardewValley;
diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/HurryAllCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/HurryAllCommand.cs
index f9810dc3..09531720 100644
--- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/HurryAllCommand.cs
+++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/HurryAllCommand.cs
@@ -1,5 +1,3 @@
-#nullable disable
-
using System;
using System.Diagnostics.CodeAnalysis;
using StardewValley;
diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetDayCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetDayCommand.cs
index 8aa27d93..399fd934 100644
--- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetDayCommand.cs
+++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetDayCommand.cs
@@ -1,5 +1,3 @@
-#nullable disable
-
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using StardewModdingAPI.Utilities;
diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetMineLevelCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetMineLevelCommand.cs
index ad6ac777..f977fce3 100644
--- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetMineLevelCommand.cs
+++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetMineLevelCommand.cs
@@ -1,5 +1,3 @@
-#nullable disable
-
using System;
using System.Diagnostics.CodeAnalysis;
using StardewValley;
diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetSeasonCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetSeasonCommand.cs
index ebe58913..505c0d1d 100644
--- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetSeasonCommand.cs
+++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetSeasonCommand.cs
@@ -1,5 +1,3 @@
-#nullable disable
-
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using StardewModdingAPI.Utilities;
@@ -39,7 +37,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.World
}
// parse arguments
- if (!args.TryGet(0, "season", out string season, oneOf: this.ValidSeasons))
+ if (!args.TryGet(0, "season", out string? season, oneOf: this.ValidSeasons))
return;
// handle
diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetTimeCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetTimeCommand.cs
index 1e6bab96..8c4458dd 100644
--- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetTimeCommand.cs
+++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetTimeCommand.cs
@@ -1,5 +1,3 @@
-#nullable disable
-
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Microsoft.Xna.Framework;
diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetYearCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetYearCommand.cs
index 995f222e..a666a634 100644
--- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetYearCommand.cs
+++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetYearCommand.cs
@@ -1,5 +1,3 @@
-#nullable disable
-
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using StardewModdingAPI.Utilities;