Skip to main content

Register custom animations

To create an animation class, we will use the JavaAnimation abstract class

Pay attention to the methods: Case#animationPreEnd and Case#animationEnd

TestAnimation class

import com.jodexindustries.donatecase.api.Case;
import com.jodexindustries.donatecase.api.data.JavaAnimation;
import org.bukkit.Bukkit;

public class TestAnimation extends JavaAnimation {
@Override
public void start() {
Case.animationPreEnd(getCaseData(), getPlayer(), getUuid(), getWinItem());
Bukkit.getScheduler().runTaskLater(Case.getInstance(), () -> Case.animationEnd(getCaseData(), getPlayer(), getUuid(), getWinItem()),20L);
}
}


Main class

    @Override
public void onEnable() {
// getting CaseManager for addon
CaseManager api = new CaseManager(this);
// register animation
AnimationManager animationManager = api.getAnimationManager();
animationManager.registerAnimation("test", TestAnimation.class);
}