Loans (/loan and /vault loan)
Allows players to borrow money from the server and repay it in installments. Installment collection runs automatically via the scheduler; continued default marks the loan as DEFAULTED and applies penalty effects.
Commands
/loan(alias/prestamo) — Opens the loans GUI menu (LoanMenuService)/vault loan— Equivalent access from the main command/vault cancel— Cancels an in-progress chat flow
vault.loan (default true). Global config loans.enabled: false disables the entire module without needing permissions.
loans.yml / config.yml Configuration
loans.installment_minimum_tiers (map list) and loans.minimum_installment_by_amount (nested section). minimumInstallmentFor() evaluates all sources and picks the maximum.
Creation Wizard (Chat Flow)
LoanService.openRequestFlow() starts a chat conversation with ConversationState states (LoanService.java:786–796):
- Total mode — A single future payment (1 installment). Player only enters the delay in hours.
- Installments by count mode — Specifies how many installments; installment = amount / N.
- Installments by $ mode — Specifies amount per installment; N = ceil(amount / installment).
interval_hours ≤ 0 or first_delay_hours ≤ 0, the config default value is used.
Automatic Charge Scheduler
Everycharge_check_seconds a runTaskTimerAsynchronously scans active loans and synchronizes back to the main thread to load balances (LoanService.java:305–371):
- If
nextChargeAtMs ≤ nowattempts to chargeinstallmentAmount(or whatever remains) - If balance exists: charges →
installmentsLeft--→ advancesnextChargeAtMs += intervalMs - If NO balance:
missedPayments++ - When
max_missed_paymentsis reached:status = DEFAULTED
Statuses and Transaction Types
LoanStatus: ACTIVE → PAID or DEFAULTED
When paying manually (
/vault loan → Pay) the player can enter the amount or all / todo to settle the full debt.
DEFAULTED Effects
Ifdefaulted_effects.enabled: true and the loan is in DEFAULTED status, effects are RE-applied to the online player every refresh_seconds. Legacy name mapping:
Config effect levels are 1-based; internally 1 is subtracted to convert to Bukkit’s 0-based
amplifier.