From aafdcaa2c5eed8201b3a0f735891ba03446ec70e Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 14 Nov 2016 22:09:44 -0500 Subject: simplify null guards when rasing events --- src/StardewModdingAPI/Events/LocationEvents.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/StardewModdingAPI/Events/LocationEvents.cs') 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 *********/ /// Raised after the player warps to a new location. - public static event EventHandler CurrentLocationChanged = delegate { }; + public static event EventHandler CurrentLocationChanged; /// Raised after a game location is added or removed. - public static event EventHandler LocationsChanged = delegate { }; + public static event EventHandler LocationsChanged; /// Raised after the list of objects in the current location changes (e.g. an object is added or removed). - public static event EventHandler LocationObjectsChanged = delegate { }; + public static event EventHandler LocationObjectsChanged; /********* @@ -30,21 +30,21 @@ namespace StardewModdingAPI.Events /// The player's current location. internal static void InvokeCurrentLocationChanged(GameLocation priorLocation, GameLocation newLocation) { - LocationEvents.CurrentLocationChanged.Invoke(null, new EventArgsCurrentLocationChanged(priorLocation, newLocation)); + LocationEvents.CurrentLocationChanged?.Invoke(null, new EventArgsCurrentLocationChanged(priorLocation, newLocation)); } /// Raise a event. /// The current list of game locations. internal static void InvokeLocationsChanged(List newLocations) { - LocationEvents.LocationsChanged.Invoke(null, new EventArgsGameLocationsChanged(newLocations)); + LocationEvents.LocationsChanged?.Invoke(null, new EventArgsGameLocationsChanged(newLocations)); } /// Raise a event. /// The current list of objects in the current location. internal static void InvokeOnNewLocationObject(SerializableDictionary newObjects) { - LocationEvents.LocationObjectsChanged.Invoke(null, new EventArgsLocationObjectsChanged(newObjects)); + LocationEvents.LocationObjectsChanged?.Invoke(null, new EventArgsLocationObjectsChanged(newObjects)); } } } -- cgit