Fixed duplicate actions

This commit is contained in:
2024-06-14 17:09:02 +03:00
parent e5e156f371
commit 1881102fb7
4 changed files with 23 additions and 5 deletions

View File

@@ -13,12 +13,17 @@ public class InternalActionManager
public async Task Initialize()
{
Actions.Clear();
PluginLoader.Actions.ForEach(action =>
{
if (action.RunType == InternalActionRunType.ON_CALL || action.RunType == InternalActionRunType.BOTH)
{
if (this.Actions.ContainsKey(action.ActionName))
return; // ingore duplicates
{
// This should never happen. If it does, log it and return
Application.CurrentApplication.Logger.Log($"Action {action.ActionName} already exists", this, LogType.ERROR);
return;
}
this.Actions.Add(action.ActionName, action);
}