Skip to content

Commit 290bb63

Browse files
committed
Modified logging of missing effect types
1 parent bf0f5eb commit 290bb63

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

LabExtended/API/Containers/EffectContainer.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ namespace LabExtended.API.Containers;
3232
public class EffectContainer : IDisposable
3333
{
3434
private static readonly IEnumerable<PropertyInfo> _properties;
35+
private static readonly HashSet<Type> warnedMissing = new();
3536

3637
static EffectContainer()
3738
=> _properties = typeof(EffectContainer).FindProperties(x => (x.GetSetMethod(true)?.IsPrivate ?? false));
@@ -551,14 +552,15 @@ internal EffectContainer(PlayerEffectsController controller, ExPlayer player)
551552

552553
if (props.Count != _properties.Count())
553554
{
554-
ApiLog.Error("LabExtended", $"Some effects are missing! (set &6{props.Count}&r / &3{_properties.Count()}&r)");
555-
556555
foreach (var prop in _properties)
557556
{
558557
if (props.Contains(prop))
559558
continue;
560559

561-
ApiLog.Error("LabExtended", $"- &3{prop.Name}&r (&1{prop.PropertyType.Name}&r)");
560+
if (!warnedMissing.Add(prop.PropertyType))
561+
continue;
562+
563+
ApiLog.Error("LabExtended", $"Missing effect for property &3{prop.Name}&r (&1{prop.PropertyType.FullName}&r)");
562564
}
563565
}
564566

0 commit comments

Comments
 (0)