# PlaceholderAPI Support

### Requirements

* PlaceholderAPI plugin installed
* Spawn Elytra plugin installed
* Server restart after installing both plugins

### Available Placeholders

| Placeholder                 | Description                   | Example Output |
| --------------------------- | ----------------------------- | -------------- |
| `%spawnelytra_fly_count%`   | Times player activated elytra | 42             |
| `%spawnelytra_boost_count%` | Times player used boost       | 156            |
| `%spawnelytra_total_count%` | Combined fly + boost count    | 198            |

### Installation

1. Install [PlaceholderAPI](https://www.spigotmc.org/resources/placeholderapi.6245/)
2. Install Spawn Elytra
3. Restart your server
4. Placeholders will automatically register

To verify installation, use the parse command:

```
/papi parse <player> %spawnelytra_fly_count%
```

### Usage Examples

#### Scoreboards

Using with scoreboard plugins (FeatherBoard, AnimatedScoreboard, etc.):

```yaml
lines:
  - '&6Elytra Stats:'
  - '&fFlights: &b%spawnelytra_fly_count%'
  - '&fBoosts: &b%spawnelytra_boost_count%'
  - '&fTotal: &b%spawnelytra_total_count%'
```

#### Holograms

Using with hologram plugins (HolographicDisplays, DecentHolograms):

```
/hd addline stats &6Elytra Flights: &f%spawnelytra_fly_count%
/hd addline stats &6Boost Uses: &f%spawnelytra_boost_count%
```

#### Chat Plugins

Using with chat formatting plugins (EssentialsChat, ChatControl):

```yaml
format: '&7[&6%spawnelytra_fly_count%&7] &f{player}: &7{message}'
```

#### Tab List

Using with TAB plugin:

```yaml
header:
  - '&6Your Elytra Stats'
  - '&fFlights: %spawnelytra_fly_count% | Boosts: %spawnelytra_boost_count%'
```

#### Signs

Using with sign plugins:

```
Line 1: &6[Elytra Stats]
Line 2: Flights: %spawnelytra_fly_count%
Line 3: Boosts: %spawnelytra_boost_count%
Line 4: Total: %spawnelytra_total_count%
```

### Integration with Popular Plugins

#### DeluxeMenus

Create a stats menu:

```yaml
items:
  elytra_stats:
    material: ELYTRA
    display_name: '&6Elytra Statistics'
    lore:
      - '&7Times flown: &b%spawnelytra_fly_count%'
      - '&7Boosts used: &b%spawnelytra_boost_count%'
      - '&7Total actions: &b%spawnelytra_total_count%'
```

#### Quests Plugins

Use placeholders for quest objectives:

```yaml
quests:
  flight_master:
    objectives:
      - type: placeholder
        placeholder: spawnelytra_fly_count
        value: 100
        operation: ">="
```

#### Leaderboards

Create leaderboards with LeaderHeads or similar:

```yaml
boards:
  elytra_flights:
    placeholder: spawnelytra_fly_count
    title: '&6Top Flyers'
    size: 10
```

### Advanced Usage

#### Conditional Displays

With conditional placeholders:

```
%javascript_
(function() {
  var count = %spawnelytra_fly_count%;
  if (count >= 100) return '&6Flight Master';
  if (count >= 50) return '&bExperienced Flyer';
  if (count >= 10) return '&aNovice Flyer';
  return '&7Beginner';
})()
%
```

#### Math Operations

Combine with math placeholders:

```
%math_{spawnelytra_fly_count}*2%
%math_{spawnelytra_boost_count}/{spawnelytra_fly_count}%
```

#### Rank Systems

Create ranks based on usage:

```yaml
ranks:
  beginner:
    requirement: '%spawnelytra_fly_count% < 10'
    prefix: '&7[Beginner Flyer]'
  
  intermediate:
    requirement: '%spawnelytra_fly_count% >= 10 && %spawnelytra_fly_count% < 50'
    prefix: '&a[Sky Explorer]'
  
  expert:
    requirement: '%spawnelytra_fly_count% >= 50'
    prefix: '&6[Flight Master]'
```

### Troubleshooting

#### Placeholders Not Working

1. Check PlaceholderAPI is installed: `/papi version`
2. Verify Spawn Elytra is loaded: `/spawnelytra info`
3. Check expansion is registered: `/papi list`
4. Try reloading: `/papi reload`

#### Common Issues

* **Shows %placeholder%**: PlaceholderAPI not installed or placeholder not registered
* **Shows 0 always**: Player data not loading correctly
* **Not updating**: May need to rejoin server

#### Debug Commands

```
/papi parse <player> %spawnelytra_fly_count%
/papi parse <player> %spawnelytra_boost_count%
/papi parse <player> %spawnelytra_total_count%
```

### Performance

* Placeholders are cached and update efficiently
* Safe to use in frequently updating displays
* No significant performance impact
* Data persists across server restarts

### Data Storage

Player statistics are stored in:

```
plugins/SpawnElytra/playerdata/<UUID>.yml
```

Example data file:

```yaml
fly_count: 42
boost_count: 156
```

### API Information

For developers wanting to access the data directly:

```java
PlayerDataManager manager = plugin.getPlayerDataManager();
PlayerData data = manager.getPlayerData(player.getUniqueId());
int flyCount = data.getFlyCount();
int boostCount = data.getBoostCount();
```

### See Also

* [Configuration](https://blaxk.gitbook.io/spawnelytra/configuration) - Plugin configuration
* [Getting Started](https://blaxk.gitbook.io/spawnelytra/readme) - Basic usage
