> For the complete documentation index, see [llms.txt](https://glitchtechs.gitbook.io/galaxy/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://glitchtechs.gitbook.io/galaxy/starapi-spigot-paper/timers/create-timers.md).

# Create Timers

Create a timer

### Overview

The `Timer` class provides a utility for creating and running repeating tasks in Bukkit.

### Methods

#### `timer`

```java
public static BukkitTask timer(long delay, long period, final Runnable task)
```

Creates and starts a repeating timer task with a specified delay and period.

**Parameters**

* `delay`: The delay in server ticks before the task should start.
* `period`: The interval in server ticks between consecutive executions of the task.
* `task`: The task to be executed repeatedly.

**Returns**

* Returns the BukkitTask representing the scheduled repeating task.

**Usage**

1. Call the `timer` method and pass the delay, period, and task to be executed as parameters.

### Example

```java
long delay = 0; // Start the task immediately
long period = 20; // Repeat every 20 ticks (1 second)
Runnable task = () -> {
    // Your task logic here
};
BukkitTask repeatingTask = Timer.timer(delay, period, task);
```

In this example, we create and start a repeating timer task using the `timer` method. The task will start immediately and repeat every 20 ticks (1 second).
