Class AbstractEventHandler

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean consuming
      Whether this handler may consume events.
      protected boolean critical
      Whether this handler is critical and failures should abort all event handling.
      protected boolean exclusive
      Whether this handler needs to handle events exclusively.
      protected String id
      The ID of this handler (usually the plugin ID).
      protected boolean interruptible
      Whether this event handler can be interrupted while handling an event.
      protected Logger logger
      The logger for logging problems and various information.
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractEventHandler​(Registry registry, boolean exclusive, boolean consuming, boolean critical)
      Creates a new event handler having the designated ID and the designated flags.
      AbstractEventHandler​(Registry registry, boolean exclusive, boolean consuming, boolean critical, boolean interruptible)
      Creates a new event handler having the designated ID and the designated flags.
      AbstractEventHandler​(String id, boolean exclusive, boolean consuming, boolean critical)
      Creates a new event handler having the designated ID and the designated flags.
      AbstractEventHandler​(String id, boolean exclusive, boolean consuming, boolean critical, boolean interruptible)
      Creates a new event handler having the designated ID and the designated flags.
    • Field Detail

      • logger

        protected final Logger logger
        The logger for logging problems and various information.
      • id

        protected final String id
        The ID of this handler (usually the plugin ID).
      • exclusive

        protected final boolean exclusive
        Whether this handler needs to handle events exclusively.
      • consuming

        protected final boolean consuming
        Whether this handler may consume events.
      • critical

        protected final boolean critical
        Whether this handler is critical and failures should abort all event handling.
      • interruptible

        protected final boolean interruptible
        Whether this event handler can be interrupted while handling an event.
    • Constructor Detail

      • AbstractEventHandler

        public AbstractEventHandler​(String id,
                                    boolean exclusive,
                                    boolean consuming,
                                    boolean critical)
        Creates a new event handler having the designated ID and the designated flags. If the handler is consuming or critical, it will also be exclusive.
        Parameters:
        id - The ID of this handler (usually the plugin ID).
        exclusive - Whether this handler needs to handle events exclusively. If this handler is consuming or critical, this parameter will be ignored.
        consuming - Whether this handler may consume events. If the handler is consuming, it is also exclusive.
        critical - Whether this handler is critical. If the handler is critical, it will also be exclusive.
      • AbstractEventHandler

        public AbstractEventHandler​(String id,
                                    boolean exclusive,
                                    boolean consuming,
                                    boolean critical,
                                    boolean interruptible)
        Creates a new event handler having the designated ID and the designated flags. If the handler is consuming or critical, it will also be exclusive.
        Parameters:
        id - The ID of this handler (usually the plugin ID).
        exclusive - Whether this handler needs to handle events exclusively. If this handler is consuming or critical, this parameter will be ignored.
        consuming - Whether this handler may consume events. If the handler is consuming, it is also exclusive.
        critical - Whether this handler is critical. If the handler is critical, it will also be exclusive.
        interruptible - Whether this event handler can be interrupted while handling an event.
      • AbstractEventHandler

        public AbstractEventHandler​(Registry registry,
                                    boolean exclusive,
                                    boolean consuming,
                                    boolean critical)
        Creates a new event handler having the designated ID and the designated flags. If the handler is consuming or critical, it will also be exclusive.
        Parameters:
        registry - The registry to get the ID of this handler (the simple name of the plugin instance).
        exclusive - Whether this handler needs to handle events exclusively. If this handler is consuming or critical, this parameter will be ignored.
        consuming - Whether this handler may consume events. If the handler is consuming, it is also exclusive.
        critical - Whether this handler is critical. If the handler is critical, it will also be exclusive.
      • AbstractEventHandler

        public AbstractEventHandler​(Registry registry,
                                    boolean exclusive,
                                    boolean consuming,
                                    boolean critical,
                                    boolean interruptible)
        Creates a new event handler having the designated ID and the designated flags. If the handler is consuming or critical, it will also be exclusive.
        Parameters:
        registry - The registry to get the ID of this handler (the simple name of the plugin instance).
        exclusive - Whether this handler needs to handle events exclusively. If this handler is consuming or critical, this parameter will be ignored.
        consuming - Whether this handler may consume events. If the handler is consuming, it is also exclusive.
        critical - Whether this handler is critical. If the handler is critical, it will also be exclusive.
        interruptible - Whether this event handler can be interrupted while handling an event.
    • Method Detail

      • getID

        public String getID()
        Description copied from interface: EventHandler
        Gets the ID of this event handler. This uniquely identifies the handler with respect to the corresponding event manager. If the event handler is loaded as plugin of the event manager, the ID should correspond to the simple plugin instance name.
        Specified by:
        getID in interface EventHandler
        Returns:
        The ID of this event handler which uniquely identifies the handler with respect to the corresponding event manager.
      • isExclusive

        public boolean isExclusive()
        Description copied from interface: EventHandler
        Gets whether this event handler is exclusive and thus no concurrent event handling should take place while this handler is processing an event.
        In case of a consuming handler, exclusive handling is always implicitly presumed.
        Specified by:
        isExclusive in interface EventHandler
        Returns:
        Whether this event handler is exclusive and thus no concurrent event handling should take place while this handler is processing an event.
      • isConsuming

        public boolean isConsuming()
        Description copied from interface: EventHandler
        Gets whether this event handler is consuming and therefore may change or consume an event while processing it. This does not indicate that all events will be consumed when handled.
        A consuming handler is always exclusive.
        Specified by:
        isConsuming in interface EventHandler
        Returns:
        Whether this event handler is consuming and thus may change or consume an event while processing it.
      • isInterruptible

        public boolean isInterruptible()
        Description copied from interface: EventHandler
        Whether this event handler can be interrupted while handling an event. If so, it must expect an interrupt any time. If not, it has to be aware that the event may have been cancelled while handling.
        This must not change at any time.
        Specified by:
        isInterruptible in interface EventHandler
        Returns:
        Whether this event handler can be interrupted while handling an event.
      • isCritical

        public boolean isCritical()
        Gets whether this handler is critical and failures should abort all event handling.
        Returns:
        Whether this handler is critical and failures should abort all event handling.