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: []| Key | Default | What it does |
|---|---|---|
enabled | true | false switches the fuel off. It is not loaded, so its items stop counting and /minion fuel no longer knows it |
actions | none | How many actions one item gives. Must be above 0, or the entry is skipped with a warning |
types | all | all, or a list of type ids that may use this fuel. Other types refuse it |
any-matching-item | false | false 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 |
item | see above | The 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:
| Placeholder | Filled 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| Key | What it does |
|---|---|
type | VAULT |
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:
- It reads the balance placeholder. If the player has less than the amount, nothing runs.
- It runs
take-command. - It reads the balance placeholder again.
- 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."| Key | Default when left out | What it does |
|---|---|---|
kind | none | What the upgrade changes, see the table below. An unknown kind skips the entry with a warning |
amount | none | How much it changes by. A whole number above 0, or the entry is skipped |
types | all | all, or a list of type ids that may use it |
max-per-minion | 1 | How many times this one entry may be applied to a minion. 0 means no limit |
max-per-kind | 0 | How many upgrades of this kind a minion may hold in total, counting every entry of the same kind. 0 means no limit |
minimum-delay | 0 | SPEED only. The shortest delay, in seconds, this upgrade may bring a minion down to |
fuel-increase | fuel.upgrade-increase in config.yml | How many percent more fuel each action uses for each time this entry is applied. 0 adds none. See Fuel |
item | none | The upgrade item. Accepts every item key. %amount% in the name or lore shows the amount value |
| Kind | What amount does | Capped by |
|---|---|---|
STORAGE | Adds storage slots | max-storage in the type file |
SPEED | Removes seconds from the delay | min-delay in the type file, and the highest minimum-delay of the speed upgrades on the minion |
RANGE | Adds blocks of range | max-range in the type file |
FUEL_EFFICIENCY | Makes each action use that many percent less fuel | 100 |
LEVEL | Raises the level by that many levels | The type's top level |
FIRE_ASPECT | Hunter only. Sets hit mobs on fire for 4 seconds per point | max-per-minion and max-per-kind |
DAMAGE | Hunter only. Adds damage to every hit, in half hearts | max-per-minion and max-per-kind |
LOOTING | Hunter only. Adds looting levels to its kills | upgrades.max-looting in config.yml |
SILK_TOUCH | Miner and farmer only. Puts silk touch on the tool | One applied |
RELIABILITY | Cuts the breakdown chance by that many percent | 100 |
CONNECTIONS | Chunk collector only. Adds connections for pairing | max-connections in the type file |
REPLANT | Lumberjack only. Switches replanting on | One 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.