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

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

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

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

      public D createDisplay(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(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<D> getDisplay(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
    • addEventConsumer

      public <T> void addEventConsumer(Class<T> eventClass, Consumer<T> eventConsumer)
      Description copied from interface: Holder
      Add an event consumer
      Specified by:
      addEventConsumer in interface Holder<D extends Display>
      Type Parameters:
      T - the type of the event
      Parameters:
      eventClass - the event class
      eventConsumer - the event consumer
    • stop

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

      public void clearEventConsumer(Class<?> eventClass)
      Description copied from interface: Holder
      Clear all event consumers
      Specified by:
      clearEventConsumer in interface Holder<D extends Display>
      Parameters:
      eventClass - the event class
    • clearAllEventConsumer

      public void clearAllEventConsumer()
      Description copied from interface: Holder
      Clear all event consumers of all events
      Specified by:
      clearAllEventConsumer in interface Holder<D extends Display>
    • handleEvent

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