Class BaseAnimation
java.lang.Object
de.studiocode.invui.animation.impl.BaseAnimation
- All Implemented Interfaces:
Animation
- Direct Known Subclasses:
SoundAnimation
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFinishHandler(@NotNull Runnable finish) voidaddShowHandler(@NotNull BiConsumer<Integer, Integer> show) Adds a show handler.voidcancel()Cancels theAnimation.protected intconvToIndex(int x, int y) protected voidfinish()Set<org.bukkit.entity.Player>protected intgetSlots()protected intgetWidth()protected abstract voidhandleFrame(int frame) voidvoidSets the slots that should be shown.voidsetWindows(@NotNull List<Window> windows) Sets theWindows that will see this animation.protected voidshow(int... slots) voidstart()Starts theAnimation.
-
Constructor Details
-
BaseAnimation
public BaseAnimation(int tickDelay)
-
-
Method Details
-
setGUI
Description copied from interface:Animation -
setWindows
Description copied from interface:AnimationSets theWindows that will see this animation. Useful for playing sounds in a showHandler. (Animation.addShowHandler(BiConsumer))- Specified by:
setWindowsin interfaceAnimation- Parameters:
windows- TheWindows that will see this animation
-
addShowHandler
Description copied from interface:AnimationAdds a show handler. Can be used to for example play a sound when a slot pops up.- Specified by:
addShowHandlerin interfaceAnimation- Parameters:
show- The show handler as aBiConsumerconsisting of frame number (first int) and slot index to show (second int).
-
addFinishHandler
Description copied from interface:Animation- Specified by:
addFinishHandlerin interfaceAnimation- Parameters:
finish- TheRunnablethat should run after theAnimationis finished.
-
start
public void start()Description copied from interface:AnimationStarts theAnimation. -
cancel
public void cancel()Description copied from interface:AnimationCancels theAnimation. -
finish
protected void finish() -
handleFrame
protected abstract void handleFrame(int frame) -
getSlots
-
setSlots
Description copied from interface:AnimationSets 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
-