Class ServerFileBrowser

java.lang.Object
com.hypixel.hytale.server.core.ui.browser.ServerFileBrowser

public class ServerFileBrowser extends Object
Reusable server-side file browser component.

Encapsulates common file browsing logic including: - Directory navigation - Root selector management - Fuzzy search - File filtering by extension

Designed to be composed into pages, not extended.

  • Constructor Details

    • ServerFileBrowser

      public ServerFileBrowser(@Nonnull FileBrowserConfig config)
    • ServerFileBrowser

      public ServerFileBrowser(@Nonnull FileBrowserConfig config, @Nullable Path initialRoot, @Nullable Path initialDir)
  • Method Details

    • buildRootSelector

      public void buildRootSelector(@Nonnull UICommandBuilder commandBuilder, @Nonnull UIEventBuilder eventBuilder)
      Builds the root selector dropdown UI. Only adds UI elements if root selector is enabled in config.
    • buildSearchInput

      public void buildSearchInput(@Nonnull UICommandBuilder commandBuilder, @Nonnull UIEventBuilder eventBuilder)
      Builds the search input UI. Only adds UI elements if search is enabled in config.
    • buildCurrentPath

      public void buildCurrentPath(@Nonnull UICommandBuilder commandBuilder)
      Builds the current path display.
    • getFileEntries

      @Nonnull public List<FileListProvider.FileEntry> getFileEntries()
    • buildFileList

      public void buildFileList(@Nonnull UICommandBuilder commandBuilder, @Nonnull UIEventBuilder eventBuilder)
      Builds the file list UI based on current state.
    • buildUI

      public void buildUI(@Nonnull UICommandBuilder commandBuilder, @Nonnull UIEventBuilder eventBuilder)
      Builds the complete browser UI (root selector, search, path, file list).
    • handleEvent

      public boolean handleEvent(@Nonnull FileBrowserEventData data)
      Handles a browser event.
      Returns:
      true if the event was handled, false if it should be passed to the page
    • resolveAssetPackPath

      @Nullable public Path resolveAssetPackPath(@Nonnull String virtualPath)
      Resolves a virtual asset pack path to an actual filesystem path. Virtual paths are in format: "PackDisplayName/subdir/file.ext"
      Returns:
      The resolved filesystem path, or null if invalid
    • getAssetPackCurrentPath

      @Nonnull public String getAssetPackCurrentPath()
      Gets the current virtual path in asset pack mode.
      Returns:
      The virtual path string (e.g., "Assets/subfolder")
    • getRoot

      @Nonnull public Path getRoot()
    • setRoot

      public void setRoot(@Nonnull Path root)
    • getCurrentDir

      @Nonnull public Path getCurrentDir()
    • setCurrentDir

      public void setCurrentDir(@Nonnull Path currentDir)
    • getSearchQuery

      @Nonnull public String getSearchQuery()
    • setSearchQuery

      public void setSearchQuery(@Nonnull String searchQuery)
    • getSelectedItems

      @Nonnull public Set<String> getSelectedItems()
    • addSelection

      public void addSelection(@Nonnull String item)
    • clearSelection

      public void clearSelection()
    • getConfig

      @Nonnull public FileBrowserConfig getConfig()