diff --git a/src/main/java/net/minestom/server/acquirable/Acquirable.java b/src/main/java/net/minestom/server/acquirable/Acquirable.java index 8d1baf270..6a23ce490 100644 --- a/src/main/java/net/minestom/server/acquirable/Acquirable.java +++ b/src/main/java/net/minestom/server/acquirable/Acquirable.java @@ -98,11 +98,19 @@ public interface Acquirable { * {@link Optional#empty()} otherwise */ default @NotNull Optional local() { - if (Thread.currentThread() == getHandler().getTickThread()) - return Optional.of(unwrap()); + if (isLocal()) return Optional.of(unwrap()); return Optional.empty(); } + /** + * Gets if the acquirable element is local to this thread + * + * @return true if the element is linked to the current thread + */ + default boolean isLocal() { + return Thread.currentThread() == getHandler().getTickThread(); + } + /** * Locks the acquirable element, execute {@code consumer} synchronously and unlock the thread. *