Class BaseHolder<D extends Display>

java.lang.Object
me.hsgamer.hscore.ui.BaseHolder<D>
Type Parameters:
D - The type of Display
All Implemented Interfaces:
Holder<D>, Initializable, Updatable
Direct Known Subclasses:
GUIHolder

public abstract class BaseHolder<D extends Display> extends Object implements Holder<D>
A simple implementation of Holder
  • Field Details

  • Constructor Details

    • BaseHolder

      public BaseHolder()
  • Method Details

    • newDisplay

      @NotNull protected abstract D newDisplay(UUID uuid)
      Make a new display
      Parameters:
      uuid - the unique id
      Returns:
      the display
    • onRemoveDisplay

      protected void onRemoveDisplay(@NotNull D display)
      Called when the display is removed
      Parameters:
      display - the display
    • createDisplay

      @NotNull public D createDisplay(@NotNull @NotNull UUID uuid)
      Description copied from interface: Holder
      Create a display with the unique id
      Specified by:
      createDisplay in interface Holder<D extends Display>
      Parameters:
      uuid - the unique id
      Returns:
      the display
    • removeDisplay

      public void removeDisplay(@NotNull @NotNull UUID uuid)
      Description copied from interface: Holder
      Remove a display with the unique id
      Specified by:
      removeDisplay in interface Holder<D extends Display>
      Parameters:
      uuid - the unique id
    • removeAllDisplay

      public void removeAllDisplay()
      Description copied from interface: Holder
      Remove all displays
      Specified by:
      removeAllDisplay in interface Holder<D extends Display>
    • getDisplay

      public Optional<@NotNull D> getDisplay(@NotNull @NotNull UUID uuid)
      Description copied from interface: Holder
      Get the display for the unique id
      Specified by:
      getDisplay in interface Holder<D extends Display>
      Parameters:
      uuid - the unique id
      Returns:
      the display
    • update

      public void update()
      Description copied from interface: Updatable
      Update the updatable object
      Specified by:
      update in interface Updatable
    • stop

      public void stop()
      Description copied from interface: Initializable
      Stop the object
      Specified by:
      stop in interface Initializable
    • addEventConsumer

      public <T> void addEventConsumer(@NotNull @NotNull Class<T> eventClass, @NotNull @NotNull Consumer<T> eventConsumer)
      Add an event consumer
      Type Parameters:
      T - the type of the event
      Parameters:
      eventClass - the class of the event
      eventConsumer - the consumer
    • clearEventConsumer

      public void clearEventConsumer(@NotNull @NotNull Class<?> eventClass)
      Clear the event consumer
      Parameters:
      eventClass - the class of the event
    • clearAllEventConsumer

      public void clearAllEventConsumer()
      Clear all event consumers
    • handleEvent

      public void handleEvent(@NotNull @NotNull Class<?> eventClass, @NotNull @NotNull Object event)
      Handle the event
      Parameters:
      eventClass - the class of the event
      event - the event
    • handleEvent

      public <E> void handleEvent(@NotNull E event)
      Description copied from interface: Holder
      Handle the event
      Specified by:
      handleEvent in interface Holder<D extends Display>
      Parameters:
      event - the event