Create Creating Timed Events authored by Seth Miller's avatar Seth Miller
# Adding Timers
## Timers
- Server Timer
- This type of timer does not persist and is server dependent
- Player Timer
- This type of timer does persist if needed and is player dependent
## Creating a Server Timer
When creating a timer you first need to get the TimerManager singleton. After getting the singleton you can create a new timer. The timer will be created with the `scheduleCommand()` method. An example implementation is linked below.
```java
// The date object is used to set when the timer should go off
Date date = new Date();
// The command is the command that will be executed when the timer goes off
Command command = new Command();
TimerManager timerManager = TimerManager.getInstance();
timerManager.scheduleCommand(date, command);
```
## Creating a Player Timer
When creating a timer for a player you first need to get the TimerManager singleton. After getting the singleton you can create a new timer. The timer will be created with the `scheduleCommand()` method. An example implementation is linked below.
```java
// The date object is used to set when the timer should go off
Date date = new Date();
// The command is the command that will be executed when the timer goes off
Command command = new Command();
// The player is the player that the timer will be created for
int playerID = 1234567890;
TimerManager timerManager = TimerManager.getInstance();
timerManager.scheduleCommand(date, command, playerID);
```
\ No newline at end of file