diff --git a/src/main/java/net/worldseed/multipart/animations/AnimationHandler.java b/src/main/java/net/worldseed/multipart/animations/AnimationHandler.java index 67f4033..b67061d 100644 --- a/src/main/java/net/worldseed/multipart/animations/AnimationHandler.java +++ b/src/main/java/net/worldseed/multipart/animations/AnimationHandler.java @@ -1,6 +1,7 @@ package net.worldseed.multipart.animations; import com.google.gson.JsonElement; +import org.jetbrains.annotations.Nullable; import java.util.Map; @@ -26,7 +27,6 @@ public interface AnimationHandler { void stopRepeat(String animation) throws IllegalArgumentException; - /** * Play an animation once * @@ -56,7 +56,15 @@ public interface AnimationHandler { * * @return current animation */ - String getPlaying(); + @Nullable String getPlaying(); + + + /** + * Get the current repeating animation + * + * @return current repeating animation + */ + @Nullable String getRepeating(); Map animationPriorities(); diff --git a/src/main/java/net/worldseed/multipart/animations/AnimationHandlerImpl.java b/src/main/java/net/worldseed/multipart/animations/AnimationHandlerImpl.java index 5ec3bd6..a40ba56 100644 --- a/src/main/java/net/worldseed/multipart/animations/AnimationHandlerImpl.java +++ b/src/main/java/net/worldseed/multipart/animations/AnimationHandlerImpl.java @@ -8,6 +8,7 @@ import net.minestom.server.timer.TaskSchedule; import net.worldseed.multipart.GenericModel; import net.worldseed.multipart.ModelLoader; +import org.jetbrains.annotations.Nullable; import java.util.*; import java.util.concurrent.ConcurrentHashMap; @@ -238,8 +239,14 @@ public void destroy() { this.task.cancel(); } - public String getPlaying() { + @Override + public @Nullable String getPlaying() { if (this.playingOnce != null) return this.playingOnce; + return getRepeating(); + } + + @Override + public @Nullable String getRepeating() { var playing = this.repeating.firstEntry(); return playing != null ? playing.getValue().name() : null; }