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
  • Method Details

    • getEntityId

      int getEntityId(@NonNull UUID uuid)
      Gets the entity ID of a player.
      Parameters:
      uuid - the player UUID
      Returns:
      the entity ID
    • getEntityId

      default int getEntityId(@NonNull FEntity entity)
      Convenience form taking an entity rather than its id.
      Parameters:
      entity - the entity
      Returns:
      the numeric entity id
    • getPlayerByEntityId

      @Nullable UUID getPlayerByEntityId(int entityId)
      Gets the player UUID by entity ID.
      Parameters:
      entityId - the entity ID
      Returns:
      the player UUID, or null if not found
    • getUUID

      @Nullable UUID getUUID(@NonNull Object platformPlayer)
      Gets the UUID from a platform player object.
      Parameters:
      platformPlayer - the platform player object
      Returns:
      the player UUID, or null if conversion fails
    • getPlayerClass

      @Nullable Class<?> getPlayerClass()
      Gets the platform player class.
      Returns:
      the player class, or null if not available
    • convertToPlatformPlayer

      @Nullable Object convertToPlatformPlayer(@NonNull UUID uuid)
      Converts a UUID to a platform player object.
      Parameters:
      uuid - the player UUID
      Returns:
      the platform player object, or null if not found
    • convertToPlatformPlayer

      default @Nullable Object convertToPlatformPlayer(@NonNull FEntity entity)
    • getName

      @NonNull String getName(@NonNull UUID uuid)
      Gets the player name by UUID.
      Parameters:
      uuid - the player UUID
      Returns:
      the player name
    • getName

      default @NonNull String getName(@NonNull FEntity entity)
    • getName

      @NonNull String getName(@NonNull Object platformPlayer)
      Gets the player name from a platform player object.
      Parameters:
      platformPlayer - the platform player object
      Returns:
      the player name
    • getPing

      int getPing(FPlayer fPlayer)
    • getWorldName

      @NonNull String getWorldName(@NonNull UUID uuid)
      Gets the world name where the player is located.
      Parameters:
      uuid - the player UUID
      Returns:
      the world name
    • getWorldName

      default @NonNull String getWorldName(@NonNull FEntity entity)
    • getWorldEnvironment

      @NonNull String getWorldEnvironment(@NonNull UUID uuid)
      Gets the world environment where the player is located.
      Parameters:
      uuid - the player UUID
      Returns:
      the world environment
    • getWorldEnvironment

      default @NonNull String getWorldEnvironment(@NonNull FEntity entity)
    • getLocale

      @NonNull String getLocale(@NonNull UUID uuid)
    • getIp

      @Nullable String getIp(@NonNull UUID uuid)
      Gets the player IP address.
      Parameters:
      uuid - the player UUID
      Returns:
      the IP address, or null if not available
    • getIp

      default @Nullable String getIp(@NonNull FEntity entity)
    • getEntityTranslationKey

      @NonNull String getEntityTranslationKey(@Nullable Object platformPlayer)
      Gets the entity translation key for a player.
      Parameters:
      platformPlayer - the platform player object
      Returns:
      the translation key
    • 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

      @NonNull String getGamemode(@NonNull UUID uuid)
      Gets the player game mode.
      Parameters:
      uuid - the player UUID
      Returns:
      the game mode
    • getGamemode

      default @NonNull String getGamemode(@NonNull FEntity entity)
    • getPlayerListHeader

      @NonNull net.kyori.adventure.text.Component getPlayerListHeader(@NonNull FPlayer fPlayer)
      Gets the player list header.
      Parameters:
      fPlayer - the player
      Returns:
      the header component
    • getPlayerListFooter

      @NonNull net.kyori.adventure.text.Component getPlayerListFooter(@NonNull FPlayer fPlayer)
      Gets the player list footer.
      Parameters:
      fPlayer - the player
      Returns:
      the footer component
    • getStatistics

      @Nullable PlatformPlayerAdapter.Statistics getStatistics(@NonNull UUID uuid)
      Gets player statistics.
      Parameters:
      uuid - the player UUID
      Returns:
      the statistics, or null if not available
    • getStatistics

      default @Nullable PlatformPlayerAdapter.Statistics getStatistics(@NonNull FEntity entity)
    • getCoordinates

      @Nullable PlatformPlayerAdapter.Coordinates getCoordinates(@NonNull UUID uuid)
      Gets player coordinates.
      Parameters:
      uuid - the player UUID
      Returns:
      the coordinates, or null if not available
    • getCoordinates

      default @Nullable PlatformPlayerAdapter.Coordinates getCoordinates(@NonNull FEntity entity)
    • distance

      double distance(@NonNull UUID first, @NonNull UUID second)
      Calculates distance between two players.
      Parameters:
      first - the first player UUID
      second - the second player UUID
      Returns:
      the distance
    • distance

      default double distance(@NonNull FEntity first, @NonNull FEntity second)
      Convenience form taking entities rather than their ids.
      Parameters:
      first - the first entity
      second - the second entity
      Returns:
      the distance between them
    • isConsole

      boolean isConsole(@NonNull Object platformPlayer)
      Checks if the object represents the console.
      Parameters:
      platformPlayer - the platform player object
      Returns:
      true if console
    • isOperator

      boolean isOperator(@NonNull UUID uuid)
      Checks if the player is an operator.
      Parameters:
      uuid - the player UUID
      Returns:
      true if operator
    • isOperator

      default boolean isOperator(@NonNull FEntity entity)
      Convenience form taking an entity rather than its id.
      Parameters:
      entity - the entity
      Returns:
      whether the entity is an operator
    • isSneaking

      boolean isSneaking(@NonNull UUID uuid)
      Checks if the player is sneaking.
      Parameters:
      uuid - the player UUID
      Returns:
      true if sneaking
    • isSneaking

      default boolean isSneaking(@NonNull FEntity entity)
      Convenience form taking an entity rather than its id.
      Parameters:
      entity - the entity
      Returns:
      whether the entity is sneaking
    • isDead

      boolean isDead(@NonNull UUID uuid)
      Checks if the player is dead.
      Parameters:
      uuid - the player UUID
      Returns:
      true if dead
    • isDead

      default boolean isDead(@NonNull FEntity entity)
      Convenience form taking an entity rather than its id.
      Parameters:
      entity - the entity
      Returns:
      whether the entity is dead
    • hasPlayedBefore

      boolean hasPlayedBefore(@NonNull UUID uuid)
      Checks if the player has played before.
      Parameters:
      uuid - the player UUID
      Returns:
      true if has played before
    • hasPlayedBefore

      default boolean hasPlayedBefore(@NonNull FEntity entity)
      Convenience form taking an entity rather than its id.
      Parameters:
      entity - the entity
      Returns:
      whether the entity has joined before
    • hasPotionEffect

      boolean hasPotionEffect(@NonNull UUID uuid, @NonNull String potionType)
      Checks if the player has a potion effect.
      Parameters:
      uuid - the player UUID
      potionType - the potion type
      Returns:
      true if has the potion effect
    • hasPotionEffect

      default boolean hasPotionEffect(@NonNull FEntity entity, @NonNull String potionType)
      Convenience form taking an entity rather than its id.
      Parameters:
      entity - the entity
      potionType - the potion type
      Returns:
      true if the effect is active
    • isOnline

      boolean isOnline(@NonNull UUID uuid)
      Checks if the player is online.
      Parameters:
      uuid - the player UUID
      Returns:
      true if online
    • isOnline

      default boolean isOnline(@NonNull FEntity entity)
      Convenience form taking an entity rather than its id.
      Parameters:
      entity - the entity
      Returns:
      whether the entity is online
    • updateInventory

      void updateInventory(@NonNull UUID uuid)
      Updates the player's inventory.
      Parameters:
      uuid - the player UUID
    • updateInventory

      default void updateInventory(@NonNull FEntity entity)
      Convenience form taking an entity rather than its id.
      Parameters:
      entity - the entity
    • getItem

      @Nullable Object getItem(@NonNull UUID uuid)
      Gets the item in the player's hand.
      Parameters:
      uuid - the player UUID
      Returns:
      the item, or null if empty
    • getItem

      default @Nullable Object getItem(@NonNull FEntity entity)
    • getOnlinePlayers

      @NonNull List<UUID> getOnlinePlayers()
      Gets all online player UUIDs.
      Returns:
      list of online player UUIDs
    • findPlayersWhoCanSee

      @NonNull Set<UUID> findPlayersWhoCanSee(UUID uuid, double x, double y, double z)
      Finds players who can see a location.
      Parameters:
      uuid - the source player UUID
      x - the X coordinate
      y - the Y coordinate
      z - the Z coordinate
      Returns:
      set of player UUIDs who can see the location
    • findPlayersWhoCanSee

      default @NonNull Set<UUID> findPlayersWhoCanSee(@NonNull FEntity entity, double x, double y, double z)
    • getPassengers

      @NonNull List<Integer> getPassengers(UUID uuid)
      Gets passengers of a player's vehicle.
      Parameters:
      uuid - the player UUID
      Returns:
      list of passenger entity IDs
    • getPassengers

      default @NonNull List<Integer> getPassengers(@NonNull FEntity entity)
    • getPlayedTime

      @Nullable PlayTime getPlayedTime(FPlayer fPlayer)
      Gets the total played time for a player.
      Parameters:
      fPlayer - the player to get play time for
      Returns:
      play time, or null if not available
    • kick

      void kick(FPlayer fPlayer, net.kyori.adventure.text.Component reason)
      Kicks a player from the server with a specified reason.
      Parameters:
      fPlayer - the player to kick
      reason - the reason for kicking, displayed to the player