Skip to content

Commit

Permalink
Fix in GetBanDetails
Browse files Browse the repository at this point in the history
  • Loading branch information
SkyTech6 committed Dec 7, 2024
1 parent c12ca44 commit 0edf4ba
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Commands/BannedCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public static void CheckID(ChatCommandContext ctx, string id)
if (Database.VoiceBans?.Find(x => x.PlayerID == ID) is Ban voiceBan)
allBans.Add(voiceBan);

if(allBans.Count == 0)
if (allBans.Count == 0)
{
ctx.Reply($"No bans found for ID {ID}.");
return;
Expand All @@ -213,6 +213,12 @@ var b when Database.VoiceBans.Contains(b) => Database.VoiceBans,
}
}

if (playerBans.Count == 0)
{
ctx.Reply($"No bans found for ID {ID}.");
return;
}

StringBuilder banList = new StringBuilder();
banList.AppendLine(Database.Messages[0].ToString(playerBans[0].Item1, playerBans[0].Item2));
if (Extensions.TryGetPlayerInfo(ID, out PlayerInfo playerInfo) && ContainsNonLocal)
Expand Down Expand Up @@ -283,7 +289,7 @@ var b when Database.VoiceBans.Contains(b) => Database.VoiceBans,

internal static bool GetBanDetails(Ban ban, List<Ban> list, out BanDetails details)
{
if (DateTime.Now > ban.TimeUntil.ToLocalTime())
if (!TimeUtility.IsPermanent(ban.TimeUntil) && DateTime.Now > ban.TimeUntil.ToLocalTime())
{
details = null;
Database.DeleteBan(ban, list);
Expand Down

0 comments on commit 0edf4ba

Please sign in to comment.