Custom Events Custom events have been possible in bukkit for a long time. There is a few posts around showing them to be posssible but there is no "easy" tutorials... So as you can see I decided to make one Why Would you Need a Custom Event?Well first of all with plugins I see a lot of plugin developers not usingJava how its supposed to be used (by my hippo-critical standards at least). Its object orientated! Plus back onto the point its supposed to be made quite modular. What this means is that you build every thing you do into modules which fit together so even if you added another module you shouldn't have to change the ones you already have. Custom events can also be used in an api type plugin which creates interaction between multiple plugins.Now lets say you had a plugin which was like voxelsniper or world edit and you wanted other people to be able to access events such as when a person selects an area with a wand. Lets call the plugin WorldSniper (Very original) Creating the Custom Event class First You Want to create the events class WorldSniperWandSelectionEvent.class (Move your mouse to reveal the content) WorldSniperWandSelectionEvent.class (open) WorldSniperWandSelectionEvent.class (close) Code:JAVA import org.bukkit.Bukkit;import org.bukkit.entity.Player;import org.bukkit.event.Cancellable;import org.bukkit.event.HandlerList;import org.bukkit.Location; /**** An Event that fires when a player Selects something with the World sniper wand** @see Event**/public class WorldSniperWandSelectionEvent extends Event implements Cancellable { private static final HandlerList handlers = new HandlerList();private boolean cancelled;String p; // Player Stored as a string (the players name) to prevent memory leakLocation pos1;Location pos2; /*** Constructor of a WorldSniperWandSelectionEvent * * Between pos1 and pos2 is the selection ** @param p - Player that is selecting Something WIth the wand * @param pos1 - The First Position* @param pos2 - The Second Position*/public WorldSniperWandSelectionEvent(String p, Location pos1, Location pos2) { this.p = p.getName();this.pos1 = pos1;this.pos2 = pos2;this.cancelled = false; } public Location getPos1() {return pos1;} public Location getPos2() {return pos2;} public String getPlayerName() {return p;} public Player getPlayer() throws NullPointerException {return Bukkit.getServer().getPlayer(p);} @Overridepublic HandlerList getHandlers() { return handlers;} public static HandlerList getHandlerList() {return handlers;} @Overridepublic boolean isCancelled() {return cancelled;} @Overridepublic void setCancelled(boolean cancel) { this.cancelled = cancel; } } If you wanted with that class you could make it so it would get all the blocks and do tons of other things but thats up to you. Creating the Event Caller Method Ok So Now That We've done that we can create a method to call the event for example Code:JAVA public void handleWandSelection(Player p, Location loc1, Location loc2) {[/LEFT] WorldSniperWandSelectionEvent e = new WorldSniperWandSelectionEvent(p, loc1, loc2); //Calls The Eventpl.getServer().getPluginManager().callEvent(e); //Checks If the event was cancelled by any other plugin or in another part of this pluginif(!e.isCancelled()) {//OTHER SELECTION STUFFp.sendMessage("Sucessfully Selection");} else {p.sendMessage("Sorry Selection Not Allowed");}} Creating the Listener And Finally we need to Have A Listener for the Event Code:JAVA public class normalListener implements Listener { public normalListener(Plugin pl) {pl.getServer().getPluginManager().registerEvents(this,pl);} //Demonstration - It works like normal bukkit events@EventHandlerpublic void onPlayerJoinEvent(PlayerJoinEvent e) {e.getPlayer().sendMessage("Hi!");} @EventHandlerpublic void onWorldSniperWandSelectionEvent(WorldSniperWandSelectionEvent e) {if(e.getPlayerName().equalsIgnoreCase("pokuit")) {e.setCancelled(true);}}} Conclusion I think that covers everything. if I missed anything out or if you think I could make certain aspects of it clearer just point it out in the comments and I will change it accordingly Any Comments are appreciated Reserved Comment Space EDIT by Moderator: merged posts, please use the edit button instead of double posting.