Skip to content

Commit

Permalink
1.7.4 | Prevent multiple displays LastHumanBroadcast
Browse files Browse the repository at this point in the history
  • Loading branch information
Vretu-Dev committed Oct 23, 2024
1 parent ec432b1 commit 6324e09
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion UsefulHints/EventHandlers/Modules/LastHumanBroadcast.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace UsefulHints.EventHandlers.Modules
{
public static class LastHumanBroadcast
{
private static bool hasBroadcastBeenSent = false;
public static void RegisterEvents()
{
Exiled.Events.Handlers.Player.Died += OnPlayerDied;
Expand All @@ -20,7 +21,11 @@ private static void OnPlayerDied(DiedEventArgs ev)
{
var aliveHumans = Player.List.Where(p => p.IsAlive && IsHuman(p));

if (aliveHumans.Count() == 1)
if (aliveHumans.Count() > 1)
{
hasBroadcastBeenSent = false;
}
if (aliveHumans.Count() == 1 && !hasBroadcastBeenSent)
{
Player lastAlive = aliveHumans.First();

Expand All @@ -35,6 +40,7 @@ private static void OnPlayerDied(DiedEventArgs ev)
{
scp.Broadcast(10, message);
}
hasBroadcastBeenSent = true;
}
}
private static bool IsHuman(Player player)
Expand Down
2 changes: 1 addition & 1 deletion UsefulHints/UsefulHints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class UsefulHints : Plugin<Config>
public override string Name => "Useful Hints";
public override string Author => "Vretu";
public override string Prefix { get; } = "UH";
public override Version Version => new Version(1, 7, 3);
public override Version Version => new Version(1, 7, 4);
public override Version RequiredExiledVersion { get; } = new Version(8, 9, 8);
public override PluginPriority Priority { get; } = PluginPriority.Low;
public static UsefulHints Instance { get; private set; }
Expand Down

0 comments on commit 6324e09

Please sign in to comment.