Last active
October 18, 2024 11:39
-
-
Save Despical/1d197630856e5ec2c3feef00ff4ba799 to your computer and use it in GitHub Desktop.
The example API usage for Despical's Carousel plugin.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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