CarouselMountEvent
Event Contract
Section titled “Event Contract”dev.despical.carousel.api.event.carousel.CarouselMountEvent is synchronous and cancellable. It is fired for a player mounting a managed horse after per-ride riding, saddle compatibility and global riding-permission checks pass.
| Method | Meaning |
|---|---|
getCarousel() | Live ride involved in the attempt. |
getCarousel().getName() | Its case-sensitive saved ID. |
getPlayer() | Player attempting to mount. |
isCancelled() / setCancelled(boolean) | Inspect or deny the attempt. |
Cancellation cancels the underlying mount and suppresses Carousel’s normal mount sound/message. Other Bukkit listeners can still deny the underlying interaction after the custom event.
Example Listener
Section titled “Example Listener”This integration example restricts a ride to a custom ticket permission:
import dev.despical.carousel.api.event.carousel.CarouselMountEvent;import org.bukkit.event.EventHandler;import org.bukkit.event.Listener;
public final class RideAccessListener implements Listener {
@EventHandler public void onMount(CarouselMountEvent event) { if ("vip".equals(event.getCarousel().getName()) && !event.getPlayer().hasPermission("myplugin.vipride")) { event.setCancelled(true); event.getPlayer().sendMessage("This ride requires a VIP ticket."); } }}Register the listener with your own plugin and declare a runtime Carousel dependency. Run integration work on the server thread; retain no ride references across disable/reload. See dependency setup.