diff --git a/common/src/main/java/net/william278/huskhomes/api/BaseHuskHomesAPI.java b/common/src/main/java/net/william278/huskhomes/api/BaseHuskHomesAPI.java index bfe03725..7a73ad94 100644 --- a/common/src/main/java/net/william278/huskhomes/api/BaseHuskHomesAPI.java +++ b/common/src/main/java/net/william278/huskhomes/api/BaseHuskHomesAPI.java @@ -98,6 +98,18 @@ public abstract class BaseHuskHomesAPI { return plugin.getDatabase().getRespawnPosition(user); } + /** + * Returns if a user is currently warming up for a timed teleport; that is, they are in the state where they + * must stand still and not take damage for the set amount of seconds before a teleport can be executed. + * + * @param user The {@link User} to check + * @return {@code true} if the user is currently warming up, otherwise {@code false} + * @since 3.0.2 + */ + public boolean isUserWarmingUp(@NotNull User user) { + return plugin.getTeleportManager().isWarmingUp(user.uuid); + } + /** * Save {@link UserData} to the database, updating it if data for the user already exists, or adding new user data if it doesn't. * diff --git a/common/src/main/java/net/william278/huskhomes/teleport/TeleportManager.java b/common/src/main/java/net/william278/huskhomes/teleport/TeleportManager.java index 0da76fbe..07eecdaa 100644 --- a/common/src/main/java/net/william278/huskhomes/teleport/TeleportManager.java +++ b/common/src/main/java/net/william278/huskhomes/teleport/TeleportManager.java @@ -489,4 +489,14 @@ public class TeleportManager { return Optional.empty(); } + /** + * Returns if the player is currently warming up to teleport + * + * @param uuid the player's {@link UUID} + * @return {@code true} if the player is warming up, {@code false} otherwise + */ + public boolean isWarmingUp(@NotNull final UUID uuid) { + return currentlyOnWarmup.contains(uuid); + } + }