Developer API
The Carousel API allows developers to hook into the plugin’s lifecycles and modify player interactions. All custom events in the plugin inherit from the base CarouselEvent class.
Dependency Setup
Section titled “Dependency Setup”To start using the API, you need to add the Carousel JAR file to your project’s dependencies. Create a folder named libs in your project’s root directory and place the carousel-x.x.x.jar file inside it.
dependencies {compileOnly files('libs/carousel-x.x.x.jar')}dependencies {compileOnly(files("libs/carousel-x.x.x.jar"))}<dependency> <groupId>dev.despical</groupId> <artifactId>carousel</artifactId> <version>LATEST</version> <scope>system</scope> <systemPath>${project.basedir}/libs/carousel-x.x.x.jar</systemPath></dependency>name: YourPluginversion: 1.0.0main: your.package.Maindepend: [Carousel]Base Event Class
Section titled “Base Event Class”Every event provided by the Carousel API extends the CarouselEvent class. This ensures consistent access to the carousel instance data across all interactions.
public abstract class CarouselEvent extends Event {
private static final HandlerList HANDLER_LIST = new HandlerList();
protected final Carousel carousel;
public CarouselEvent(Carousel carousel) { this.carousel = carousel; }
public Carousel getCarousel() { return carousel; }
@NotNull @Override public HandlerList getHandlers() { return HANDLER_LIST; }
public static HandlerList getHandlerList() { return HANDLER_LIST; }}Next Steps
Section titled “Next Steps”Explore the specific events triggered during player interactions:
- CarouselMountEvent: Called when a player attempts to mount a horse that is part of a Carousel.
- CarouselDismountEvent: Called when a player dismounts a horse that is part of a Carousel.