Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModLoader.AddMod should check for an already present mod #27

Closed
Banane9 opened this issue Jul 13, 2024 · 0 comments · Fixed by #28
Closed

ModLoader.AddMod should check for an already present mod #27

Banane9 opened this issue Jul 13, 2024 · 0 comments · Fixed by #28
Assignees
Labels
bug Something isn't working

Comments

@Banane9
Copy link
Member

Banane9 commented Jul 13, 2024

Log a warning when already present, only log addition and fire event when not.

public void AddMod(Mod mod)
{
Logger.Debug(() => $"Adding {(mod.IsGamePack ? "game pack" : "regular")} mod: {mod.Title}");
_allMods.Add(mod);
NuGet.Add(mod);
ModAdded?.TryInvokeAll(this, mod);
}

if(_allMods.Add(mod))
    // Add
else
    // Warn

Spawned by:
ResoniteModdingGroup/MonkeyLoader.GamePacks.ResoniteModLoader#18

@Banane9 Banane9 added the bug Something isn't working label Jul 13, 2024
@Banane9 Banane9 assigned Nytra and Banane9 and unassigned Nytra Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants