-
Notifications
You must be signed in to change notification settings - Fork 0
💸 | Economies
In this page you will understand how to add
/ remove
economies, editing
the one that already exist and adding external economies
.
By default, PrisonEnchants starts with 3 different economies: tokens, gems and shards. An economy can be used to pay for enchantments or to just have more currencies in the server.
The economy section contains 3 keys, but only one of the is essential: enabled:
economy:
plugin-economies:
tokens:
enabled: true <*>
color: "&6"
first-join-amount: 100
Note
<*>
means that the config must contains that path.
-
enabled: true
| If not enabled, this economy won't be loaded to the server. -
color: "&6"
| The color that will replace the placeholder %economy_color% in the messages. -
first-join-amount: 100
| The amount of tokens given to the player the first time that he join in the server.
You must at least specify if the economy is enabled with enabled: true/false
, the other keys can be ignored.
When an economy is not enabled, it won't be registered to the server.
The economy commands will be registered to the server correctly only after a restart.
The custom economies allows you to pay for enchantments using other currency plugins (EssentialsX, CoinsEngine...). This feature requires PlaceholderAPI to work!
This part is a bit harder to understand, but in this wiki i'll explain everything.
When you first download the plugin, your config file will look like this:
economy:
custom-economies:
yourCustomEconomy:
enabled: false
color: "&2"
balance-placeholder: "%yourCustomEconomy_balance%"
add-cmd: "yourCustomEconomy add %player% %amount%"
remove-cmd: "yourCustomEconomy remove %player% %amount%"
set-cmd: "yourCustomEconomy set %player% %amount%"
-
balance-placeholder: "%yourCustomEconomy_balance%"
| The placeholder that will return the player money (MUST BE A RAW NUMBER). -
add-cmd: "yourCustomEconomy add %player% %amount%"
| The plugin command to add money to the player. -
remove-cmd: "yourCustomEconomy remove %player% %amount%"
| The plugin command to remove money from the player. -
set-cmd: "yourCustomEconomy set %player% %amount%"
| The plugin command to set money to the player.
This was an example made by me, to actually use another plugin currency, you'll need to edit these values.
Let's use CoinsEngine for this example:
Firstly, we enable the economy with enabled: true
, then we edit the balance-placeholder
with the one that CoinsEngine gives to us, that returns a RAW number.
- balance-placeholder: "%coinsengine_balance_raw_[currency]%"
Then we edit the commands to manage the player balance.
Do not put the / before the command, PrisonEnchants will already do it for you.
The placeholders to get the player name and the transaction amount are %player%
and %amount%
. Since the command format of CoinsEngine is /coins ... [player] [amount], we type them like that: (You can find all these info here)
- add-cmd: "coins give %player% %amount%"
- remove-cmd: "coins take %player% %amount%"
- set-cmd: "coins set %player% %amount%"
That's it, now your config file should looks like this:
economy:
custom-economies:
yourCustomEconomy:
enabled: true
color: "&2"
balance-placeholder: "%coinsengine_balance_raw_[currency]%"
add-cmd: "coins give %player% %amount%"
remove-cmd: "coins take %player% %amount%"
set-cmd: "coins set %player% %amount%"
You can now change the name of the economy with the one you like, and use it in the enchants file.
When you download the plugin for the first time, your economies section will looks like this:
economy:
plugin-economies:
tokens:
enabled: true
color: "&6"
first-join-amount: 100
gems:
enabled: true
color: "&a"
first-join-amount: 0
shards:
enabled: true
color: "&5"
first-join-amount: 0
If you want to edit the plugin economies, follow these steps:
Let's say that you want to add another economy called bricks
, the way to add it is pretty intuitive.
In your config, you want to add another section, with the name of our economy ("bricks"), then fill it with all the keys inside, our config file will look like this:
economy:
plugin-economies:
tokens:
enabled: true
color: "&6"
first-join-amount: 100
gems:
enabled: true
color: "&a"
first-join-amount: 0
shards:
enabled: true
color: "&5"
first-join-amount: 0
bricks:
enabled: true
color: "&2"
first-join-amount: 50
Doing so, your plugin will have now 4 economies, tokens, gems, shards and bricks.
The new economy added will have as color &2
(green) and new players will start with 50
bricks.
Using our previous config as example, we now want to remove the economy called gems
.
To remove the gems economy, you simply have to delete the gems section and all the paths inside, so now our config will look like this:
economy:
plugin-economies:
tokens:
enabled: true
color: "&6"
first-join-amount: 100
shards:
enabled: true
color: "&5"
first-join-amount: 0
bricks:
enabled: true
color: "&2"
first-join-amount: 50