Class BaseAnimation

java.lang.Object
de.studiocode.invui.animation.impl.BaseAnimation
All Implemented Interfaces:
Animation
Direct Known Subclasses:
SoundAnimation

public abstract class BaseAnimation extends Object implements Animation
  • Constructor Details

    • BaseAnimation

      public BaseAnimation(int tickDelay)
  • Method Details

    • setGUI

      public void setGUI(GUI gui)
      Description copied from interface: Animation
      Sets the GUI this Animation will take place in.
      Specified by:
      setGUI in interface Animation
      Parameters:
      gui - The GUI this Animation will take place in
    • setWindows

      public void setWindows(@NotNull @NotNull List<Window> windows)
      Description copied from interface: Animation
      Sets the Windows that will see this animation. Useful for playing sounds in a showHandler. (Animation.addShowHandler(BiConsumer))
      Specified by:
      setWindows in interface Animation
      Parameters:
      windows - The Windows that will see this animation
    • addShowHandler

      public void addShowHandler(@NotNull @NotNull BiConsumer<Integer,Integer> show)
      Description copied from interface: Animation
      Adds a show handler. Can be used to for example play a sound when a slot pops up.
      Specified by:
      addShowHandler in interface Animation
      Parameters:
      show - The show handler as a BiConsumer consisting of frame number (first int) and slot index to show (second int).
    • addFinishHandler

      public void addFinishHandler(@NotNull @NotNull Runnable finish)
      Description copied from interface: Animation
      Adds a Runnable that should run after the Animation is finished.
      Specified by:
      addFinishHandler in interface Animation
      Parameters:
      finish - The Runnable that should run after the Animation is finished.
    • start

      public void start()
      Description copied from interface: Animation
      Starts the Animation.
      Specified by:
      start in interface Animation
    • cancel

      public void cancel()
      Description copied from interface: Animation
      Cancels the Animation.
      Specified by:
      cancel in interface Animation
    • finish

      protected void finish()
    • handleFrame

      protected abstract void handleFrame(int frame)
    • getSlots

      public CopyOnWriteArrayList<Integer> getSlots()
    • setSlots

      public void setSlots(List<Integer> slots)
      Description copied from interface: Animation
      Sets the slots that should be shown.
      Specified by:
      setSlots in interface Animation
      Parameters:
      slots - The slots that should be shown.
    • show

      protected void show(int... slots)
    • convToIndex

      protected int convToIndex(int x, int y)
    • getWidth

      protected int getWidth()
    • getHeight

      protected int getHeight()
    • getCurrentViewers

      public Set<org.bukkit.entity.Player> getCurrentViewers()