# API

1. Install "FarmHuntAPI" in your pom.xml

```
<!--FarmHunt-API-->
<dependency>
    <groupId>internal</groupId>
    <artifactId>farmhunt</artifactId>
    <version>1.0</version>
    <scope>system</scope>
    <systemPath>${pom.basedir}/libs/FarmHuntAPI.jar</systemPath>
</dependency>
```

2. Install "FarmHuntAPI" in your plugins Folder.
3. Use:

```
FarmHuntAPI FHAPI = FarmHuntAPI.getInstance();
```

***

## Events

```
FarmHuntWinGameEvent
FarmHuntLostGameEvent
FarmHuntPlayerDisguiseEvent
FarmHuntPlayerKillEvent
FarmHuntPlayerDeathEvent
FarmHuntPlayerJoinGameEvent
FarmHuntPlayerQuitGameEvent
```

## Managers

### Coins

```
    /**
     * Add coins to a player's account
     * @param player Target player
     * @param coins Amount of coins to add
     */
FHAPI.addCoins(Player player, int coins)

    /**
     * Remove coins from a player's account
     * @param player Target player
     * @param coins Amount of coins to remove
     */
FHAPI.removeCoins(Player player, int coins)
    /**
     * Set a player's coin balance
     * @param player Target player
     * @param coins New coin balance
     */
FHAPI.setCoins(Player player, int coins)
    /**
     * Reset a player's coins to zero
     * @param player Target player
     */
FHAPI.resetCoins(Player player)
```

### Game

```
    /**
     * Send a player to a game
     * @param player Target player
     * @param gameName Name of the game (optional)
     */
FHAPI.joinPlayerToGame(Player player, String name)

    /**
     * Quit a player from a game
     * @param player Target player
     */
FHAPI.quitPlayerGame(Player player)

    /**
     * Get the player game.
     * @param player Target player
     */
FHAPI.getPlayerGame(Player player)

- getGameStatus() # setGameStatus()
- getName() # setName()
- getTimeRemaing() # setTimeRemaing()
- getCurrentPlaying() # setCurrentPlaying()
- getHunterPlayers() # setHunterPlayers
- getHuntedPlayers() # setHuntedPlayers
- getGameWinner() # setGameWinner()
```

#### GameStatus

There are several types of game states, here is a list that explains each one.

```
GameStatus.WAITING: This is the situation when there are players waiting 
in the waiting room, and the game has not yet started.

GameStatus.STARTING: This is the situation when there are players waiting in 
the waiting room, and the game is already complete to start!

GameStatus.STARTED: This is the situation when the game has already started.

GameStatus.FINISHED: This is the situation when the game is over.

GameStatus.NONE: When a status has not yet been assigned.
```


---

# 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://mysticdev.gitbook.io/wiki/farmhunt/api.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.
