diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2016-11-14 22:09:44 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2016-11-14 22:09:44 -0500 |
commit | aafdcaa2c5eed8201b3a0f735891ba03446ec70e (patch) | |
tree | 989a8c3867aade26c77ba79ef3827378439f0404 /src/StardewModdingAPI/Events/LocationEvents.cs | |
parent | bc8773bbddb017b8f67fcf6139f923069392e723 (diff) | |
download | SMAPI-aafdcaa2c5eed8201b3a0f735891ba03446ec70e.tar.gz SMAPI-aafdcaa2c5eed8201b3a0f735891ba03446ec70e.tar.bz2 SMAPI-aafdcaa2c5eed8201b3a0f735891ba03446ec70e.zip |
simplify null guards when rasing events
Diffstat (limited to 'src/StardewModdingAPI/Events/LocationEvents.cs')
-rw-r--r-- | src/StardewModdingAPI/Events/LocationEvents.cs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/StardewModdingAPI/Events/LocationEvents.cs b/src/StardewModdingAPI/Events/LocationEvents.cs index af2eb400..3c28f541 100644 --- a/src/StardewModdingAPI/Events/LocationEvents.cs +++ b/src/StardewModdingAPI/Events/LocationEvents.cs @@ -13,13 +13,13 @@ namespace StardewModdingAPI.Events ** Events *********/ /// <summary>Raised after the player warps to a new location.</summary> - public static event EventHandler<EventArgsCurrentLocationChanged> CurrentLocationChanged = delegate { }; + public static event EventHandler<EventArgsCurrentLocationChanged> CurrentLocationChanged; /// <summary>Raised after a game location is added or removed.</summary> - public static event EventHandler<EventArgsGameLocationsChanged> LocationsChanged = delegate { }; + public static event EventHandler<EventArgsGameLocationsChanged> LocationsChanged; /// <summary>Raised after the list of objects in the current location changes (e.g. an object is added or removed).</summary> - public static event EventHandler<EventArgsLocationObjectsChanged> LocationObjectsChanged = delegate { }; + public static event EventHandler<EventArgsLocationObjectsChanged> LocationObjectsChanged; /********* @@ -30,21 +30,21 @@ namespace StardewModdingAPI.Events /// <param name="newLocation">The player's current location.</param> internal static void InvokeCurrentLocationChanged(GameLocation priorLocation, GameLocation newLocation) { - LocationEvents.CurrentLocationChanged.Invoke(null, new EventArgsCurrentLocationChanged(priorLocation, newLocation)); + LocationEvents.CurrentLocationChanged?.Invoke(null, new EventArgsCurrentLocationChanged(priorLocation, newLocation)); } /// <summary>Raise a <see cref="LocationsChanged"/> event.</summary> /// <param name="newLocations">The current list of game locations.</param> internal static void InvokeLocationsChanged(List<GameLocation> newLocations) { - LocationEvents.LocationsChanged.Invoke(null, new EventArgsGameLocationsChanged(newLocations)); + LocationEvents.LocationsChanged?.Invoke(null, new EventArgsGameLocationsChanged(newLocations)); } /// <summary>Raise a <see cref="LocationObjectsChanged"/> event.</summary> /// <param name="newObjects">The current list of objects in the current location.</param> internal static void InvokeOnNewLocationObject(SerializableDictionary<Vector2, Object> newObjects) { - LocationEvents.LocationObjectsChanged.Invoke(null, new EventArgsLocationObjectsChanged(newObjects)); + LocationEvents.LocationObjectsChanged?.Invoke(null, new EventArgsLocationObjectsChanged(newObjects)); } } } |