Skip to content

Show real decay rate in pearl time remaining - #40

Open
grepsedawk wants to merge 1 commit into
EdenMinecraft:mainfrom
grepsedawk:pearl-timer-wrong
Open

Show real decay rate in pearl time remaining#40
grepsedawk wants to merge 1 commit into
EdenMinecraft:mainfrom
grepsedawk:pearl-timer-wrong

Conversation

@grepsedawk

Copy link
Copy Markdown

What

Prison pearl tooltips lied about how long a pearl would last. The "Time remaining" and "Cost per X" lines were computed from the base decay amount in config, but EssenceGlue speeds decay up by the prisoner's vote streak (1 + streak * 0.5) via a PearlDecayEvent listener. A streaked prisoner's pearl drained much faster than the tag claimed. One freed in about 27 hours while reading "2 day", which matches the reports players kept filing.

Fix

The lore now asks for the effective decay amount through a preview PearlDecayEvent, the same event the real decay loop fires. EssenceGlue (and any other modifier) adjusts that preview just like a real tick, so the displayed rate matches reality. ExilePearl stays unaware of EssenceGlue; the event is the seam.

  • PearlDecayEvent gets a preview flag so side-effecting listeners (logging, metrics) can skip dry runs, while modifiers still adjust the amount.
  • ExilePearlApi.getEffectivePearlDecayAmount(pearl) fires the preview and reads the result back.
  • CoreLoreGenerator uses the effective amount for both the time and cost lines.

Caveat

The streak drifts down as the prisoner stays offline, so the timer is a current estimate, not a fixed countdown. That's the honest best we can show without predicting future logins.

Testing

CoreLoreGeneratorTest passes (9 tests, 0 failures), including a new case asserting a 2x streak multiplier halves the shown time (240 health at 48/day reads 5 days, not 10). Run locally via ./gradlew :plugins:exilepearl-paper:test --tests "com.devotedmc.ExilePearl.core.CoreLoreGeneratorTest".

The pearl tooltip computed "Time remaining" and "Cost per X" from
the base decay amount in config, but EssenceGlue speeds decay up by
the prisoner's vote streak (1 + streak * 0.5) through a
PearlDecayEvent listener. So a streaked prisoner's pearl drained far
faster than the tag claimed. One freed in about 27 hours while
reading "2 day", which is what the bug reports kept describing.

Lore now asks for the effective decay amount via a preview
PearlDecayEvent, the same event the real decay loop fires, so the
displayed rate matches what actually happens. ExilePearl stays
unaware of EssenceGlue; the event is the seam.

The preview flag lets side-effecting listeners (logging, metrics)
skip these dry runs while modifiers still adjust the amount.

The streak drifts down as the prisoner stays offline, so the timer
is a current estimate, not a fixed countdown. That's the honest
best we can show without predicting future logins.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant