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 TypeMethodDescription@NotNull PlatformItemStackair()Returns a platform-specific representation of an empty item stack (air).booleanChecks if it is safe to access region data from the current thread.booleanChecks if the current thread is the main server tick thread.@NotNull PlatformOfflinePlayerofflinePlayer(@NotNull UUID uuid) Retrieves an offline player by their UUID.@Nullable PlatformPlayerRetrieves an online player by their UUID.intReturns the server's default view distance.@NotNull PlatformLocationzero()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
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
Retrieves an offline player by their UUID.- Parameters:
uuid- the player's UUID- Returns:
- the offline player
- Since:
- 2.0.0
-
air
Returns a platform-specific representation of an empty item stack (air).- Returns:
- the air item stack
- Since:
- 2.0.0
-
zero
Returns a location at coordinates (0, 0, 0) in a default or null world.- Returns:
- the zero location
- Since:
- 2.0.0
-