# API

## Add Tooltips to your plugin

Fill in the `VERSION` with the Tooltips version. Latest version can be found on Jenkins: [https://jitpack.io/#Septicuss/tooltips](https://jitpack.io/#Septicuss/tooltips/) go to "Commits" tab, and click "Get it" on the highest commit, wait until it builds and use it in Maven or Gradle as outlined below:

Also remember to add Tooltips as a dependency or soft-dependency in your plugin.yml:

```yaml
depend: [Tooltips]
```

or

```yaml
softdepend: [Tooltips]
```

### Maven

Repository (JitPack)

```xml
<repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
</repository>
```

Dependency

```xml
<dependency>
    <groupId>com.github.Septicuss</groupId>
    <artifactId>tooltips</artifactId>
    <version>VERSION</version>
    <scope>provided</scope>
</dependency>
```

### Gradle

Repository (JitPack)

```gradle
maven { url 'https://jitpack.io' }
```

Dependency

```gradle
dependencies {
        implementation 'com.github.Septicuss:tooltips:VERSION'
}
```

## Using the API

### TooltipsAPI.java static methods

```java
addCondition(Condition condition)
removeCondition(String name)
Set<String> getConditions()

addFunction(String name, Function function)
removeFunction(String name, Function function)

runAction(String action, Player player)

sendTooltip(Player player, Preset preset)
sendTooltip(Player player, Preset preset, List<String> override)
sendTooltip(Player player, Theme theme, List<String> override)

Tooltip getTooltip(Player player, Preset preset, @Nullable List<String> override)
Tooltip getTooltip(Player player, Theme theme, @Nullable List<String> override)

boolean doesThemeExist(String id)
Theme getTheme(String id)
Set<String> getThemeIds()

boolean doesPresetExist(String id)
Preset getPreset(String id)
Set<String> getPresetIds()
```

### Custom conditions

Learn how to create custom conditions here:

{% content-ref url="api/custom-conditions" %}
[custom-conditions](https://tooltips.gitbook.io/tooltips/extra/api/custom-conditions)
{% endcontent-ref %}

You can alternatively use the [compare ](https://tooltips.gitbook.io/tooltips/configuration/preset/condition-list#compare)condition to compare PAPI placeholders of any custom plugin you may want to be supported.
