Skip to content

Commit

Permalink
Fix issues with extremely long mute times on mono
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownShadow200 committed Apr 23, 2020
1 parent 416919d commit 25bd175
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions MCGalaxy/CorePlugin/ModActionHandler.cs
Expand Up @@ -231,21 +231,18 @@ internal static class ModActionHandler {
}

static string FormatModTaskData(ModAction e) {
long assign = DateTime.UtcNow.ToUnixTime();
DateTime expiryTime;
long assign = DateTime.UtcNow.ToUnixTime();
DateTime end = DateTime.MaxValue.AddYears(-1);

if (e.Duration == TimeSpan.Zero) {
expiryTime = DateTime.MaxValue;
} else {
if (e.Duration != TimeSpan.Zero) {
try {
expiryTime = DateTime.UtcNow.Add(e.Duration);
end = DateTime.UtcNow.Add(e.Duration);
} catch (ArgumentOutOfRangeException) {
// user provided extreme expiry time
expiryTime = DateTime.MaxValue;
// user provided extreme expiry time, ignore it
}
}

long expiry = expiryTime.ToUnixTime();
long expiry = end.ToUnixTime();
string assigner = e.Actor.name;
return assigner + " " + assign + " " + expiry;
}
Expand Down

0 comments on commit 25bd175

Please sign in to comment.