MinionCore logoMinionCore

Fuel and upgrades

The keys in fuel.yml and upgrades.yml, the three currency types, and how costs that mix currencies are paid and refunded.

fuel.yml sets the fuel items that keep minions working. upgrades.yml sets two things: the currencies every price in the plugin is paid with, and the upgrade items players apply to minions. Players see these as items and prices, and you control all of it from these two files.

For how players use fuel and upgrades in game, see Fuel and Levels and upgrades.

fuel.yml

Each entry under fuel is one fuel. The key, such as basic, is the fuel id used in commands like /minion fuel <player> basic. The plugin ships basic (100 actions), advanced (500) and ultimate (2000), and a coal entry (10 actions) that ships switched off as an example of a fuel made from plain items.

fuel:
  basic:
    enabled: true
    actions: 100
    types: all
    any-matching-item: false
    item:
      material: COAL
      name: "<green>Basic Fuel"
      lore:
        - "<gray>Gives <green>100 <gray>actions."
      custom-model-data: 0
      itemsadder: ""
      mythicmobs: ""
    commands: []
KeyDefaultWhat it does
enabledtruefalse switches the fuel off. It is not loaded, so its items stop counting and /minion fuel no longer knows it
actionsnoneHow many actions one item gives. Must be above 0, or the entry is skipped with a warning
typesallall, or a list of type ids that may use this fuel. Other types refuse it
any-matching-itemfalsefalse counts only the fuel item MinionCore makes, which carries a hidden tag. true counts every item that matches item as well, such as plain coal, an ItemsAdder item or a MythicMobs item
itemsee aboveThe fuel item. Accepts every item key. %actions% in the name or lore shows the actions value
commands[]Console commands run each time this fuel is added

With any-matching-item: true, item is also what an item has to match: a saved-item exactly, else the mythicmobs id, else the itemsadder id, else the material, and custom-model-data too when it is not 0. Name and lore are not checked. item.mythicmobs builds the fuel item from a MythicMobs item, and is used before itemsadder and material. See Fuel for the order fuels are matched in.

The commands accept these placeholders:

PlaceholderFilled with
%player%The player who added the fuel
%minion%The minion's type id, such as farmer
%amount%How many actions were added in total

A minion never takes more fuel than fits under its type's max-stored-actions, so leftover items stay with the player. Types with requires-fuel: false refuse all fuel.

Each type file can also limit which of these fuels it takes, change how fast it burns fuel and add fuels of its own. See Minion type files and Fuel for each type.

Currencies

Every price in the plugin (a level cost in a type file, a price in shop.yml) is written as currency ids with an amount. The ids come from the currencies section of upgrades.yml. The key is the id, and type says how the currency is paid.

The plugin ships three: money (VAULT), tokens (COMMAND) and diamonds (ITEM). Rename them, remove them or add more.

Your server's economy, through Vault.

currencies:
  money:
    type: VAULT
KeyWhat it does
typeVAULT

Needs Vault and an economy plugin. Without them the console warns at start up, and any cost using this currency shows the "currency not available" message instead of charging. Amounts are shown in your economy's own format.

How a failed COMMAND payment is caught

A console command gives nothing back to say whether it worked. So MinionCore checks the balance itself:

  1. It reads the balance placeholder. If the player has less than the amount, nothing runs.
  2. It runs take-command.
  3. It reads the balance placeholder again.
  4. If the balance dropped by less than the amount, the payment counts as failed. Whatever did come off the balance is handed back through give-command, and the console logs a warning.

This catches a mistyped command, a take command that silently refuses, or a currency plugin that is not loaded.

Always set give-command. Without it, nothing taken by a failed or refunded payment can be given back, and the console only logs that the amount was lost.

How a cost is paid

A cost can mix currencies, for example money and tokens and diamonds on one level. The plugin makes sure a player is never charged part of a price.

Every currency must exist

If a currency id in the cost is not in upgrades.yml, or is not available (no Vault economy, no PlaceholderAPI, a missing ItemsAdder or MythicMobs item), nothing happens and the player is told which currency is missing.

Every part is checked

Amounts for the same currency id are added together, then each currency is checked against the player's balance or inventory. If any part is short, nothing is taken and the player sees the cannot afford message with the full price.

Money and command parts are taken

VAULT and COMMAND parts are taken in the order the cost lists them.

Item parts are taken last

ITEM parts always come last, whatever order the cost lists them in.

Anything that fails is rolled back

If any part cannot be taken, every part already taken is given back: money is deposited again, items return to the inventory (dropping at the player's feet if it is full), and COMMAND parts run their give-command. The player sees the payment failed message.

In the shop, the plugin also checks that the goods fit in the player's inventory before charging. See Shop and claims.

Upgrades

Each entry under upgrades is one upgrade item. The key, such as storage-1, is the upgrade id used in allowed-upgrades, the shop and /minion upgrade <player> <id>. Players apply one by right clicking a minion with it, or by dropping it on the matching button in the minion menu.

upgrades:
  speed:
    kind: SPEED
    amount: 2
    types: all
    max-per-minion: 2
    max-per-kind: 2
    minimum-delay: 2
    item:
      material: SUGAR
      name: "<aqua>Minion Speed Upgrade"
      lore:
        - "<gray>Removes <aqua>2 seconds <gray>from the delay."
        - "<gray>Right click a minion to apply it."
KeyDefault when left outWhat it does
kindnoneWhat the upgrade changes, see the table below. An unknown kind skips the entry with a warning
amountnoneHow much it changes by. A whole number above 0, or the entry is skipped
typesallall, or a list of type ids that may use it
max-per-minion1How many times this one entry may be applied to a minion. 0 means no limit
max-per-kind0How many upgrades of this kind a minion may hold in total, counting every entry of the same kind. 0 means no limit
minimum-delay0SPEED only. The shortest delay, in seconds, this upgrade may bring a minion down to
fuel-increasefuel.upgrade-increase in config.ymlHow many percent more fuel each action uses for each time this entry is applied. 0 adds none. See Fuel
itemnoneThe upgrade item. Accepts every item key. %amount% in the name or lore shows the amount value
KindWhat amount doesCapped by
STORAGEAdds storage slotsmax-storage in the type file
SPEEDRemoves seconds from the delaymin-delay in the type file, and the highest minimum-delay of the speed upgrades on the minion
RANGEAdds blocks of rangemax-range in the type file
FUEL_EFFICIENCYMakes each action use that many percent less fuel100
LEVELRaises the level by that many levelsThe type's top level
FIRE_ASPECTHunter only. Sets hit mobs on fire for 4 seconds per pointmax-per-minion and max-per-kind
DAMAGEHunter only. Adds damage to every hit, in half heartsmax-per-minion and max-per-kind
LOOTINGHunter only. Adds looting levels to its killsupgrades.max-looting in config.yml
SILK_TOUCHMiner and farmer only. Puts silk touch on the toolOne applied
RELIABILITYCuts the breakdown chance by that many percent100
CONNECTIONSChunk collector only. Adds connections for pairingmax-connections in the type file
REPLANTLumberjack only. Switches replanting onOne applied

Each kind is explained on Upgrade kinds, with the table of every shipped entry. No LEVEL upgrade ships, add one if you want levels sold as items.

The currency ids above are also used by the repair price under breakdowns in config.yml. See Breakdowns and repairs.

The checks run in the order shown. A type must allow the upgrade in its allowed-upgrades, the upgrade must allow the type in types, and the kind must suit the type's behaviour, so speed upgrades are always refused by chunk loaders and hunter kinds by every other type. With upgrades.require-max-level: true, every kind except LEVEL also waits for the minion's last level. Only one item is used per application, and only when every check passes.

Upgrade items are free to apply. Charge for them by selling them in the shop.

On this page