MC/DuneMenus/docs/BACKEND.md

2 KiB

Backend contract (for the coder)

The GUI is design only. Everything it needs from the game lives in Backend.java; wire JarvisBackend.java by overriding methods one at a time. Un-overridden methods make the menu say "not connected yet". The development plugin loads the J.A.R.V.I.S. adapter.

Rules: money is minor units (1.00 DM = 100). Futures may complete on any thread. There are no confirm screens, so every mutating call must be safe against a double click (idempotent). Return Result.no("reason") for refusals; the text is shown to the player as is.

ATM (one GUI, three tabs)

  • Deposit cash: atmCreateRia(player, amountMinor) takes the cash (bills and coins amounts are chosen in the GUI, denominations in config.yml atm.bills / atm.coins), creates a NEW RIA ID worth that amount, returns Issued(ok, message, riaId).
  • Redeem: atmLookup(player, riaId) returns Voucher(riaId, amountMinor, fromName) or null if unknown/used. atmRedeem(player, riaId, toBank) pays out as cash (toBank=false) or credits the player's bank account (toBank=true). Must mark the ID used atomically.
  • Withdraw cash: bankWithdraw(player, amountMinor) debits the bank account and gives cash. The RIA ID is typed by the player in chat (next chat line is captured, "cancel" aborts) so it works on Java and Bedrock.

Bank (Rihla Money Transfer)

bankAccount, bankTransfers, bankSend(player, toUuid, amountMinor) (creates a pending transfer, reserves amount + tax), bankCancel(player, id) (releases the reservation), bankCollect(player, id) (-1 = all). Tax: 1% of the amount up to and including 3,000 DM, 5% above, rounded up to the cent; the recipient receives the full amount. Rihla.tax() / Rihla.total() implement this for the previews; the backend stays the source of truth.

Everything else

See the javadoc in Backend.java: balance, worlds/book (travel), listings/buy/sell/withdraw/collectPurchases (exchange), org/members/orgAction (clan, company), missions, spice, war, decisions, houses, refit.