Package com.enhancedechest.expiry
Class ExpirySweeper
java.lang.Object
com.enhancedechest.expiry.ExpirySweeper
Periodically scans for expired chests and disposes of them.
Runs on an async repeating timer at the configured check-interval. Each sweep
calls findExpired — a DB-side candidate query (the only way to see offline, non-resident
owners' expired chests) whose hits are loaded into the cache and re-verified against the
authoritative in-memory rows, plus a scan of already-resident owners — and routes each hit through
ChestSpillService:
- a NORMAL chest is removed with its items spilled into a temp chest (
force = false); - a TEMP chest is hard-deleted, its remaining items lost (
force = true).
-
Constructor Summary
ConstructorsConstructorDescriptionExpirySweeper(ChestSpillService spillService, EnderChestStorage storage, Scheduler scheduler, org.slf4j.Logger logger, Telemetry telemetry, long intervalMillis) -
Method Summary
Modifier and TypeMethodDescriptionvoidreschedule(long newIntervalMillis) Re-applies a possibly-changed sweep interval after a/ee reload.voidstart()Starts the repeating async sweep.voidstop()Cancels the repeating sweep.
-
Constructor Details
-
ExpirySweeper
public ExpirySweeper(ChestSpillService spillService, EnderChestStorage storage, Scheduler scheduler, org.slf4j.Logger logger, Telemetry telemetry, long intervalMillis)
-
-
Method Details
-
start
public void start()Starts the repeating async sweep. Safe to call once during plugin enable. -
reschedule
public void reschedule(long newIntervalMillis) Re-applies a possibly-changed sweep interval after a/ee reload.No-op when the interval is unchanged, so repeated reloads neither reset the countdown nor churn timers. When it does change and the sweeper is running, the old timer is cancelled and a fresh one started — there is never more than one live task, so no leak. If the sweeper is not running the value is simply stored for the next
start(). -
stop
public void stop()Cancels the repeating sweep. Safe to call even if never started.
-