Interface PlatformAdapter


public interface PlatformAdapter
Adapts platform-specific objects and operations to the BetterModel API.

This interface provides methods for retrieving players, creating items, and checking server state, abstracting away the differences between platforms like Bukkit and Fabric.

Since:
2.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    air()
    Returns a platform-specific representation of an empty item stack (air).
    boolean
    Checks if it is safe to access region data from the current thread.
    boolean
    Checks if the current thread is the main server tick thread.
    offlinePlayer(@NotNull UUID uuid)
    Retrieves an offline player by their UUID.
    @Nullable PlatformPlayer
    player(@NotNull UUID uuid)
    Retrieves an online player by their UUID.
    int
    Returns the server's default view distance.
    Returns a location at coordinates (0, 0, 0) in a default or null world.
  • Method Details

    • serverViewDistance

      int serverViewDistance()
      Returns the server's default view distance.
      Returns:
      the view distance in chunks
      Since:
      2.0.0
    • isTickThread

      boolean isTickThread()
      Checks if the current thread is the main server tick thread.
      Returns:
      true if on the tick thread, false otherwise
      Since:
      2.0.0
    • isRegionSafe

      boolean isRegionSafe()
      Checks if it is safe to access region data from the current thread.
      Returns:
      true if safe, false otherwise
      Since:
      2.0.0
    • player

      @Nullable @Nullable PlatformPlayer player(@NotNull @NotNull UUID uuid)
      Retrieves an online player by their UUID.
      Parameters:
      uuid - the player's UUID
      Returns:
      the player, or null if not found/offline
      Since:
      2.0.0
    • offlinePlayer

      @NotNull @NotNull PlatformOfflinePlayer offlinePlayer(@NotNull @NotNull UUID uuid)
      Retrieves an offline player by their UUID.
      Parameters:
      uuid - the player's UUID
      Returns:
      the offline player
      Since:
      2.0.0
    • air

      @NotNull @NotNull PlatformItemStack air()
      Returns a platform-specific representation of an empty item stack (air).
      Returns:
      the air item stack
      Since:
      2.0.0
    • zero

      @NotNull @NotNull PlatformLocation zero()
      Returns a location at coordinates (0, 0, 0) in a default or null world.
      Returns:
      the zero location
      Since:
      2.0.0