Class LogViewer

java.lang.Object
com.enhancedechest.service.LogViewer

public final class LogViewer extends Object
Opens the /ee log viewer, its item-search dialog, and its snapshot previews. Shared by the command (initial open) and the menu listener (paging, search, pane clicks), so every path uses the same async → build → open flow.

All database work — counting rows, reading a page (optionally filtered by a searched item), and decoding a snapshot blob — runs on the shared DB executor (decode is safe off the tick thread: the stored bytes are immutable and the decoded stacks are handed to the entity thread through the future's happens-before edge). Only the cheap inventory build and openInventory touch the entity thread.

The search dialog is the one place outside gui.dialog.ChestDialogs that touches the Paper Dialog API — kept here so the whole log feature stays in one place; it is a single small form.

  • Constructor Details

  • Method Details

    • openLog

      public void openLog(org.bukkit.entity.Player admin, UUID owner, String ownerName, int page, @Nullable @Nullable String query)
      Opens (or re-opens) the log viewer for owner to admin. query filters to visits whose change list mentions that item (null = the full log). Clamps page into range; only an unfiltered, genuinely empty log reports "nothing logged" instead of opening a menu — an empty search still opens so the admin can clear it or search again.
    • openSearchDialog

      public void openSearchDialog(org.bukkit.entity.Player admin, UUID owner, String ownerName, @Nullable @Nullable String currentQuery)
      Opens the search dialog: a text input for an item plus Search and Back buttons. Search re-opens the log filtered to that item; Back re-opens it with whatever filter was already active. Built here (not in ChestDialogs) to keep the log feature self-contained.
    • openSnapshot

      public void openSnapshot(org.bukkit.entity.Player admin, UUID owner, String ownerName, LogEntry entry, int page, @Nullable @Nullable String query)
      Opens a read-only-safe sandbox showing exactly what the chest held when entry was closed. The inventory uses LogSnapshotHolder, so it never funnels through the session manager and is discarded on close — the real chest is never affected. page and query are remembered so closing the preview returns to the same (possibly filtered) log page.