Fix the dark auction, NPC name colours and shop lore - #884
Merged
Conversation
SkyBlockService.init parks forever on a CountDownLatch once the service is registered, so every statement after it in main is dead code. The dark auction service started its scheduler after that call, which meant the executor thread pool was never created and the first calendar trigger died with a NullPointerException inside startNewAuction, leaving Sirius latched in the hubs with no phase ever advancing. Every other service in the repository already does its setup before init, which also closes the window where a Redis message can arrive between the listeners starting and the setup finishing.
startNewAuction published the auction as the current one and broadcast AUCTION_START before it scheduled anything, so a failure part way through left a half started auction latched forever. Every later trigger was then rejected with "Auction already active" and only a service restart could clear it. The remaining work now runs inside a try block that clears the current auction and broadcasts AUCTION_END on failure, so the hubs tear their queue down and the next trigger is free to start a fresh auction.
checkForEvents asked the calendar which events are currently running and fired their action every time, and it runs every ten ticks for the whole duration of the event. The dark auction event lasts five minutes, so each server sent around six hundred trigger requests per occurrence and the service logged "Auction already active, ignoring trigger" for all but the first. Actions now fire when an event becomes current and are suppressed until it stops being current, which leaves the calendar timing untouched.
Chat names default to null and almost no NPC overrides them, so nearly every NPC fell back to a bare literal of its class derived name and rendered white next to a yellow prefix and a yellow nameplate. The fallback is now yellow, which leaves the NPCs that declare their own chat name colour untouched.
Shop views rebuilt the lore of the item they display by serialising each existing line with the plain text serialiser and wrapping the result in a literal. That was harmless while lore lines were plain components carrying section codes inside their content, because the codes survived the round trip, but the text system migration turned lore into properly styled components, so the round trip now throws away every colour and decoration and the whole tooltip renders unstyled. Text gains a factory that wraps an existing component, and the shop views use it along with the existing component lore helper so the item keeps its own styling while the shop still appends its cost, stock and click lines. The sold item name in the sell message and the base name in the trading options view are carried across the same way.
…ck calendar CalendarEvent recomputed two tick constants by hand and both disagreed with SkyBlockCalendar. THREE_DAYS multiplied out to 86400 ticks while a SkyBlock day is 24000, so the Dark Auction recurred every 3.6 days and slid off midnight onto five different times of day, and YEAR multiplied out to 10713600 against a real year of 8928000, so the last twenty generated times sat past the end of the year and could never match the wrapped calendar time even though the countdown helpers still offered them as upcoming occurrences. Both now come from SkyBlockCalendar, as does MONTH, which happened to hold the right number but was still a bare literal. The auction now fires every three SkyBlock days at midnight and the year divides into exactly 124 occurrences, so the last one of a year is three days before the first of the next instead of leaving a ragged gap. The retry deadline also repeated the five minute duration as a second literal, so a change to one would have silently left the other behind; both now read the same constant.
ELECTION_OPEN and ELECTION_CLOSE were declared with a zero duration, and getCurrentEvents only counts an event as running while the time since its start is strictly less than that duration, so neither one was ever current. Nothing ever called ElectionManager.onElectionStart or onElectionEnd and the two events never appeared in the calendar's list of running events either. Both now last five minutes, matching how the Dark Auction is declared. That is far longer than the ten tick gap between calendar checks, so the occurrence cannot be stepped over, and since firing is edge triggered the action still runs exactly once per year: the booth opens on Late Summer 1st and the election closes on Late Autumn 1st, both at midnight.
Building a GUI item out of another item's name or lore meant pulling the raw components off the stack, and the only lossless way to carry them across was a bare Text.component mapping over a list the caller had fetched itself. ItemStacks already takes Text for both, so it now hands it back as well: loreText returns a fresh mutable list of Text that a caller keeps appending to, and nameText returns the custom name with an optional fallback for stacks that carry none. Both wrap the component as it stands, so colours, hover text and click actions survive, and a call site can go straight from a stack to a rebuilt GUI item without naming a component at all. SkyBlockItem gains the matching getDisplayNameText next to the existing getLoreText, with and without a player, and both lore accessors now delegate to the new ones instead of doing a second hand rolled conversion. The shop views move onto the accessors, which leaves loreComponents without a caller, so the one method on ItemStacks that took raw components is gone.
These GUIs rebuilt the name or lore of the item they were displaying by running each component through the plain text serialiser and wrapping the result in a literal. That was harmless while lore lines carried their section codes inside their own content, but the text system migration turned them into properly styled components, so the round trip now throws away every colour and decoration: pet tooltips, the auction browser, the bid and manage lists, the create screen's item preview and confirmation lines and the backpack window title all rendered flat white. Every one of them now reads the name and lore through the Text accessors instead. The auction lore handler picks up the same treatment, since it was carrying the item's own lore around as raw components purely to hand each line straight back to a section, which the section can take as Text directly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.