# Create Timers

### 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).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://glitchtechs.gitbook.io/galaxy/starapi-spigot-paper/timers/create-timers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
