fix event priority sorting
This commit is contained in:
parent
e64ecc89f9
commit
c8f7269966
|
@ -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).
|
* 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
|
## 3.6
|
||||||
Released 20 June 2020 for Stardew Valley 1.4.1 or later.
|
Released 20 June 2020 for Stardew Valley 1.4.1 or later.
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace StardewModdingAPI.Framework.Events
|
||||||
if (!(obj is ManagedEventHandler<TEventArgs> other))
|
if (!(obj is ManagedEventHandler<TEventArgs> other))
|
||||||
throw new ArgumentException("Can't compare to an unrelated object type.");
|
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
|
return priorityCompare != 0
|
||||||
? priorityCompare
|
? priorityCompare
|
||||||
: this.RegistrationOrder.CompareTo(other.RegistrationOrder);
|
: this.RegistrationOrder.CompareTo(other.RegistrationOrder);
|
||||||
|
|
Loading…
Reference in New Issue