Integrate API events, add market hours scheduling, and unify trading events#132
Merged
Integrate API events, add market hours scheduling, and unify trading events#132
Conversation
…Event Co-authored-by: MaksyKun <77341370+MaksyKun@users.noreply.github.com>
Co-authored-by: MaksyKun <77341370+MaksyKun@users.noreply.github.com>
Co-authored-by: MaksyKun <77341370+MaksyKun@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Integrate existing events from api/events into code
Integrate API events and unify trading events with TransactionType enum
Nov 17, 2025
Contributor
|
Co-authored-by: MaksyKun <77341370+MaksyKun@users.noreply.github.com>
Contributor
Author
... Implemented all requested changes in commit 9f5c90b: 1. Market Hours Configuration market:
hours:
enabled: true
open-at: "06:00:00"
close-at: "22:00:00"
timezone: "UTC" # Supports IANA timezone IDs2. MarketScheduler Service
3. InstrumentPriceUpdateEvent Integration
4. Import Style Fixed
All events now properly integrated with clean import statements. |
Copilot
AI
changed the title
Integrate API events and unify trading events with TransactionType enum
Integrate API events, add market hours scheduling, and unify trading events
Nov 17, 2025
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.
API events existed but were never fired. Trading had separate
InstrumentBuyEventandShareBuyEvent/ShareSellEventcausing fragmentation.Changes
Event Architecture
TransactionTypeenum - Distinguishes INSTRUMENT, SHARE, CRYPTO transactionsShareBuyEvent/ShareSellEventnow handle all asset types viaTransactionTypeInstrumentBuyEvent- Deprecated in favor of unified approachgetHandlerList()- All 14 events now properly implement Bukkit static method requirementService Integration
Integrated events across 7+ services with proper timing:
Cancellable (pre-action):
TradingService- ShareBuyEvent, ShareSellEvent before wallet/holdings modificationWatchlistService- Add/remove before database writeCompanyService- Create before cost charge, IPO before market enableCryptoService- Create before balance checksNon-cancellable (post-action):
WalletService- Balance change after modification (with reason enum)InvitationService- Employee join after database insertCompanyService- Employee leave after removal (with wasKicked flag)StockMarketService- Price updates fire InstrumentPriceUpdateEventMarketScheduler- Market open/close events with schedulingMarket Hours System
New
MarketSchedulerservice manages trading hours:Configuration in
market.yml:market.hours.enabled- Enable/disable market hours restrictionmarket.hours.open-at- Market opening time (HH:mm:ss format, default: "06:00:00")market.hours.close-at- Market closing time (HH:mm:ss format, default: "22:00:00")market.hours.timezone- Timezone for market hours (default: "UTC", supports IANA timezone IDs)Features:
MarketOpenEventwhen market opens (with broadcast)MarketCloseEventwhen market closes (with broadcast)MarketClosed,MarketOpens,MarketClosesInstrumentPriceUpdateEvent Integration
StockMarketService.updateAllStockPrices()Code Quality Improvements
API Changes
Before:
After:
Legacy constructors maintained for backward compatibility but marked
@Deprecated.All Events Now Integrated
Remaining event:
CircuitBreakerTriggeredEvent- Circuit breaker exists but not actively triggeredBreaking Changes
InstrumentBuyEventremoved - useShareBuyEvent(player, TransactionType.INSTRUMENT, ...)Fixes API-Event integration #131
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.