Class CallbackManager

java.lang.Object
net.tnemc.plugincore.core.api.CallbackManager

public class CallbackManager extends Object
CallbackManager used to manage specific callbacks.
Since:
0.1.2.0
Author:
creatorfromhell
  • Constructor Details

  • Method Details

    • addCallback

      public void addCallback(String identifier, CallbackEntry entry)
      Used to add a new callback into the system.
      Parameters:
      identifier - The identifier of the callback to add.
      entry - The CallbackEntry, which manages the consumers.
    • addConsumer

      public void addConsumer(String name, Function<Callback,Boolean> consumer)
      Used to add a consumer for this callback.
      Parameters:
      name - The name of the callback to attach this consumer to.
      consumer - The consumer to add for this callback. This is an implementation of the Function interface, which accepts an Callback parameter and returns a boolean value, which indicates if the "event" should be cancelled or not.
    • call

      public boolean call(Callback callback)
      Used to call all the consumers for this callback.
      Parameters:
      callback - The callback class for this consumer.
      Returns:
      This returns a boolean value, which equates to whether this event is cancelled or not.