From c8f72699663ca0c09127e469a328f711db78dfe4 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 21 Jun 2020 11:36:35 -0400 Subject: [PATCH] fix event priority sorting --- docs/release-notes.md | 3 +++ src/SMAPI/Framework/Events/ManagedEventHandler.cs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/release-notes.md b/docs/release-notes.md index 1c5dc1dd..1e91bb02 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -7,6 +7,9 @@ * Migrated to Harmony 2.0 (see [_migrate to Harmony 2.0_](https://stardewvalleywiki.com/Modding:Migrate_to_Harmony_2.0) for more info). --> +## Upcoming release +* Fixed event priority sorting. + ## 3.6 Released 20 June 2020 for Stardew Valley 1.4.1 or later. diff --git a/src/SMAPI/Framework/Events/ManagedEventHandler.cs b/src/SMAPI/Framework/Events/ManagedEventHandler.cs index cf470c1e..b32a2a22 100644 --- a/src/SMAPI/Framework/Events/ManagedEventHandler.cs +++ b/src/SMAPI/Framework/Events/ManagedEventHandler.cs @@ -47,7 +47,7 @@ namespace StardewModdingAPI.Framework.Events if (!(obj is ManagedEventHandler other)) throw new ArgumentException("Can't compare to an unrelated object type."); - int priorityCompare = this.Priority.CompareTo(other.Priority); + int priorityCompare = -this.Priority.CompareTo(other.Priority); // higher value = sort first return priorityCompare != 0 ? priorityCompare : this.RegistrationOrder.CompareTo(other.RegistrationOrder);