Skip to content

Commit

Permalink
1.6.1b
Browse files Browse the repository at this point in the history
- Fixed rare problem when system uses other timezone than plugin
- Fixed time type in discord webhook
  • Loading branch information
daffyyyy committed Sep 29, 2024
1 parent 4206ad1 commit bd817d6
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CS2-SimpleAdmin/CS2-SimpleAdmin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
public override string ModuleName => "CS2-SimpleAdmin" + (Helper.IsDebugBuild ? " (DEBUG)" : " (RELEASE)");
public override string ModuleDescription => "Simple admin plugin for Counter-Strike 2 :)";
public override string ModuleAuthor => "daffyy & Dliix66";
public override string ModuleVersion => "1.6.1a";
public override string ModuleVersion => "1.6.1b";

public CS2_SimpleAdminConfig Config { get; set; } = new();

Expand Down
6 changes: 3 additions & 3 deletions CS2-SimpleAdmin/Commands/basecomms.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ internal void Gag(CCSPlayerController? caller, CCSPlayerController player, int t
});

// Add penalty to the player's penalty manager
PlayerPenaltyManager.AddPenalty(player.Slot, PenaltyType.Gag, DateTime.Now.AddMinutes(time), time);
PlayerPenaltyManager.AddPenalty(player.Slot, PenaltyType.Gag, Time.ActualDateTime().AddMinutes(time), time);

// Determine message keys and arguments based on gag time (permanent or timed)
var (messageKey, activityMessageKey, playerArgs, adminActivityArgs) = time == 0
Expand Down Expand Up @@ -283,7 +283,7 @@ internal void Mute(CCSPlayerController? caller, CCSPlayerController player, int
});

// Add penalty to the player's penalty manager
PlayerPenaltyManager.AddPenalty(player.Slot, PenaltyType.Mute, DateTime.Now.AddMinutes(time), time);
PlayerPenaltyManager.AddPenalty(player.Slot, PenaltyType.Mute, Time.ActualDateTime().AddMinutes(time), time);

// Determine message keys and arguments based on mute time (permanent or timed)
var (messageKey, activityMessageKey, playerArgs, adminActivityArgs) = time == 0
Expand Down Expand Up @@ -501,7 +501,7 @@ internal void Silence(CCSPlayerController? caller, CCSPlayerController player, i
});

// Add penalty to the player's penalty manager
PlayerPenaltyManager.AddPenalty(player.Slot, PenaltyType.Silence, DateTime.Now.AddMinutes(time), time);
PlayerPenaltyManager.AddPenalty(player.Slot, PenaltyType.Silence, Time.ActualDateTime().AddMinutes(time), time);

// Determine message keys and arguments based on silence time (permanent or timed)
var (messageKey, activityMessageKey, playerArgs, adminActivityArgs) = time == 0
Expand Down
4 changes: 2 additions & 2 deletions CS2-SimpleAdmin/Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ public HookResult OnClientDisconnect(EventPlayerDisconnect @event, GameEventInfo
{
disconnectedPlayer.Name = player.PlayerName;
disconnectedPlayer.IpAddress = player.IpAddress?.Split(":")[0];
disconnectedPlayer.DisconnectTime = DateTime.Now;
disconnectedPlayer.DisconnectTime = Time.ActualDateTime();
}
else
{
DisconnectedPlayers.Add(new DisconnectedPlayer(steamId, player.PlayerName, player.IpAddress?.Split(":")[0], DateTime.Now));
DisconnectedPlayers.Add(new DisconnectedPlayer(steamId, player.PlayerName, player.IpAddress?.Split(":")[0], Time.ActualDateTime()));
}

PlayerPenaltyManager.RemoveAllPenalties(player.Slot);
Expand Down
4 changes: 2 additions & 2 deletions CS2-SimpleAdmin/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,12 @@ public static void SendDiscordPenaltyMessage(CCSPlayerController? caller, CCSPla
var targetName = target != null ? target.PlayerName : localizer["sa_unknown"];
var targetSteamId = target != null ? new SteamID(target.SteamID).SteamId64.ToString() : localizer["sa_unknown"];

var futureTime = DateTime.Now.AddMinutes(duration);
var futureTime = Time.ActualDateTime().AddMinutes(duration);
var futureUnixTimestamp = new DateTimeOffset(futureTime).ToUnixTimeSeconds();

string time;

if (penaltySetting.FirstOrDefault(s => s.Name.Equals("Webhook"))?.Value == "{relative}")
if (penaltySetting.FirstOrDefault(s => s.Name.Equals("Time"))?.Value == "{relative}")
time = duration != 0 ? $"<t:{futureUnixTimestamp}:R>" : localizer["sa_permanent"];
else
time = duration != 0 ? ConvertMinutesToTime(duration) : localizer["sa_permanent"];
Expand Down
2 changes: 1 addition & 1 deletion CS2-SimpleAdmin/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.1a
1.6.1b

0 comments on commit bd817d6

Please sign in to comment.