跳到主要内容

Numericalstorage Definition

Defines a configurable numerical storage

字段

字段类型默认值描述
prefixString—Prefix used in messages.
artifactRef<PlayerNumericalStorageArtifactEntry>—Artifact storing player data
interestEnabledBooleanfalseEnable interest system based on real time.
interestRateDouble0.0Interest rate in percentage (e.g. 2.0 for 2%).
interestMessageString<green>You received <amount> interest! New balance: <new_balance>Message when interest is applied. Placeholders: <amount> <new_balance> <rate> <prefix>
interestRatesList<InterestRatePermission>emptyList of permission based interest rates. Each entry defines a permission and a specific rate.
InterestRatePermission(2)
字段类型默认值描述
permissionString—Permission node required for this rate.
rateDouble0.0Interest rate in percentage for this permission.
levelsList<BankLevel>emptyConfigured levels. Messages support placeholders: {limit}, {amount}, {new_balance}, {prefix}, {level}
BankLevel(10)
字段类型默认值描述
limitDouble0.0Maximum balance/xp allowed.
depositErrorMessageString—Message when deposit/xp exceeds limit. Placeholders: <limit> <amount> <prefix>
depositMessageString—Message when deposit/xp add succeeds. Placeholders: <limit> <amount> <new_balance> <prefix>
levelUpMessageString—Status message when this level is reached.
interestRateDouble?—Interest rate specific to this level (e.g. 1.5 for 1.5%). If null, the global rate is used.
interestCapDouble0.0Maximum interest gain per cycle (Cron) for this level. Set to 0 for no limit.
criteriaList<LevelCriteria>emptyCriteria required to unlock this level (all must be met).
LevelCriteria(7)
字段类型默认值描述
modeCriteriaModePLACEHOLDERMode of criteria: PLACEHOLDER or FACT可选值:PLACEHOLDERFACT
placeholderString—Placeholder that returns a numeric value (e.g. %player_level%, %vault_eco_balance%). Used when mode is PLACEHOLDER.
factRef<ReadableFactEntry>—Fact entry to read the criteria value from. Used when mode is FACT.
requiredValueDouble0.0Required value to meet the criteria.
comparisonComparisonTypeGREATER_THAN_OR_EQUALSComparison type for the criteria check.可选值:EQUALSNOT_EQUALSGREATER_THANGREATER_THAN_OR_EQUALSLESS_THANLESS_THAN_OR_EQUALS
deductOnMetBooleanfalseIf true and mode is PLACEHOLDER, deduct the required value from the source when criteria is met.
deductCommandString—Command to execute to deduct the required value (e.g. 'eco take {player} {amount}'). Placeholder: {amount}, {player}.
levelUpTriggersList<Ref<TriggerableEntry>>emptyTriggers to execute when this level is reached.
withdrawMessageString—Message when withdraw/remove xp succeeds. Placeholders: <limit> <amount> <new_balance> <prefix>
withdrawErrorMessageString—Message when withdraw/remove xp fails. Placeholders: <limit> <amount> <prefix>
menuNumericalStorageMenuConfig—Menu configuration for this storage.
NumericalStorageMenuConfig(31)
字段类型默认值描述
titleStringStorageTitle of the menu.
rowsInt3Number of rows in the menu.
fillEnabledBooleantrueBackground item to fill empty slots.
fillItemTemplate—Item used to fill empty slots.
ItemTemplate(2)
字段类型默认值描述
itemItem—Item used when rendering the item
loreList<String>emptyLore displayed on the item占位符颜色多行
transactionButtonsList<TransactionButtonConfig>emptyList of transaction buttons (add/remove).
TransactionButtonConfig(7)
字段类型默认值描述
typeTransactionTypeDEPOSITType of transaction: DEPOSIT, WITHDRAW, or TRANSFER.可选值:DEPOSITWITHDRAWTRANSFER
amountTypeAmountTypeFIXEDType of amount: FIXED, PERCENTAGE, CUSTOM, or ALL.可选值:FIXEDPERCENTAGECUSTOMALL
amountDouble0.0Amount for FIXED (value) or PERCENTAGE (0-100). Ignored for CUSTOM and ALL.
templateItemTemplate—Item to display.
slotsList<Int>—Slot in the inventory.
labelString—Optional label override for the button. If empty, the default label from the menu config is used.
transferTargetString—(TRANSFER only) Target definition ID. The balance is transferred from this storage to the target.
optionalButtonsList<OptionalButtonConfig>emptyDisplay-only items drawn at fixed slots (a click does nothing). They replace whatever the layout puts in the same slot.
OptionalButtonConfig(2)
字段类型默认值描述
templateItemTemplate—Item to display.
slotsList<Int>—Inventory slots (0 = top left, 9 per row). Slots outside the menu size are ignored.
customAmountDialogDialogConfig—Configuration for the custom amount dialog.
DialogConfig(7)
字段类型默认值描述
titleStringEnter AmountTitle of the dialog for custom amount input.
inputLabelStringAmountLabel for the input field.
inputPlaceholderString100Placeholder text for the input field.
inputWidthInt200Width of the input field.
maxLengthInt16Maximum length of the input field.
submitButtonStringSubmitText for the submit button.
invalidInputMessageString<red>Invalid amount!</red>Message shown on invalid input.
levelButtonLevelButtonConfig—Configuration for the level up button (only used if levelingMode is MANUAL).
LevelButtonConfig(3)
字段类型默认值描述
availableTemplateItemTemplate—Item to display when level up is available. Placeholders: {cost}, {level}
maxLevelTemplateItemTemplate—Item to display when max level is reached.
slotsList<Int>—Slot in the inventory.
closeButtonCloseButtonConfig—Configuration for the close button.
CloseButtonConfig(2)
字段类型默认值描述
templateItemTemplate—Item to display for the close button.
slotsList<Int>—Slot in the inventory.
depositLabelString<green>DepositLabel for deposit buttons. Placeholders: {amount}, {balance}, {limit}
depositPercentLabelString<green>Deposit %Label for deposit percentage buttons.
depositCustomLabelString<green>Deposit CustomLabel for deposit custom amount buttons.
depositAllLabelString<green>Deposit AllLabel for deposit ALL button.
depositSubmenuLabelString<green>Deposit More...Label for deposit sub-menu opener button.
withdrawLabelString<red>WithdrawLabel for withdraw buttons. Placeholders: {amount}, {balance}, {limit}
withdrawPercentLabelString<red>Withdraw %Label for withdraw percentage buttons.
withdrawCustomLabelString<red>Withdraw CustomLabel for withdraw custom amount buttons.
withdrawAllLabelString<red>Withdraw AllLabel for withdraw ALL button.
withdrawSubmenuLabelString<red>Withdraw More...Label for withdraw sub-menu opener button.
transferLabelString<aqua>TransferLabel for transfer buttons.
transferPercentLabelString<aqua>Transfer %Label for transfer percentage buttons.
transferAllLabelString<aqua>Transfer AllLabel for transfer ALL button.
transferInsufficientMessageString<red>Insufficient balance in source for transfer.Message when transfer source has insufficient balance. Placeholders: <amount>, <balance>, <prefix>
transferCapacityMessageString<red>Target storage has insufficient capacity.Message when transfer target has insufficient capacity. Placeholders: <amount>, <limit>, <prefix>
transferSuccessMessageString<aqua>Transferred <amount>! New source balance: <new_balance>, target: <target_balance>Message when transfer succeeds. Placeholders: <amount>, <new_balance>, <target_balance>, <prefix>
transferTargetNotFoundMessageString<red>Target storage not found.Message when the transfer target is not a known definition. Placeholders: <prefix>
transferTargetUnavailableMessageString<red>Target storage is not available.Message when the transfer target definition has no artifact. Placeholders: <prefix>
maxLevelMessageString<red>Already at max level.Message when already at max level. Placeholders: <prefix>
criteriaNotMetMessageString<red>You don't meet the requirements to level up.Message when criteria not met for upgrade. Placeholders: <prefix>
notEnoughFundsMessageString<red>Not enough funds to upgrade. Cost: <cost>Message when not enough funds to upgrade. Placeholders: <cost>, <prefix>
subMenusMap<String, SubMenuConfig>emptySub-menus that can contain additional buttons (e.g. 'deposit_options' with 25/50/100% buttons). Each sub-menu has a unique ID referenced by SUB_MENU button type param.
SubMenuConfig(8)
字段类型默认值描述
titleStringOptionsTitle of the sub-menu.
rowsInt3Number of rows in the sub-menu.
transactionButtonsList<TransactionButtonConfig>emptyList of transaction buttons in this sub-menu.
optionalButtonsList<OptionalButtonConfig>emptyList of optional buttons in this sub-menu.
backButtonItemTemplate—Configuration for the back/return button.
backButtonSlotsList<Int>—Slots for the back button.
closeButtonCloseButtonConfig—Configuration for the close button in the sub-menu.
fillItemTemplate—Background item to fill empty slots.
interestCronCronExpression—Cron expression for interest application (e.g. '0 0 12 * * *' for daily at 12:00).
transactionTransactionConfig—Transaction configuration for deposits/withdrawals via menu and commands.
TransactionConfig(12)
字段类型默认值描述
transactionModeTransactionModeINTERNALHow the external economy is integrated: INTERNAL (commands + placeholder) or VAULT (direct API).可选值:INTERNALVAULT
amountPlaceholderString—(INTERNAL mode) Placeholder to read the source balance (e.g. %vault_eco_balance%). Ignored in VAULT mode.
addSuccessMessageString<green>Successfully added <amount>! New balance: <new_balance>Message when adding to storage succeeds. Placeholders: <amount>, <new_balance>, <limit>, <prefix>
addErrorMessageString<red>Cannot add <amount>. Would exceed limit of <limit>.Message when adding exceeds limit. Placeholders: <amount>, <balance>, <limit>, <prefix>
removeSuccessMessageString<green>Successfully removed <amount>! New balance: <new_balance>Message when removing from storage succeeds. Placeholders: <amount>, <new_balance>, <limit>, <prefix>
removeErrorMessageString<red>Cannot remove <amount>. Insufficient balance (<balance>).Message when removing exceeds available balance. Placeholders: <amount>, <balance>, <limit>, <prefix>
addCommandString—(INTERNAL mode) Command executed before the persistent DEPOSIT mutation. Placeholders: {amount}, {player}. Ignored in VAULT mode.
removeCommandString—(INTERNAL mode) Command executed before the persistent WITHDRAW mutation. Placeholders: {amount}, {player}. Ignored in VAULT mode.
noFundsMessageString<red>No funds available.Message when no funds available for transaction. Placeholders: <prefix>
invalidAmountMessageString<red>Invalid amount.Message when amount is invalid. Placeholders: <prefix>
vaultInsufficientMessageString<red>Insufficient funds in your economy balance.(VAULT mode) Message when Vault deposit fails (e.g. insufficient economy funds). Placeholders: <amount>, <prefix>
vaultUnavailableMessageString<red>Economy system is not available.(VAULT mode) Message when Vault integration is unavailable. Placeholders: <prefix>
profileModeBooleanfalseWhen enabled, balances are stored per-profile instead of globally: one balance per MMOProfiles profile. Without MMOProfiles, or before a profile is selected, the balance is the player's.
adminMessagesAdminCommandMessages—Replies shown to the sender of the /typewriter ns admin commands (add, remove, level, reset, open).
AdminCommandMessages(8)
字段类型默认值描述
resetMessageString<red><bold>Typewriter »<reset><white> Numerical storage reset for <player>.Reply to /typewriter ns reset. Placeholders: <player>, <storage>, <prefix>占位符颜色
levelSetMessageString<red><bold>Typewriter »<reset><white> Set numerical storage level to <level> for <player>.Reply to /typewriter ns level. Placeholders: <player>, <level>, <storage>, <prefix>占位符颜色
addMessageString<red><bold>Typewriter »<reset><white> Added <amount> to <player>.Reply to /typewriter ns add. Placeholders: <player>, <amount>, <storage>, <prefix>占位符颜色
removeMessageString<red><bold>Typewriter »<reset><white> Removed <amount> from <player>.Reply to /typewriter ns remove. Placeholders: <player>, <amount>, <storage>, <prefix>占位符颜色
noMenuMessageString<red><bold>Typewriter »<reset> <red>No menu entry found for storage '<storage>'. Create a 'numericalstorage_open_menu' entry in a Typewriter page.Reply to /typewriter ns open when no Open Numerical Storage Menu entry is linked to the definition. Placeholders: <storage>, <prefix>占位符颜色
invalidAmountMessageString<red><bold>Typewriter »<reset> <red>Invalid amount '<amount>'. Use a positive number.Reply to /typewriter ns add and remove when the amount is not a positive number. Placeholders: <amount> (the value typed), <player>, <storage>, <prefix>占位符颜色
noArtifactMessageString<red><bold>Typewriter »<reset> <red>Storage '<storage>' has no artifact linked. Link a 'player_numericalstorage_artifact' entry to it.Reply to /typewriter ns add, remove, level and reset when no artifact is linked to the definition. Placeholders: <player>, <storage>, <prefix>占位符颜色
noActiveProfileMessageString<red><bold>Typewriter »<reset> <red><player> has no active profile.Reply to /typewriter ns add, remove, level and reset, and to a menu action, when the definition is in profile mode and the player has no active MMOProfiles profile (profile selection, or a profile still loading). Nothing is written. Placeholders: <player>, <storage>, <prefix>占位符颜色
TypeWriter 通用字段(displayName)
字段类型默认值描述
displayNameString—Display name shown to players.

How to use it​

One definition is one store. Use its entry id in placeholders, in /typewriter ns commands and as transferTarget.

  • Levels. levels is a list: the first line is level 1. limit is the maximum balance of that level. With no levels, the capacity is unlimited. A level can override the interest with interestRate and interestCap (0 means no cap), and runs levelUpTriggers when reached.
  • Upgrading. The upgrade button moves a player to the next level. If the next level has criteria, each one compares a placeholder or a fact (mode) with requiredValue using comparison. With deductOnMet and a deductCommand ({player}, {amount}), the value is taken from a source such as a Vault balance. If the next level has no criteria, the player pays the limit of their current level from the stored balance.
  • Interest. Turn on interestEnabled, set interestRate (percent) and interestCron. The rate is, in order, the first permission of interestRates the player has, then the level interestRate, then the global rate. Interest is calculated when a player joins, for the cycles they missed (at most 100), and never goes above the capacity.
  • Transactions. In VAULT mode, deposits and withdrawals use your Vault economy and ignore amountPlaceholder, addCommand and removeCommand. In INTERNAL mode, amountPlaceholder gives the source balance (for example a %vault_eco_balance% placeholder), addCommand runs from the console to take the money on a deposit, and removeCommand runs to give it back on a withdrawal. Both commands run before the storage is changed and must succeed. They accept {player} and {amount}.
  • Messages. The messages are MiniMessage and accept <amount>, <new_balance>, <balance>, <limit> and <prefix> where the field help lists them.
  • Profile mode. profileMode stores one balance per MMOProfiles profile. MMOProfiles is optional: without it, the balance is the player's (key = their UUID). With MMOProfiles and no active profile (profile selection, after /mmoprofiles quit), the balance shown is 0 and writes are refused with noActiveProfileMessage (in adminMessages). Interest is settled when a profile is selected.
  • Menu. menu holds the title, the number of rows, the transaction buttons and the sub-menus. Where the items sit in the inventory is decided by the layoutPool of the Open Menu action. optionalButtons (in menu and in each sub-menu) are display-only items drawn at their slots; a click on them does nothing. They replace whatever the layout or the other buttons put in the same slot, and slots outside the menu size are ignored.