Skip to content

Commit ad22e32

Browse files
committed
Do not broadcast message if it's empty
1 parent cc4fbb3 commit ad22e32

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

OpenDeathMessages/Events/PlayerDeathEvent.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,22 @@ public async Task HandleEventAsync(object? sender, UnturnedPlayerDeathEvent @eve
5050

5151
var location = m_UnturnedLocationDirectory.GetNearestLocation(victimPosition);
5252

53-
await m_BroadcastManager.BroadcastAsync(m_StringLocalizer[$"deathCause:{@event.DeathCause.ToString().ToLower()}", new
53+
var message = m_StringLocalizer[$"deathCause:{@event.DeathCause.ToString().ToLower()}", new
5454
{
5555
Victim = victimUser,
5656
Instigator = instigatorUser,
5757
@event.DeathPosition,
5858
Distance = distance,
5959
Node = location?.Name ?? string.Empty,
6060
Limb = m_StringLocalizer[$"limbParse:{@event.Limb.ToString().ToLower()}"].Value
61-
}], m_Configuration["iconUrl"], ColorTranslator.FromHtml(m_Configuration["color"]));
61+
}];
62+
63+
if (string.IsNullOrWhiteSpace(message))
64+
{
65+
return;
66+
}
67+
68+
await m_BroadcastManager.BroadcastAsync(message, m_Configuration["iconUrl"], ColorTranslator.FromHtml(m_Configuration["color"]));
6269
}
6370
}
6471
}

0 commit comments

Comments
 (0)