Class ListenerEntry

java.lang.Object
be.seeseemelk.mockbukkit.plugin.ListenerEntry

public class ListenerEntry extends Object
The ListenerEntry is a class that represents a single event handler of a plugin.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ListenerEntry(org.bukkit.plugin.Plugin plugin, org.bukkit.event.Listener listener, Method method)
    Creates a new listener entry for a given method.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bukkit.event.Listener
     
     
    org.bukkit.plugin.Plugin
     
    void
    invoke(org.bukkit.event.Event event)
    Tries to invoke the method handler with a given event.
    void
    invokeUnsafe(org.bukkit.event.Event event)
    Tries to invoke the method, but will cast any exceptions to RuntimeExceptions.
    boolean
    isCompatibleFor(org.bukkit.event.Event event)
    Checks if this method is compatible for a given event type.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ListenerEntry

      public ListenerEntry(org.bukkit.plugin.Plugin plugin, org.bukkit.event.Listener listener, Method method)
      Creates a new listener entry for a given method.
      Parameters:
      plugin - The plugin that owns the listener.
      listener - The listener object that contains the method.
      method - The method to call on events.
  • Method Details

    • getPlugin

      public org.bukkit.plugin.Plugin getPlugin()
    • getListener

      public org.bukkit.event.Listener getListener()
    • getMethod

      public Method getMethod()
    • invoke

      public void invoke(org.bukkit.event.Event event) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
      Tries to invoke the method handler with a given event.
      Parameters:
      event - The event to pass on to the method.
      Throws:
      IllegalAccessException - Can be thrown by the event handler.
      IllegalArgumentException - Can be thrown by the event handler.
      InvocationTargetException - Can be thrown by the event handler.
    • invokeUnsafe

      public void invokeUnsafe(org.bukkit.event.Event event)
      Tries to invoke the method, but will cast any exceptions to RuntimeExceptions.
      Parameters:
      event - The event to pass on to the method.
    • isCompatibleFor

      public boolean isCompatibleFor(org.bukkit.event.Event event)
      Checks if this method is compatible for a given event type.
      Parameters:
      event - The event type the handler should be able to handle.
      Returns:
      true if the handler can handle that event, false if it can't.