Class ThreadUtils
java.lang.Object
tech.guilhermekaua.spigotboot.inventoryapi.internal.util.ThreadUtils
Shared threading assertions for the inventory-api internals.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertMainThread(@NotNull String operation) Throws when not on the main server thread; when no server is present (pure unit tests), the check is skipped.static voidassertOwnsRegion(@NotNull PlatformScheduler scheduler, @NotNull org.bukkit.entity.Entity entity, @NotNull String operation) Throws when the current thread does not own the entity's region.
-
Method Details
-
assertMainThread
Throws when not on the main server thread; when no server is present (pure unit tests), the check is skipped.- Parameters:
operation- the operation name used in the error message- Throws:
IllegalStateException- when called off the main server thread
-
assertOwnsRegion
public static void assertOwnsRegion(@NotNull @NotNull PlatformScheduler scheduler, @NotNull @NotNull org.bukkit.entity.Entity entity, @NotNull @NotNull String operation) Throws when the current thread does not own the entity's region.- Parameters:
scheduler- the platform scheduler used for the ownership checkentity- the entity whose region must be owned (the viewer)operation- the operation name used in the error message- Throws:
IllegalStateException- when the current thread does not own the entity's region
-