# TPA

With TPA, players ask each other for permission to teleport. Only the most recent incoming request can be answered via `/tpaccept`/`/tpdeny`, older ones expire via timeout. Accepted teleports run through the [teleport engine](teleport.html) (warmup, cooldown, cost, safety check, combat lock).

## Commands

| Command | Syntax | Permission | Default | Description |
|---|---|---|---|---|
| `/tpa` | `/tpa <player>` | `tpa.send` | `true` | "I want to teleport to you" |
| `/tpahere` | `/tpahere <player>` | `tpa.sendhere` | `true` | "Come to me" |
| `/tpaccept` | `/tpaccept` (alias `/tpyes`) | `tpa.accept` | `true` | Accepts the newest request |
| `/tpdeny` | `/tpdeny` (alias `/tpno`) | `tpa.deny` | `true` | Denies the newest request |
| `/tptoggle` | `/tptoggle` | `tpa.toggle` | `true` | Toggles receiving requests |

## Additional permissions

| Permission | Default | Description |
|---|---|---|
| `tpa.bypass.toggle` | `false` | Sends requests even when the target disabled receiving |
| `tpa.bypass.distance` | `false` | Ignores the distance limit |
| `tpa.bypass.crossdimension` | `false` | Ignores the dimension lock |

> **Warning:** `/tphere` is **not** an alias of `/tpahere`, it is a separate admin command (`teleport.tphere`, default `false`) without confirmation by the target player.

> **Tip:** The receiver gets clickable accept/deny buttons. The receiving status (`/tptoggle`) persists across restarts. If either player leaves the server, the request is removed and the other side is notified.

## Configuration (modules/tpa.yml)

```yaml
# Enables or disables the TPA module.
enabled: true

tpa:
  # Seconds before an unanswered request expires.
  request-timeout: 60
  # Maximum distance between sender and target. 0 = no limit.
  # With an active limit, another world always counts as too far.
  max-distance: 0
  # Allows requests across worlds/dimensions (only relevant
  # when no distance limit applies).
  allow-cross-dimension: true

cooldown:
  # Wait time in seconds between two requests.
  commands:
    tpa: 10

cost:
  # Price per request. 0 = free.
  commands:
    tpa: 0

warmup:
  # Countdown before the accepted teleport.
  commands:
    tpa:
      duration: 3
```

## Complete example config

```yaml
enabled: true

tpa:
  request-timeout: 30
  max-distance: 5000
  allow-cross-dimension: false

cooldown:
  commands:
    tpa: 30

cost:
  commands:
    tpa: 10.0

warmup:
  commands:
    tpa:
      duration: 5
```
