Skip to content

Instantly share code, notes, and snippets.

@Despical
Last active October 18, 2024 11:39
Show Gist options
  • Save Despical/1d197630856e5ec2c3feef00ff4ba799 to your computer and use it in GitHub Desktop.
Save Despical/1d197630856e5ec2c3feef00ff4ba799 to your computer and use it in GitHub Desktop.
The example API usage for Despical's Carousel plugin.
import me.despical.carousel.api.events.CarouselDismountEvent;
import me.despical.carousel.api.events.CarouselMountEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
/**
* @author Despical
* <p>
* Created at 18.10.2024
*/
public class CarouselEvents extends JavaPlugin implements Listener {
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onMount(CarouselMountEvent event) {
event.setCancelled(true); // This event can be cancelled.
Carousel carousel = event.getCarousel();
Player player = event.getPlayer();
player.sendMessage("You have mounted!");
}
@EventHandler
public void onDismount(CarouselDismountEvent event) {
event.setCancelled(false); // This event can be cancelled.
Carousel carousel = event.getCarousel();
Player player = event.getPlayer();
player.sendMessage("You have dismounted!");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment