fCraft  0.636
Custom Minecraft Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Properties | Events | List of all members
fCraft.ChatTimer Class Reference

Provides a way to create and manage publicly-announced countdowns. Long timers announce once an hour (e.g. "7h left"). During the last hour, timer announces more often: every 10 minutes, then every minute, then every 10 seconds, and finally every second - until the timer is up. More...

Public Member Functions

void Abort ()
 Stops this timer, and removes it from the list of timers.
 

Static Public Member Functions

static ChatTimer Start (TimeSpan duration,[CanBeNull] string message,[NotNull] string startedBy)
 Starts this timer with the specified duration, and end message.
 
static ChatTimer FindTimerById (int id)
 Searches for a timer by its numeric ID.
 

Public Attributes

readonly int ID
 Timer's unique numeric ID.
 

Static Public Attributes

static readonly TimeSpan MinDuration = TimeSpan.FromSeconds( 1 )
 Minimum allowed timer duration (one second).
 

Properties

bool IsRunning [get, set]
 Whether or not the timer is currently running.
 
bool Aborted [get, set]
 Whether this timer has been aborted.
 
string Message [get, set]
 Message to be displayed once the timer reaches zero.
 
DateTime StartTime [get, set]
 Date/Time (UTC) at which this timer was started.
 
DateTime EndTime [get, set]
 Date/Time (UTC) at which this timer will end.
 
TimeSpan Duration [get, set]
 The amount of time between when this timer was started and when it will end.
 
TimeSpan TimeLeft [get]
 The amount of time remaining in this timer.
 
string StartedBy [get, set]
 Name of the player (or entity) who started this timer
 
static ChatTimer[] TimerList [get]
 Returns a list of all active timers.
 

Events

static EventHandler
< ChatTimerEventArgs
Started
 Occurs after a ChatTimer was added.
 
static EventHandler
< ChatTimerEventArgs
Stopped
 Occurs after a ChatTimer has expired or was aborted.
 

Detailed Description

Provides a way to create and manage publicly-announced countdowns. Long timers announce once an hour (e.g. "7h left"). During the last hour, timer announces more often: every 10 minutes, then every minute, then every 10 seconds, and finally every second - until the timer is up.

Member Function Documentation

void fCraft.ChatTimer.Abort ( )

Stops this timer, and removes it from the list of timers.

static ChatTimer fCraft.ChatTimer.FindTimerById ( int  id)
static

Searches for a timer by its numeric ID.

Parameters
idID to search for.
Returns
ChatTimer object if found; null if not found.
static ChatTimer fCraft.ChatTimer.Start ( TimeSpan  duration,
[CanBeNull] string  message,
[NotNull] string  startedBy 
)
static

Starts this timer with the specified duration, and end message.

Parameters
durationAmount of time the timer should run before completion. Should not be less than ChatTimer.MinDuration.
messageMessage to display when timer reaches zero. May be null.
startedByName of player who started timer. May not be null.
Returns
Newly-created, and already-started timer.
Exceptions
ArgumentNullExceptionstartedBy is null.
ArgumentOutOfRangeExceptionduration is less than ChatTimer.MinDuration.

Member Data Documentation

readonly int fCraft.ChatTimer.ID

Timer's unique numeric ID.

readonly TimeSpan fCraft.ChatTimer.MinDuration = TimeSpan.FromSeconds( 1 )
static

Minimum allowed timer duration (one second).

Property Documentation

bool fCraft.ChatTimer.Aborted
getset

Whether this timer has been aborted.

TimeSpan fCraft.ChatTimer.Duration
getset

The amount of time between when this timer was started and when it will end.

DateTime fCraft.ChatTimer.EndTime
getset

Date/Time (UTC) at which this timer will end.

bool fCraft.ChatTimer.IsRunning
getset

Whether or not the timer is currently running.

string fCraft.ChatTimer.Message
getset

Message to be displayed once the timer reaches zero.

string fCraft.ChatTimer.StartedBy
getset

Name of the player (or entity) who started this timer

DateTime fCraft.ChatTimer.StartTime
getset

Date/Time (UTC) at which this timer was started.

TimeSpan fCraft.ChatTimer.TimeLeft
get

The amount of time remaining in this timer.

ChatTimer [] fCraft.ChatTimer.TimerList
staticget

Returns a list of all active timers.

Event Documentation

EventHandler<ChatTimerEventArgs> fCraft.ChatTimer.Started
static

Occurs after a ChatTimer was added.

EventHandler<ChatTimerEventArgs> fCraft.ChatTimer.Stopped
static

Occurs after a ChatTimer has expired or was aborted.


The documentation for this class was generated from the following file: