Skip to content
On this page

☕ Hyrex Animations API

With the HyrexAnimations API you can show animations to your users, from your plugins, and trigger animation start and finish events. You can find the Javadoc here.

📙 Installation

The API is available on GitHub and you can download it from JitPack, to implement it in your plugin, add it to you pom.xml or build.gradle file.

kotlin
repositories {
    maven("https://jitpack.io")
}

dependencies {
    compileOnly("com.github.HyrexStudios:hyrexanimations-api:VERSION")
}
groovy
repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    compileOnly 'com.github.HyrexStudios:hyrexanimations-api:VERSION'
}
xml
<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>com.github.HyrexStudios</groupId>
        <artifactId>hyrexanimations-api</artifactId>
        <version>VERSION</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

Now you will need to add HyrexAnimations as a soft-dependency in your plugin.yml file.

yaml
name: YourPlugin
main: com.example.yourplugin.Main
version: 1.0.0
description: An amazing plugin
author: Amazing Author
softdepend: 
    - HyrexAnimations

📘 Getting the API

When the plugin is enabled, the instance of the API will be registered in the Bukkit Services Manager. So you could get it through the ServicesManager.

java
RegisteredServiceProvider<HyrexAnimationsAPI> provider = Bukkit.getServicesManager().getRegistration(HyrexAnimationsAPI.class);

if (provider != null) {
    HyrexAnimationsAPI api = provider.getProvider();
}

👀 Showing animations

You can show 2 types of animations, registered animations, which are animations created by the plugin, or API animations, which are animations created by using the API. To show an animation, you need to use the corresponding showAnimation method of the API. Methods must be executed synchronously.

java
HyrexAnimationsAPI api = ...;

// Showing a registered animation
String animationName = "good_job";
api.showAnimation(animationName, DisplayType.TITLE); // Display the 'good_job' animation as a title to all online players

Condition condition = new Condition("staff", Condition.Type.HAS_PERMISSION, "group.staff");
api.showAnimation(animationName, DisplayType.SUBTITLE, condition); // You can also use conditions to show the animation to specific players

// Showing an API animation
Animation animation = new Animation("amazing_animation", List.of("Hello", "Amazing", "Users!"), 1.0, false, false);
api.showAnimation(animation, DisplayType.ACTIONBAR); // Display the 'amazing_animation' animation as an actionbar to all online players

Check all the available methods in HyrexAnimationsAPI Javadoc.