> For the complete documentation index, see [llms.txt](https://realisticnode.gitbook.io/rnsetups/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://realisticnode.gitbook.io/rnsetups/rncombatpvp/guides/combat-tag.md).

# Combat tag

What puts players in combat, what they see, what they can't do and item cooldowns.

When a player hurts another player, **both** are in combat for `combat.time` seconds (20 by default). Every new hit starts the time again. While in combat, a player who logs out is punished (see [Combat log and NPCs](/rnsetups/rncombatpvp/guides/combat-log.md)) and can't use the commands and items you block.

## What puts players in combat

| Cause                                                           | Option (`combat.tag-on`) | Default |
| --------------------------------------------------------------- | ------------------------ | ------- |
| Melee hits                                                      | always                   | on      |
| Arrows, tridents, wind charges and other projectiles            | `projectiles`            | on      |
| Splash and lingering potions with a harmful effect              | `harmful-potions`        | on      |
| TNT, end crystals, respawn anchors and beds set off by a player | `explosions`             | on      |
| Fire and lava a player placed or lit in the last 10 seconds     | `fire-and-lava`          | on      |
| Wolves and other tamed pets attacking for their owner           | `pets`                   | on      |
| Hits that do no damage (eggs, snowballs, fishing rods)          | `no-damage-hits`         | off     |

* The effects that make a potion "harmful" are in `combat.harmful-effects` (slowness, poison, wither, instant damage...).
* Hitting a [combat log NPC](/rnsetups/rncombatpvp/guides/combat-log.md) puts the attacker in combat too.

### Mobs

With `combat.mobs.enabled: true`, being hurt by a mob or hitting one also puts the player in combat, for `combat.mobs.time` seconds (8). Leave `combat.mobs.list` empty for every hostile mob, or list the ones that count:

```yaml
combat:
  mobs:
    enabled: true
    time: 8
    list: [WARDEN, WITHER, ENDER_DRAGON]
```

A short mob tag never cuts a longer player tag.

### Who is never put in combat

* Players with `rncombat.bypass.tag`.
* Players hidden by a vanish plugin.
* Players in a world of `disabled-worlds` (the plugin does nothing there).
* Players another plugin keeps out (see the [API](/rnsetups/rncombatpvp/reference/api.md)).

## Combat time per rank

Give a rank the permission `rncombat.time.<seconds>` for a different combat time, for example `rncombat.time.10` for VIPs. When a player has several, **the lowest one counts**. It replaces `combat.time` only; the mob time stays the same.

## When combat ends

* The time runs out: the player gets a message, a title and a sound.
* The player dies.
* When every enemy of the fight died or left the server (`combat.end-when-enemies-gone`, on by default; `false` = only when the time runs out). An enemy who left an NPC behind still counts: the fight goes on against the NPC.
* An admin uses `/combat untag <player>` (or `untag all`).

With `combat.ender-pearl-renews: true` (default), throwing an ender pearl in combat starts the timer again.

## When combat starts

| Option (`combat.disable-on-tag`) | Default | What happens                                                                                |
| -------------------------------- | ------- | ------------------------------------------------------------------------------------------- |
| `fly`                            | on      | Flying stops. It is given back when combat ends. Players can't start flying while in combat |
| `gamemode`                       | on      | Creative, adventure and spectator go back to survival, and can't be changed while in combat |
| `invisibility`                   | on      | The invisibility effect is removed                                                          |
| `elytra`                         | on      | Players gliding with elytra fall                                                            |

Players with `rncombat.bypass.disable` keep all of it. Two more options:

* `combat.glowing`: tagged players glow (everyone sees the outline).
* `combat.close-inventory`: the open inventory is closed when combat starts.

## What players see

<figure><img src="https://i.imgur.com/OvCC07z.png" alt="The action bar with the progress bar, the enemy and their health, and the boss bar"><figcaption><p>The action bar with the progress bar, the enemy and their health, and the boss bar</p></figcaption></figure>

| Option (`display`)                       | Default     | What it is                                                                                              |
| ---------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------- |
| `action-bar`                             | on          | Progress bar, seconds left, the last enemy and their health                                             |
| `boss-bar`                               | on          | A boss bar with the time left. `boss-bar-color` sets its color (`RED`)                                  |
| `boss-bar-color-by-time`                 | on          | The boss bar turns yellow at half the time and green in the last fifth                                  |
| `bar-length` / `bar-symbol`              | `20` / `\|` | The progress bar of the action bar (`{bar}`)                                                            |
| `title-on-enter` / `title-on-leave`      | on          | A title when combat starts and ends                                                                     |
| `countdown-seconds`                      | `3`         | A tick sound in the last seconds (`0` = off)                                                            |
| `low-health-tint` / `low-health-percent` | on / `30`   | Red screen edges when a player in combat has this percent of health or less; stronger the lower it gets |
| `damage-indicators`                      | on          | A damage number over the victim that **only the attacker sees**. Critical hits are gold and bold        |
| `damage-indicators-on-mobs`              | off         | Damage numbers when hitting mobs too                                                                    |
| `blood`                                  | on          | Red particles when a player is hit                                                                      |
| `nametag-prefix`                         | `""`        | A prefix in front of the name while in combat, such as `"<red>⚔ "`                                      |

<figure><img src="https://i.imgur.com/G16ZJwA.png" alt="Damage numbers only the attacker sees"><figcaption><p>Damage numbers only the attacker sees</p></figcaption></figure>

* Damage numbers are temporary text displays hidden from everyone but the attacker. They are never saved in the world.
* The red screen gives the player their own copy of the world border, so the real border still shows where it is.
* Each player can turn off the damage numbers, the red screen, the boss bar and the sounds for themselves in `/combat`. See [Player settings](/rnsetups/rncombatpvp/guides/player-settings.md).
* The texts (action bar, boss bar, titles, colors of the progress bar) are under `combat` in the [language files](/rnsetups/rncombatpvp/configuration/languages.md).

{% hint style="warning" %}
`nametag-prefix` uses scoreboard teams. Leave it empty if TAB or another nametag plugin manages your teams (use `%rncombat_tagged%` in that plugin instead). It does not work on Folia.
{% endhint %}

## What players can't do in combat

### Commands

```yaml
restrictions:
  commands:
    mode: WHITELIST
    list: [ct, combattag, combatlog, combat, rncombat, rncombatpvp, cpvp]
```

* By default only the commands of rnCombatPvP work in combat. Add `msg`, `tell`, `r`... to the list to allow private messages.
* `WHITELIST`: **only** these commands work in combat. `BLACKLIST`: these commands are blocked and every other one works.
* A command blocks or allows its subcommands too: `home` covers `/home` and `/home base`. `essentials:home` works as well.
* Players with `rncombat.bypass.commands` can use any command.

### Everything else

| Option (`restrictions`)         | Default | What it blocks                                                                                                                     |
| ------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `ender-pearls`                  | off     | Throwing ender pearls. By default they work, with the 8 s wait of the [item cooldowns](#item-cooldowns)                            |
| `chorus-fruit`                  | **on**  | Eating chorus fruit                                                                                                                |
| `riptide`                       | **on**  | Tridents with riptide (the player is stopped right after the launch)                                                               |
| `elytra`                        | **on**  | Starting to glide (elytra already open keep working)                                                                               |
| `firework-boost`                | **on**  | Rockets while gliding                                                                                                              |
| `totems`                        | off     | Totems of undying don't save players in combat                                                                                     |
| `place-blocks` / `break-blocks` | off     | Placing / breaking blocks                                                                                                          |
| `containers`                    | **on**  | Chests, ender chests, barrels, shulker boxes, furnaces...                                                                          |
| `teleports`                     | **on**  | Teleports by commands and plugins. Ender pearls and chorus fruit follow their own options                                          |
| `interact`                      | `[]`    | Blocks players can't right click: full names or endings. `DOOR` is every door, also `TRAPDOOR`, `FENCE_GATE`, `BUTTON`, `LEVER`... |

Players with `rncombat.bypass.restrictions` ignore all of these. The player is told why in the action bar (texts under `restricted` in the language files).

{% hint style="info" %}
The `interact` rule does not stop players who are sneaking, so they can still place blocks against a door or a button.
{% endhint %}

## Item cooldowns

A wait between two uses of an item, shown on the hotbar like the vanilla ender pearl cooldown. It works for any item: throwing, eating, drinking or right clicking.

```yaml
item-cooldowns:
  # only while in combat
  combat:
    ENDER_PEARL: 8
    WIND_CHARGE: 1
    ENCHANTED_GOLDEN_APPLE: 30
  # everywhere
  always:
    GOLDEN_APPLE: 5
```

* Item names are Minecraft item names (`ENDER_PEARL`, `GOLDEN_APPLE`, `TOTEM_OF_UNDYING`...), followed by the seconds.
* If an item is in both lists, the longer wait counts while in combat.
* Players with `rncombat.bypass.cooldowns` have no waits.
* In game, change them in `/combat editor` > **Restrictions** > **Cooldowns in combat** / **Cooldowns always**: type the item and the seconds, like `ENDER_PEARL 8`.

## How long is left

* `/ct` (or `/combattag`) tells a player how long they stay in combat.
* `/combattag <player>` shows someone else's time (permission `rncombat.tag`).
* `%rncombat_tagged%` and `%rncombat_time%` for scoreboards. See [Placeholders](/rnsetups/rncombatpvp/reference/placeholders.md).
