about summary refs log tree commit diff
path: root/LibMatrix
diff options
context:
space:
mode:
Diffstat (limited to 'LibMatrix')
-rw-r--r--LibMatrix/StateEvent.cs6
1 files changed, 5 insertions, 1 deletions
diff --git a/LibMatrix/StateEvent.cs b/LibMatrix/StateEvent.cs
index e3de7e6..81ee3fe 100644
--- a/LibMatrix/StateEvent.cs
+++ b/LibMatrix/StateEvent.cs
@@ -19,7 +19,11 @@ public class StateEvent {
         new Dictionary<string, Type>(),
         (dict, type) => {
             var attrs = type.GetCustomAttributes<MatrixEventAttribute>();
-            foreach (var attr in attrs) dict[attr.EventName] = type;
+            foreach (var attr in attrs) {
+                if (dict.TryGetValue(attr.EventName, out var existing))
+                    Console.WriteLine($"Duplicate event type '{attr.EventName}' registered for types '{existing.Name}' and '{type.Name}'");
+                dict[attr.EventName] = type;
+            }
 
             return dict;
         }).OrderBy(x => x.Key).ToFrozenDictionary();