Okay, I've noticed a lot of threads about "My event wont work" "My plugin doesn't work" A lot of times, it's because You need to register your events You need @EventHandler So, if you do not know what an event is, this is an example: PHP: @EventHandler public void onInteract(PlayerInteractEvent event) { if(event.getAction().equals(Action.RIGHT_CLICK_AIR)) { event.getPlayer().sendMessage("Look! This is an event! :D"); } } But, in order for this event to work, you need the @EventHandler tag above it. Doing something like this: PHP: public void onInteract(PlayerInteractEvent event) { if(event.getAction().equals(Action.RIGHT_CLICK_AIR)) { event.getPlayer().sendMessage("Look! This is an event! :D"); } } will not work, because there is no @EventHandler tag. Now moving on to Registering your events. Lets say that these events are in your MAIN class. To register your events you would simply do PHP: public void onEnable() {Bukkit.getPluginManager().registerEvents(this, this);} But say it was in a different class, for example a class called "Listeners" we would have to do this: PHP: Listeners listeners = new Listeners();public void onEnable() {Bukkit.getPluginManager().registerEvents(listeners, this);} I hope this helps! For any more info, you can go here: http://wiki.bukkit.org/Event_API_Reference#Registering_Events If you have any ideas or suggestions: please leave a comment!
sgavster Nice thread. Simple and concise. You should also add a link to http://wiki.bukkit.org/Event_API_Reference#Registering_Events, for people who are still unsure of what to do.
sgavster Make sure to mentioned to use the same class instance if you are using ArrayLists and such with commands and listeners in the same class.