Skip to content

Commit

Permalink
fix: validating content adds it to Mod.Content list
Browse files Browse the repository at this point in the history
  • Loading branch information
Hamunii committed Aug 24, 2024
1 parent cd19264 commit 58ae81e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/ContentLib.Core/ContentDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,20 @@ public virtual (bool isValid, string? message) Validate()
$"The `{nameof(ModDefinition)} {nameof(Mod)}` of this ContentDefinition exists but isn't registered! " +
"Please create your ModDefinition through intended methods.");
}

return result;
}

if (!TryGetModDefinitionFromCallingAssembly(out ModDefinition? modDefinition))
else if (TryGetModDefinitionFromCallingAssembly(out ModDefinition? modDefinition))
Mod = modDefinition;
else
{
MarkAsInvalid(ref result,
$"Tried getting {nameof(BepInPlugin)} Attribute from CallingAssembly, but the attribute was not found! " +
"Make sure to call ContentLib from a valid BepInEx Plugin assembly.");

return result;
}

Mod = modDefinition;
if (!Mod.Content.Contains(this))
Mod.Content.Add(this);

return result;
}
Expand Down

0 comments on commit 58ae81e

Please sign in to comment.