Search in sources :

Example 11 with HandlerList

use of org.bukkit.event.HandlerList in project Dragonet-Legacy by DragonetMC.

the class MixedPluginManager method fireEvent.

private void fireEvent(Event event) {
    HandlerList handlers = event.getHandlers();
    RegisteredListener[] listeners = handlers.getRegisteredListeners();
    for (RegisteredListener registration : listeners) {
        if (!registration.getPlugin().isEnabled()) {
            continue;
        }
        try {
            registration.callEvent(event);
        } catch (AuthorNagException ex) {
            Plugin plugin = registration.getPlugin();
            if (plugin.isNaggable()) {
                plugin.setNaggable(false);
                server.getLogger().log(Level.SEVERE, String.format("Nag author(s): '%s' of '%s' about the following: %s", plugin.getDescription().getAuthors(), plugin.getDescription().getFullName(), ex.getMessage()));
            }
        } catch (Throwable ex) {
            server.getLogger().log(Level.SEVERE, "Could not pass event " + event.getEventName() + " to " + registration.getPlugin().getDescription().getFullName(), ex);
        }
    }
}
Also used : HandlerList(org.bukkit.event.HandlerList) AuthorNagException(org.bukkit.plugin.AuthorNagException) TimedRegisteredListener(org.bukkit.plugin.TimedRegisteredListener) RegisteredListener(org.bukkit.plugin.RegisteredListener) Plugin(org.bukkit.plugin.Plugin)

Aggregations

HandlerList (org.bukkit.event.HandlerList)11 RegisteredListener (org.bukkit.plugin.RegisteredListener)7 AuthorNagException (org.bukkit.plugin.AuthorNagException)5 EventPriority (org.bukkit.event.EventPriority)4 Method (java.lang.reflect.Method)3 MalformedURLException (java.net.MalformedURLException)2 EventException (org.bukkit.event.EventException)2 Listener (org.bukkit.event.Listener)2 IllegalPluginAccessException (org.bukkit.plugin.IllegalPluginAccessException)2 InvalidDescriptionException (org.bukkit.plugin.InvalidDescriptionException)2 InvalidPluginException (org.bukkit.plugin.InvalidPluginException)2 TimedRegisteredListener (org.bukkit.plugin.TimedRegisteredListener)2 UnknownDependencyException (org.bukkit.plugin.UnknownDependencyException)2 BHandlerList (com.bergerkiller.reflection.org.bukkit.BHandlerList)1 ReflectionUtils (com.laytonsmith.PureUtilities.Common.ReflectionUtils)1 EventIdentifier (com.laytonsmith.annotations.EventIdentifier)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Event (org.bukkit.event.Event)1 EventHandler (org.bukkit.event.EventHandler)1 PlayerCommandPreprocessEvent (org.bukkit.event.player.PlayerCommandPreprocessEvent)1