Package com.enhancedechest.service
Class LogViewer
java.lang.Object
com.enhancedechest.service.LogViewer
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 Summary
ConstructorsConstructorDescriptionLogViewer(ChestLogStore store, ContainerCodec codec, DbExecutor db, Scheduler scheduler, LanguageManager lang, org.slf4j.Logger logger, Telemetry telemetry) -
Method Summary
Modifier and TypeMethodDescriptionvoidopenLog(org.bukkit.entity.Player admin, UUID owner, String ownerName, int page, @Nullable String query) Opens (or re-opens) the log viewer forownertoadmin.voidopenSearchDialog(org.bukkit.entity.Player admin, UUID owner, String ownerName, @Nullable String currentQuery) Opens the search dialog: a text input for an item plus Search and Back buttons.voidopenSnapshot(org.bukkit.entity.Player admin, UUID owner, String ownerName, LogEntry entry, int page, @Nullable String query) Opens a read-only-safe sandbox showing exactly what the chest held whenentrywas closed.
-
Constructor Details
-
LogViewer
public LogViewer(ChestLogStore store, ContainerCodec codec, DbExecutor db, Scheduler scheduler, LanguageManager lang, org.slf4j.Logger logger, Telemetry telemetry)
-
-
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 forownertoadmin.queryfilters to visits whose change list mentions that item (null = the full log). Clampspageinto 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 inChestDialogs) 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 whenentrywas closed. The inventory usesLogSnapshotHolder, so it never funnels through the session manager and is discarded on close — the real chest is never affected.pageandqueryare remembered so closing the preview returns to the same (possibly filtered) log page.
-