> For the complete documentation index, see [llms.txt](https://mysticdev.gitbook.io/wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mysticdev.gitbook.io/wiki/farmhunt/api.md).

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