Interface PlatformPlayerAdapter
public interface PlatformPlayerAdapter
Platform adapter for player-related operations in FlectonePulse.
Abstracts platform-specific player APIs for cross-platform compatibility.
- Since:
- 0.8.1
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordPlayer coordinates in the world.static final recordPlayer statistics. -
Method Summary
Modifier and TypeMethodDescription@Nullable ObjectconvertToPlatformPlayer(@NonNull UUID uuid) Converts a UUID to a platform player object.default @Nullable ObjectconvertToPlatformPlayer(@NonNull FEntity entity) doubleCalculates distance between two players.default doubleConvenience form taking entities rather than their ids.findPlayersWhoCanSee(UUID uuid, double x, double y, double z) Finds players who can see a location.findPlayersWhoCanSee(@NonNull FEntity entity, double x, double y, double z) @Nullable PlatformPlayerAdapter.CoordinatesgetCoordinates(@NonNull UUID uuid) Gets player coordinates.default @Nullable PlatformPlayerAdapter.CoordinatesgetCoordinates(@NonNull FEntity entity) intgetEntityId(@NonNull UUID uuid) Gets the entity ID of a player.default intgetEntityId(@NonNull FEntity entity) Convenience form taking an entity rather than its id.@NonNull StringgetEntityTranslationKey(@Nullable Object platformPlayer) Gets the entity translation key for a player.@NonNull StringgetGamemode(@NonNull UUID uuid) Gets the player game mode.default @NonNull StringgetGamemode(@NonNull FEntity entity) @Nullable StringGets the player IP address.default @Nullable String@Nullable ObjectGets the item in the player's hand.default @Nullable Object@NonNull String@NonNull StringGets the player name from a platform player object.@NonNull StringGets the player name by UUID.default @NonNull StringGets all online player UUIDs.getPassengers(UUID uuid) Gets passengers of a player's vehicle.getPassengers(@NonNull FEntity entity) int@Nullable PlayTimegetPlayedTime(FPlayer fPlayer) Gets the total played time for a player.@Nullable UUIDgetPlayerByEntityId(int entityId) Gets the player UUID by entity ID.@Nullable Class<?> Gets the platform player class.@NonNull net.kyori.adventure.text.ComponentgetPlayerListFooter(@NonNull FPlayer fPlayer) Gets the player list footer.@NonNull net.kyori.adventure.text.ComponentgetPlayerListHeader(@NonNull FPlayer fPlayer) Gets the player list header.@Nullable PlatformPlayerAdapter.StatisticsgetStatistics(@NonNull UUID uuid) Gets player statistics.default @Nullable PlatformPlayerAdapter.StatisticsgetStatistics(@NonNull FEntity entity) @Nullable net.kyori.adventure.text.object.PlayerHeadObjectContents.ProfilePropertygetTexture(@NonNull UUID uuid) Gets the player head texture properties.default @Nullable net.kyori.adventure.text.object.PlayerHeadObjectContents.ProfilePropertygetTexture(@NonNull FEntity entity) Convenience form taking an entity rather than its id.@Nullable UUIDGets the UUID from a platform player object.@NonNull StringgetWorldEnvironment(@NonNull UUID uuid) Gets the world environment where the player is located.default @NonNull StringgetWorldEnvironment(@NonNull FEntity entity) @NonNull StringgetWorldName(@NonNull UUID uuid) Gets the world name where the player is located.default @NonNull StringgetWorldName(@NonNull FEntity entity) booleanhasPlayedBefore(@NonNull UUID uuid) Checks if the player has played before.default booleanhasPlayedBefore(@NonNull FEntity entity) Convenience form taking an entity rather than its id.booleanhasPotionEffect(@NonNull UUID uuid, @NonNull String potionType) Checks if the player has a potion effect.default booleanhasPotionEffect(@NonNull FEntity entity, @NonNull String potionType) Convenience form taking an entity rather than its id.booleanChecks if the object represents the console.booleanChecks if the player is dead.default booleanConvenience form taking an entity rather than its id.booleanChecks if the player is online.default booleanConvenience form taking an entity rather than its id.booleanisOperator(@NonNull UUID uuid) Checks if the player is an operator.default booleanisOperator(@NonNull FEntity entity) Convenience form taking an entity rather than its id.booleanisSneaking(@NonNull UUID uuid) Checks if the player is sneaking.default booleanisSneaking(@NonNull FEntity entity) Convenience form taking an entity rather than its id.voidKicks a player from the server with a specified reason.voidupdateInventory(@NonNull UUID uuid) Updates the player's inventory.default voidupdateInventory(@NonNull FEntity entity) Convenience form taking an entity rather than its id.
-
Method Details
-
getEntityId
Gets the entity ID of a player.- Parameters:
uuid- the player UUID- Returns:
- the entity ID
-
getEntityId
Convenience form taking an entity rather than its id.- Parameters:
entity- the entity- Returns:
- the numeric entity id
-
getPlayerByEntityId
Gets the player UUID by entity ID.- Parameters:
entityId- the entity ID- Returns:
- the player UUID, or null if not found
-
getUUID
-
getPlayerClass
@Nullable Class<?> getPlayerClass()Gets the platform player class.- Returns:
- the player class, or null if not available
-
convertToPlatformPlayer
-
convertToPlatformPlayer
-
getName
-
getName
-
getName
-
getPing
-
getWorldName
-
getWorldName
-
getWorldEnvironment
-
getWorldEnvironment
-
getLocale
-
getIp
-
getIp
-
getEntityTranslationKey
-
getTexture
@Nullable net.kyori.adventure.text.object.PlayerHeadObjectContents.ProfileProperty getTexture(@NonNull UUID uuid) Gets the player head texture properties.- Parameters:
uuid- the player UUID- Returns:
- the texture properties, or null if not available
-
getTexture
default @Nullable net.kyori.adventure.text.object.PlayerHeadObjectContents.ProfileProperty getTexture(@NonNull FEntity entity) Convenience form taking an entity rather than its id.- Parameters:
entity- the entity- Returns:
- the skin texture
-
getGamemode
-
getGamemode
-
getPlayerListHeader
Gets the player list header.- Parameters:
fPlayer- the player- Returns:
- the header component
-
getStatistics
Gets player statistics.- Parameters:
uuid- the player UUID- Returns:
- the statistics, or null if not available
-
getStatistics
-
getCoordinates
Gets player coordinates.- Parameters:
uuid- the player UUID- Returns:
- the coordinates, or null if not available
-
getCoordinates
-
distance
-
distance
-
isConsole
Checks if the object represents the console.- Parameters:
platformPlayer- the platform player object- Returns:
- true if console
-
isOperator
Checks if the player is an operator.- Parameters:
uuid- the player UUID- Returns:
- true if operator
-
isOperator
Convenience form taking an entity rather than its id.- Parameters:
entity- the entity- Returns:
- whether the entity is an operator
-
isSneaking
Checks if the player is sneaking.- Parameters:
uuid- the player UUID- Returns:
- true if sneaking
-
isSneaking
Convenience form taking an entity rather than its id.- Parameters:
entity- the entity- Returns:
- whether the entity is sneaking
-
isDead
Checks if the player is dead.- Parameters:
uuid- the player UUID- Returns:
- true if dead
-
isDead
Convenience form taking an entity rather than its id.- Parameters:
entity- the entity- Returns:
- whether the entity is dead
-
hasPlayedBefore
Checks if the player has played before.- Parameters:
uuid- the player UUID- Returns:
- true if has played before
-
hasPlayedBefore
Convenience form taking an entity rather than its id.- Parameters:
entity- the entity- Returns:
- whether the entity has joined before
-
hasPotionEffect
-
hasPotionEffect
-
isOnline
Checks if the player is online.- Parameters:
uuid- the player UUID- Returns:
- true if online
-
isOnline
Convenience form taking an entity rather than its id.- Parameters:
entity- the entity- Returns:
- whether the entity is online
-
updateInventory
Updates the player's inventory.- Parameters:
uuid- the player UUID
-
updateInventory
Convenience form taking an entity rather than its id.- Parameters:
entity- the entity
-
getItem
-
getItem
-
getOnlinePlayers
-
findPlayersWhoCanSee
-
findPlayersWhoCanSee
-
getPassengers
-
getPassengers
-
getPlayedTime
-
kick
Kicks a player from the server with a specified reason.- Parameters:
fPlayer- the player to kickreason- the reason for kicking, displayed to the player
-