java.lang.Object
tech.guilhermekaua.spigotboot.inventoryapi.internal.util.ThreadUtils

@Internal public final class ThreadUtils extends Object
Shared threading assertions for the inventory-api internals.
  • Method Details

    • assertMainThread

      public static void assertMainThread(@NotNull @NotNull String operation)
      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 check
      entity - 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