From 3b85d5fa34f85563e134ce964d55bb6a7e196d21 Mon Sep 17 00:00:00 2001 From: simoleo89 Date: Sat, 6 Jun 2026 02:11:26 +0200 Subject: [PATCH] feat(furnidata): expose source kind, maxBytes, reindexFromSource on the provider --- .../items/FurnitureTextProvider.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/FurnitureTextProvider.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/FurnitureTextProvider.java index 9f4fccbd..89297399 100644 --- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/FurnitureTextProvider.java +++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/FurnitureTextProvider.java @@ -64,6 +64,31 @@ public class FurnitureTextProvider { return this.source; } + /** Returns {@code true} when the resolved source is a directory (split-tier layout). */ + public boolean isSourceDirectory() { + return this.source != null && Files.isDirectory(this.source); + } + + /** Returns the byte cap used when reading furnidata files. */ + public long getMaxBytes() { + return DEFAULT_MAX_BYTES; + } + + /** + * Re-reads the furnidata from the current source and reindexes atomically. + * Returns the delta list (new/changed entries) from {@link #reindex(List)}. + * Never throws — returns an empty list when the source is unavailable. + */ + public java.util.List reindexFromSource() { + try { + if (this.source == null) return java.util.List.of(); + return reindex(new FurnidataReader(this.source, DEFAULT_MAX_BYTES).read()); + } catch (Exception e) { + LOGGER.warn("FurnitureTextProvider.reindexFromSource failed", e); + return java.util.List.of(); + } + } + private static Path resolveSource() { String override = Emulator.getConfig().getValue("items.furnidata.path", ""); if (!override.isEmpty()) {