Interface PlatformServerAdapter


public interface PlatformServerAdapter
Platform adapter for server-related operations in FlectonePulse. Abstracts platform-specific server APIs for cross-platform compatibility.
Since:
0.8.1
  • Method Details

    • dispatchCommand

      void dispatchCommand(@NonNull String command)
      Dispatches a command to the server console.
      Parameters:
      command - the command string to execute
    • getTPS

      @NonNull String getTPS(FEntity entity)
      Gets the current server TPS (ticks per second) for a specific entity.
      Parameters:
      entity - the entity for which to retrieve TPS information
      Returns:
      formatted TPS string or empty string if unavailable
    • getMaxPlayers

      int getMaxPlayers()
      Gets the maximum player count for the server.
      Returns:
      maximum allowed players
    • getOnlinePlayerCount

      int getOnlinePlayerCount()
      Gets the current online player count.
      Returns:
      number of online players
    • getPlatformPlayerCount

      int getPlatformPlayerCount()
      Gets the platform-specific online player count.
      Returns:
      number of online players
    • generateEntityId

      int generateEntityId()
      Generates a new entity ID.
      Returns:
      entity ID
    • getServerCore

      @NonNull String getServerCore()
      Returns the name of the server core.
      Returns:
      a string representing the name of the server core
    • getServerUUID

      @NonNull String getServerUUID()
      Returns server UUID.
      Returns:
      a string representing server UUID
    • getServerVersionName

      String getServerVersionName()
      Returns server version.
      Returns:
      a string representing server version
    • getPlatformType

      @NonNull PlatformType getPlatformType()
      Gets the platform type.
      Returns:
      the platform type
    • getMOTD

      @NonNull Object getMOTD()
      Gets the server MOTD.
      Returns:
      MOTD as JsonElement
    • getIcon

      @Nullable String getIcon()
      Gets the server icon.
      Returns:
      the server icon as a string, or null if unavailable
    • getWhitelistFile

      @NonNull File getWhitelistFile()
      Gets the server's whitelist file.
      Returns:
      the whitelist File object, never null
    • hasProject

      boolean hasProject(@NonNull String projectName)
      Checks if a project/resource is available on the server.
      Parameters:
      projectName - name of the project/resource to check
      Returns:
      true if the project is available, false otherwise
    • isOnlineMode

      boolean isOnlineMode()
      Checks if the server is currently in online mode.
      Returns:
      true if the server is in online mode, false otherwise
    • isOnlyPlayerOnline

      boolean isOnlyPlayerOnline(UUID uuid)
      Checks if the server has only the specified player online or no players at all.
      Parameters:
      uuid - the UUID of the player to check for exclusive presence
      Returns:
      true if only the specified player is online or if no players are online, false if multiple other players are present
    • isPrimaryThread

      boolean isPrimaryThread()
      Checks if the current thread is the primary server thread.
      Returns:
      true if on primary thread
    • getItemName

      @NonNull String getItemName(@NonNull Object item)
      Gets the Minecraft name of an item.
      Parameters:
      item - the platform-specific item object
      Returns:
      localized item name or empty string if invalid
    • getResource

      default @Nullable InputStream getResource(@NonNull String path)
      Gets an input stream for the specified resource path.
      Parameters:
      path - resource path (classpath relative)
      Returns:
      InputStream or null if not found
    • saveResource

      default void saveResource(@NonNull Path projectPath, @NonNull String path) throws IOException
      Saves a resource to the plugin data folder.
      Parameters:
      path - the resource path
      Throws:
      IOException
    • translateItemName

      @NonNull net.kyori.adventure.text.Component translateItemName(@NonNull Object item, @NonNull UUID messageUUID, boolean translatable)
      Translates an item name with optional localization.
      Parameters:
      item - the platform-specific item object
      messageUUID - the message UUID for caching
      translatable - whether the name should be translated
      Returns:
      translated item name component
    • buildItemStack

      @NonNull Object buildItemStack(@NonNull FPlayer fPlayer, @NonNull String material, @NonNull String title, @NonNull String lore)
      Builds an item stack with lore.
      Parameters:
      fPlayer - the player receiving the item
      material - the item material
      title - the item title
      lore - the item lore
      Returns:
      the built item stack
    • buildItemStack

      @NonNull Object buildItemStack(@NonNull FPlayer fPlayer, @NonNull String material, @NonNull String title, @NonNull String[] lore)
      Builds an item stack with lore.
      Parameters:
      fPlayer - the player receiving the item
      material - the item material
      title - the item title
      lore - the item lore lines
      Returns:
      the built item stack