CarouselDismountEvent
Event Contract
Section titled “Event Contract”dev.despical.carousel.api.event.carousel.CarouselDismountEvent is synchronous and cancellable. It wraps a player’s normal attempt to leave a managed horse.
| Method | Meaning |
|---|---|
getCarousel() | Live ride involved in the attempt. |
getCarousel().getName() | Saved ID; there is no getId() accessor. |
getPlayer() | Dismounting player. |
isCancelled() / setCancelled(boolean) | Inspect or cancel normal dismounting. |
Cancellation cancels the underlying normal action and suppresses Carousel’s normal dismount sound/message. It cannot guarantee a permanent seat lock: entity removal, ride teardown or disconnect handling may still detach players.
Example Listener
Section titled “Example Listener”This example observes accepted dismount attempts without restricting players:
import dev.despical.carousel.api.event.carousel.CarouselDismountEvent;import org.bukkit.event.EventHandler;import org.bukkit.event.Listener;
public final class RideFeedbackListener implements Listener {
@EventHandler(ignoreCancelled = true) public void onDismount(CarouselDismountEvent event) { String name = event.getCarousel().getName();
event.getPlayer().sendMessage("Thanks for riding " + name + "."); }}Register with your own plugin and declare Carousel as a runtime dependency. Later listeners may still change cancellation state; this is an interaction notification, not a persistent completed-ride record. See developer setup and mount events.