Internal Store Configuration
About 669 wordsAbout 2 min
The internal store is configured in plugins/MyCompany/prices.yml. The file is generated on the first start if it does not exist, and it is read once at startup.
The file has three parts:
multipliers:
company:
normal: 1.2
ore-company: 1.3
mob-company: 1.56
player-share: 0.1
prices:
vanilla:
mob_rotten_flesh:
material: rotten_flesh
price: 2.0
group: mob-companymultipliers
multipliers.company defines the price groups. The key is the group id and the value is the multiplier applied to the base price.
normalis the fallback group. It is used when the company's group does not match the item's group.- If
normalis missing but the section exists, the plugin uses1.2. - The whole
multipliers.companysection must exist. If it is missing, the store cannot be initialized. - The item's
groupis lower-cased before it is looked up, while the keys undermultipliers.companyare used as written. Write both in lower case so they always match.
A company uses one group at a time. It starts with normal, and a focus can change it; see Focus. The company group is reset to normal when the company changes focus.
player-share
player-share is the fraction of the sale that goes to the seller personally. The rest goes to the company.
0.1means 10% to the seller and 90% to the company.- The value is a fraction, not a percentage: write
0.1, not10. - If the key is missing,
0is used. - Keep the value between
0and1; a larger value makes the company share negative.
The player share is paid to the seller's economy balance with Vault. The company share is added to the company balance.
prices
All items are listed under prices.vanilla. Each entry has an id and three fields:
| Field | Description |
|---|---|
material | The Bukkit material of the item, for example rotten_flesh or diamond. |
price | The base price for one item. Must be greater than 0. |
group | The price group of the item. Optional; defaults to normal. |
The entry id (mob_rotten_flesh above) is only a name for the entry. The item is matched by material. Only plain items are matched: an item with a custom name, lore, enchantment or other item meta is not priced, even when its material is listed.
Items are matched by material only, so two entries with the same material share one price. Custom items from other plugins are not supported by this section.
Calculation
item value = price × group multiplier × amount
player share = item value × player-share
company share = item value − player shareThe multiplier is chosen per item:
| Company group | Item group | Multiplier used |
|---|---|---|
normal | normal | normal |
mob-company | mob-company | mob-company |
mob-company | ore-company | normal |
normal | mob-company | normal |
In other words, an item gets its own group multiplier only while the company's current group is the same one.
Validation
The file is read at startup:
- An invalid material is logged and the entry is skipped.
- A price that is
0or lower is logged and the entry is skipped. - An item group that does not exist in
multipliers.companythrows an error when that item is placed in the store. Always use a group defined in the section. - A missing
multipliers.companysection prevents the store from loading. - Changes to
prices.ymlrequire a server restart; the file is not reloaded by the configuration reload.
Adding a price
- Add an entry under
prices.vanilla. - Set
materialto the Bukkit material name. - Set
priceto the amount the company pays for one item. - Set
groupto an existing group, or leave it out fornormal. - Restart the server and put one item in the store to check the displayed payout.
To give a focus a better rate, use the set_price_group action in the focus tree, as described in Conditions, Effects and Actions. The group named in the action must exist in multipliers.company.