# Commands

Here you can see all the available commands for TNT-Tag!

**/tnttag create**

This command is used to start the arena creation process of TNT Tag. The player running the command must specify the name of the arena, as well as its size and locations in the setup.

**/tnttag delete \<arena>**

This command is used to delete an existing TNT Tag arena. The player must specify the name of the arena they wish to delete.

**/tnttag list**

This command shows a list of all available TNT Tag arenas on the server. Players can use this command to see which arenas are currently being played, and which ones are available to join.

**/tnttag join \<arena>**

This command allows a player to join an available TNT Tag arena. The player will be teleported to the arena and given the necessary equipment to play the game.\
\
**/tnttag joingui**\
\
This command allows a player to open a join GI that lists the available TNT Tag arena's. The player will be teleported to the arena and given the necessary equipment to play the game.

**/tnttag leave**

This command allows a player to leave the TNT Tag arena they are currently in. The player will be teleported out of the arena and their equipment will be returned to them.

**/tnttag help**

This command displays a list of all available TNT Tag commands and provides brief descriptions of each one.

**/tnttag reload**

This command reloads the customization file and arena's from TNT Tag. This can be useful if the server administrator has made changes to the customization options and wants to apply them without restarting the server.

**/tnttag stats**

This command displays the stats of the player who runs it. Stats may include things like the number of games played, the number of kills, and the player's win/loss ratio.

**/tnttag top**

This command displays the top three players in each stat category for TNT Tag. This can be used to see which players are the best at the game, and to compare one's own stats to those of others.\
\
**/tnttag start (arena) \[forced]**\
\
This command force-starts the specified arena. This can be used for testing purposes.\
\
**/tnttag info (arena)**\
\
This command shows you some info about a arena such as the countdown and the minimum/maximum players. This is only for debugging purposes.\
\
**/tnttag editor (arena)**\
\
This command allows you to edit almost everything from your arena's! It's simple to use and eliminates the need to recreate your arena for every change.\
\
**/tnttag autojoin/randomjoin**\
\
This command allows you to join a random available arena at any time! This can be useful for GUI's, portals, etc.


# Permissions

TNT-Tag permissions are a set of commands for managing a TNT-Tag game on a Minecraft server. The commands can be used by players with the appropriate permissions to create, delete, list, join, leave, and get help with TNT-Tag games.

**/tnttag create - tnttag.create**

This command is used to create a new TNT-Tag game with the specified parameters. The player executing this command must have the tnttag.create permission to use it.

**/tnttag delete \<args> - tnttag.delete**

This command is used to delete an existing TNT-Tag game with the specified parameters. The player executing this command must have the tnttag.delete permission to use it.

**/tnttag list - tnttag.list**

This command is used to display a list of all existing TNT-Tag games. The player executing this command must have the tnttag.list permission to use it.

**/tnttag join \<args> - tnttag.join**

This command is used to add a player to an existing TNT-Tag game. The player executing this command must have the tnttag.join permission to use it.\
\
**/tnttag joingui** - tnttag.gui.join\
\
This command allows a player to open a join GI that lists the available TNT Tag arena's. The player executing this command must have the tnttag.gui.join permission to use it.

**/tnttag leave - tnttag.leave**

This command is used to remove a player from a TNT-Tag game. The player executing this command must have the tnttag.leave permission to use it.

**/tnttag help - tnttag.help**

This command is used to display help and information about the TNT-Tag commands. The player executing this command must have the tnttag.help permission to use it.

**/tnttag stats \<args> - tnttag.stats**

This command is used to display a player's stats for a specific TNT-Tag game. The player executing this command must have the tnttag.stats permission to use it.

**/tnttag top \<args> - tnttag.top**

This command is used to display the top players for a specific TNT-Tag game. The player executing this command must have the tnttag.top permission to use it.\
\
**/tnttag start \<arena> - tnttag.start**\
\
This command force-starts the specified arena. This can be used for testing purposes.\
\
**/tnttag info \<arena> tnttag.info**\
\
This command shows you some info about a arena such as the countdown and the minimum/maximum players. This is only for debugging purposes.\
\
Other permissions:

tnttag.allowblockbreak – Allows you to break blocks while being in-game.

tnttag.allowblockplace – Allows you to place blocks while being in-game.

tnttag.update - Allows you to see update notifications.


# Arena setup

To create an arena in TNT-Tag, you will need to follow the steps outlined below:

1. Type "/tnttag create" and give a name for the arena. The plugin will respond with "The name of the arena is set!".
2. Next, you will need to enter the minimum number of players required to start the game. The plugin will respond with "The amount of players needed to start is set!".
3. After that, you will need to enter the maximum number of players that the arena can hold. The plugin will respond with "The amount of players that this arena can hold is set!".
4. Go to the lobby location and type "setlobby" in the chat. The plugin will respond with "The lobby location is set!".
5. Go to the start location and type "setstart" in the chat. The plugin will respond with "The start location is set!".

At this point, the arena creation process is complete and you can begin playing TNT-Tag. The setup process uses chat commands to make it easier to set up an arena, so you don't need to remember coordinates or use complicated commands.

Congratulations, you have successfully set up an arena for TNT-Tag!\
\
Optional: Use cool signs to let your players join an arena.\
To create a TNT-Tag sign, you need to have the "tnttag.createsigns" permission. Once you have the permission, you can place a sign and add the following text to the first line:

`[TT]`

The second line of the sign should be the name of the map that the sign will be associated with. For example:

`Map1`

The third and fourth lines of the sign will automatically be filled with the number of players in the game and the maximum number of players allowed in the game.

Joining a TNT-Tag Game

To join a TNT-Tag game, simply right-click on a TNT-Tag sign that has been created by someone else. The sign should have the following text on the first line:

`[TT]`

The second line of the sign will indicate the name of the map that the sign is associated with. To join the game, simply right-click on the sign.

Removing a TNT-Tag Sign

To remove a TNT-Tag sign, you need to have the "tnttag.breaksigns" permission. Once you have the permission, you can break the sign to remove it or left click it. It's important to note that breaking a TNT-Tag sign will not stop the game that it is associated with.


# PlaceholderAPI

PlaceholderAPI is a plugin for Minecraft servers that allows for the creation and usage of custom placeholders in various plugins, including TNT-Tag. These placeholders allow server administrators to display various information about players, games, and more in a convenient and dynamic way.

TNT-Tag has several placeholders available for use with PlaceholderAPI:

`%tnttag_wins%` This placeholder displays the number of times a player has won a game of TNT-Tag. This can be useful for displaying player statistics or creating leaderboards.

`%tnttag_timestagged%` This placeholder displays the number of times a player has been tagged by TNT blocks during a game of TNT-Tag. This can be useful for displaying player performance or creating anti-cheat measures.

`%tnttag_tags%` This placeholder displays the number of players a player has tagged with TNT blocks during a game of TNT-Tag. This can be useful for displaying player performance or creating anti-cheat measures.\
\
`%tnttag_winstreak%` This placeholder displays the number of games won in a row by a player during TNT-Tag. It's a useful metric for tracking a player's winning streak and can be used to display their gaming achievements.

`%tnttag_top_wins_X%` This placeholder displays the player's position in the top X players with the most wins in TNT-Tag. Replace X with the desired position (e.g., %tnttag\_top\_wins\_1% for the top player).

`%tnttag_top_timestagged_X%` This placeholder displays the player's position in the top X players who have been tagged the most in TNT-Tag. Replace X with the desired position (e.g., %tnttag\_top\_timestagged\_1% for the top player).

`%tnttag_top_tags_X%` This placeholder displays the player's position in the top X players who have tagged the most players in TNT-Tag. Replace X with the desired position (e.g., %tnttag\_top\_tags\_1% for the top player).\
\
`%tnttag_top_winstreak_X%` This placeholder displays the player's position in the top X players who have the highest winstreak in TNT-Tag. Replace X with the desired position (e.g., %tnttag\_top\_winstreak\_1% for the top player).

`%tnttag_arena_ARENA_NAME_currentPlayers%` This placeholder displays the current number of players in the specified arena. Replace ARENA\_NAME with the name of the arena.

`%tnttag_arena_ARENA_NAME_minPlayers%` This placeholder displays the minimum number of players required for the specified arena to start. Replace ARENA\_NAME with the name of the arena.

`%tnttag_arena_ARENA_NAME_maxPlayers%` This placeholder displays the maximum number of players allowed in the specified arena. Replace ARENA\_NAME with the name of the arena.

`%tnttag_arena_ARENA_NAME_survivors%` This placeholder displays the current number of survivors in the specified arena. Replace ARENA\_NAME with the name of the arena.

`%tnttag_arena_ARENA_NAME_taggers%` This placeholder displays the current number of taggers in the specified arena. Replace ARENA\_NAME with the name of the arena.

`%tnttag_arena_ARENA_NAME_spectators%` This placeholder displays the current number of spectators in the specified arena. Replace ARENA\_NAME with the name of the arena.

`%tnttag_arena_ARENA_NAME_state%` This placeholder displays the current state of the specified arena (e.g., waiting, running, etc.). Replace ARENA\_NAME with the name of the arena.

To use these placeholders, server administrators must have PlaceholderAPI and TNT-Tag installed on their Minecraft server. Once both plugins are installed, the placeholders can be used in various plugins that support PlaceholderAPI, such as chat plugins or scoreboard plugins. To use a placeholder, simply insert the placeholder text (e.g. %tnttag\_wins%) into the appropriate plugin configuration file or command.

In conclusion, PlaceholderAPI placeholders provide a powerful tool for displaying various player statistics and game information in TNT-Tag. By using these placeholders, server administrators can create dynamic displays and leaderboards that enhance the player experience and improve server management.


# Configuration

## Configuration

### Config.yml File

The `config.yml` file contains settings for the plugin. Below are the options available:

#### Round Finish Commands

`round-finish-commands` specifies the commands that will be executed when a round is finished. The commands can be customized for both taggers and survivors. You can use the player placeholder `%player%` in the commands.

Example:

```yaml
round-finish-commands:
  taggers:
    - eco add %player% 10
  survivors:
    - eco add %player% 20
```

#### Arena Finish Commands

`arena-finish-commands` specifies the commands that will be executed when an arena game is finished. You can use the winner placeholder `%winner%` in the command.

Example:

```yaml
arena-finish-commands:
  - eco add %winner% 1000
```

#### Times To Broadcast

`timesToBroadcast` specifies the countdown times when a broadcast message will be sent to the players. You can customize the countdown times to your preference.

Example:

```yaml
timesToBroadcast:
  - 50
  - 40
  - 30
  - 20
  - 15
  - 10
  - 5
  - 4
  - 3
  - 2
  - 1
```

#### Start Message

`startMessage` specifies the message that will be displayed when the game starts. You can customize the message to your preference.

Example:

```yaml
startMessage:
  - "&b==================&cTNT-Tag&b=================="
  - "                    &6&lTNT-Tag        "
  - "   &6You need to avoid the tagger and run fast!        "
  - " &6&lHit someone quickly when you get tagged before you explode!        "
  - "&b==================&cTNT-Tag&b=================="
```

### Arena Configuration File

The arena configuration file contains settings for each individual arena. Below are the options available:

#### Start Location

`startLocation` specifies the starting location for the players in the arena.

Example:

```yaml
arena:
  startLocation:
    world: world
    x: 0
    y: 64
    z: 0
```

#### Lobby Location

`lobbyLocation` specifies the lobby location for the players in the arena.

Example:

```yaml
arena:
  lobbyLocation:
    world: world
    x: 0
    y: 64
    z: 0
```

#### Maximum and Minimum Players

`maxPlayers` and `minPlayers` specify the maximum and minimum number of players allowed in the arena.

Example:

```yaml
arena:
  maxPlayers: 16
  minPlayers: 2
```

#### Potion Effects

`potionEffects` specifies the potion effects that will be applied to players in the arena. You can add multiple potion effects by using the format `<POTIONEFFECT:LEVEL:GROUP>` where `POTIONEFFECT` is the name of the potion effect, `LEVEL` is the strength of the potion effect and `GROUP` specifies which group of players the potion effect will be applied to.

Example:

```yaml
arena:
  potionEffects:
    - SPEED:2:SURVIVORS
    - INSTANT_HEALTH:1:TAGGERS
```

#### Round Duration

`roundDuration` specifies the duration of the round in seconds. You can customize this to your liking.

Example:

`roundDuration: 180`

This sets the round duration to 180 seconds (3 minutes). Players will have to avoid being tagged by the TNT block for the duration of the round. Once the round is finished, the round finish commands specified in the config.yml file will be executed.

It is important to note that the round duration can greatly affect the gameplay experience. If the duration is too short, players may not have enough time to fully enjoy the game. On the other hand, if the duration is too long, the game may become tedious and players may lose interest. It is recommended to experiment with different round durations to find the optimal duration for your players.

**Bungee Mode**

`bungee-mode` controls the behavior of players when they join and leave TNT-Tag in Bungee Mode. You can configure whether players instantly join TNT-Tag, are unable to leave TNT-Tag, and specify the lobby server name.

Example:

```yaml
bungee-mode:
  enabled: false
  lobby-server: "lobby" # The name of your lobby server.
  enter-arena-instantly: false # Only enable this if you only have one arena, it will let players enter that arena directly.
  restart-command: "restart" # Your server will be automatically restarted after an arena ends if "enter-arena-instantly" is set to true.
```

**Cooldown for Tagging Survivors**

`cooldown` specifies the cooldown settings for tagging survivors. You can enable or disable it and set the duration in seconds.

Example:

```yaml
cooldown:
  enabled: true
  duration: 2.0
```

**Delay Settings**

`delay` specifies the delay settings between starting a new round and teleporting back to the global lobby after a game. You can configure the delay for both situations.

Example:

```yaml
delay:
  new-round: 3
  after-game: 5
```

**Global Lobby Option**

`global-lobby` determines whether the global lobby is enabled or disabled. If set to false, players will instantly leave the TNT-Tag mode when they want to leave an arena, and they won't be able to join it as well if this is disabled.

Example:

```yaml
global-lobby: true
```


# API

Here is a possible TNT-Tag API page:

## TNT-Tag API

To use the TNT-Tag API, call `Tnttag.getAPI()`, which returns an instance of the `API` class. The `API` class provides the following methods:

### Methods

#### `int getTimesTagged(UUID playerUUID)`

Returns the number of times the specified player has been tagged.

#### `int getWins(UUID playerUUID)`

Returns the number of times the specified player has won a game.

#### `int getTags(UUID playerUUID)`

Returns the number of times the specified player has tagged other players.

#### `void setTimesTagged(UUID playerUUID, int value)`

Sets the number of times the specified player has been tagged.

#### `void setWins(UUID playerUUID, int value)`

Sets the number of times the specified player has won a game.

#### `void setTags(UUID playerUUID, int value)`

Sets the number of times the specified player has tagged other players.

#### `boolean arenaExists(String arenaName)`

Returns true if the specified arena exists.

#### `HashMap<Player, PlayerType> getPlayers(String arenaName)`

Returns a map of the players in the specified arena and their types (TNT or player).

#### `String getArenaState(String arenaName)`

Returns the current state of the specified arena (WAITING, STARTING, RUNNING, or ENDING).

#### `TreeMap<UUID, Integer> getWinsData()`

Returns a map of the UUIDs of all players and their corresponding number of wins.

#### `TreeMap<UUID, Integer> getTimesTaggedData()`

Returns a map of the UUIDs of all players and their corresponding number of times tagged.

#### `TreeMap<UUID, Integer> getTagsData()`

Returns a map of the UUIDs of all players and their corresponding number of tags.\
\
**`TreeMap<UUID, Integer> getWinstreakData()`**

Returns a map of the UUIDs of all players and their corresponding winstreak.

### Events

The following events are available:

#### `ArenaEndingEvent`

**Methods**

* `String getArenaName()`: Returns the name of the arena that is ending.
* `HashMap<Player, PlayerType> getPlayers()`: Returns a map of the players in the arena and their types (TNT or player).
* `ArrayList<Player> getWinners()`: Returns a list of the players who won the game.

#### `ArenaStartedEvent`

**Methods**

* `String getArenaName()`: Returns the name of the arena that has started.

#### `ArenaStartingEvent`

**Methods**

* `String getArenaName()`: Returns the name of the arena that is starting.

#### `PlayerJoinArenaEvent`

**Methods**

* `Player getPlayer()`: Returns the player who joined the arena.
* `String getArenaName()`: Returns the name of the arena the player joined.

#### `PlayerLeaveArenaEvent`

**Methods**

* `Player getPlayer()`: Returns the player who left the arena.
* `String getArenaName()`: Returns the name of the arena the player left.

#### `PlayerLostRoundEvent`

**Methods**

* `Player getPlayer()`: Returns the player who lost the round.
* `String getArenaName()`: Returns the name of the arena where the player lost.


# Signs

## TNT-Tag Signs Documentation

Welcome to the Signs page for TNT-Tag! This guide will walk you through creating, using, and destroying signs in TNT-Tag.

### Creating Signs

To create a sign for TNT-Tag, follow these steps:

1. On the first line of the sign, type "\[TT]" to indicate it as a TNT-Tag sign.
2. On the second line, specify the type of sign using one of the following options:
   * **Join**: For signs that allow players to join a specific arena.
   * **Leave**: For signs that let players leave the current arena.
   * **Top**: For signs that display top statistics.
3. Depending on the sign type, the third and fourth lines will vary:
   * For **Join** signs, on the third line, type the name of the arena you want to join.
   * For **Leave** signs, no additional lines are required.
   * For **Top** signs, on the third line, specify the type of statistic to display (WINS, TIMESTAGGED, TAGS), and on the fourth line, enter the position (ranging from 1-10) for the top list.

Make sure to place the sign in a visible location, so that players can easily find it.

### Using Signs

To use a TNT-Tag sign, follow these steps:

1. Simply right-click on the sign.
2. If it is a **Join** sign, you will be automatically teleported to the designated arena. Ensure that you have the necessary permissions to join arenas.
3. If it is a **Leave** sign, you will be removed from the current arena.
4. If it is a **Top** sign, it will display the specified statistic and position.

Please note that if you don't have the appropriate permissions or if the sign is not set up correctly, it may not work for you.

### Destroying Signs

To remove a TNT-Tag sign, follow these steps:

1. Simply left-click on the sign.
2. Ensure that you have the "tnttag.breaksigns" permission to destroy signs.

It is important to clean up unnecessary signs to avoid confusion and maintain a clutter-free game environment.

Remember to place signs strategically and provide clear instructions to ensure all players can easily understand and interact with the signs.


