# API Usage

You can access the API from: <https://github.com/WaterArchery/LitTournaments>

{% hint style="warning" %}
Always check the latest version of the API before importing.
{% endhint %}

## Maven Repository

```
<repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
</repository>
```

## Dependency

```
<dependency>
    <groupId>com.github.WaterArchery</groupId>
    <artifactId>LitTournaments</artifactId>
    <version>1.0.3</version>
    <scope>provided</scope>
</dependency>
```

## How to access LitTournamentsAPI instance?

```java
LitTournamentsAPI api = LitTournamentsAPI.getInstance();

// Get the tournaments that uses this objective
List<Tournament> tournaments = api.getTournamentHandler().getTournaments(BlockBreakTournament.class);
        
// Or you can get a tournament with a id
// Argumant is the name of the yml file
Tournament tournament = api.getTournamentHandler().getTournament("blockBreak");

// It will return null, if there is no tournament with that id.
if (tournament == null) return; 
        
// Add points to player
api.getPointHandler().addPoint(UUID.randomUUID(), tournament, 10);
```
