#How can I get the ban duration...

1 messages · Page 1 of 1 (latest)

hybrid pawn
#

How can I get the ban duration in the format "hh, mm, ss" and the ban time in the format "dd.MM.yyyy HH:mm:ss" from BanIssuingEventArgs? Also, I hope I’m using the correct method to handle an offline ban?

dawn ice
#

oban is offline banning iirc

marble bear
#

this is what i've done for one of my plugins, from there you'll have to style the output yourself

hybrid pawn
hybrid pawn
marble bear
#

yeah BanDetails might give information

hybrid pawn
marble bear
#

let me boot up unity to see how stuff works

#

hold on

marble bear
#

Expires is just DateTime.UtcNow.AddSeconds(time).Ticks, so you'll just need to reverse that

#

So to get the actual duration you will need to do

long duration = (new DateTime(Expires) - DateTime.UtcNow).Duration()```
#

might be the other way around, im unsure, but yeah

hybrid pawn
sweet flume
marble bear
sweet flume
#

Btw im pretty sure there's helper methods for these scenarios in BanPlayer or some related class

sweet flume
#

Why would TimeSpan have Duration()

marble bear
#

idk man

#

im just the person who researches stuff sometimes

marble bear
sweet flume
#

BanDerails

#

Derails

marble bear
#

Derails

sweet flume
#

The ban storage maybe

marble bear
#

but no, ban details doesn't have it

sweet flume
#

The class that manages the bam file

marble bear
#

i might ask if it's allowed to put the actual duration in seconds in BanDetails tbh, but there is probably some bad implications to doing that somewhere

marble bear
#

ig maybe I could introduce a new static method for it and then use it for the labapi events or smth