don't apply changes when no changes

This commit is contained in:
2024-07-17 19:37:36 +02:00
parent 8273c68318
commit 675225658c

View File

@@ -29,16 +29,19 @@ public class NameplateElementChange(NameplateElements element, INamePlateUpdateH
public void ApplyChanges()
{
StringUpdateFactory.ApplyStringChanges(new()
if (Changes.Any())
{
StringChanges = Changes,
Destination = element switch
StringUpdateFactory.ApplyStringChanges(new()
{
NameplateElements.Name => handler.NameParts.Text ??= handler.InfoView.Name,
NameplateElements.Title => handler.TitleParts.Text ??= handler.InfoView.Title,
NameplateElements.FreeCompany => handler.FreeCompanyTagParts.Text ??= handler.InfoView.FreeCompanyTag,
_ => null,
},
});
StringChanges = Changes,
Destination = element switch
{
NameplateElements.Name => handler.NameParts.Text ??= handler.InfoView.Name,
NameplateElements.Title => handler.TitleParts.Text ??= handler.InfoView.Title,
NameplateElements.FreeCompany => handler.FreeCompanyTagParts.Text ??= handler.InfoView.FreeCompanyTag,
_ => null,
},
});
}
}
}