Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

Currency System

Daniel V edited this page Sep 24, 2019 · 10 revisions

Currencies

The New Economy supports multiple currencies, which range in various types from world-specific to WorldGuard Region-specific. On top of the type of currency, TNE also supports multiple categories of currencies. These categories are item, virtual and experience.

Currency Categories

In this section, we'll cover the various currency categories, and what each is.

Item

The item category sets the currency to be based on an in-game item. A common example of this would be Gold Ingots. Using this category would mean whenever a player picks up a gold ingot, they'd gain more money for their overall balance.

Experience

The experience category sets the currency to be based on a player's total experience that they have obtained via experience orbs, or other methods. When using this category, a player's balance is displayed where their experience level is located.

Virtual

The virtual category is based on nothing. Essentially, it is just a value stored in a database with no physical form backing it. This is also one of the most common currency categories found in Minecraft Servers, as well as, online games in general.

General Terminology

Some basic terminology used within this page. It will be assumed that you have read through the following terms throughout the documentation on this page.

Tier/Currency Tier

This is a currency denomination. Examples(in USD): Penny, Nickel, Dime, Ten Dollar Bill, One Dollar Bill.

Major currency tier

This is a currency tier, which is a whole number and greater than 0. This is equivalent to a real-world note, or paper bill.

Minor currency tier

This is a currency tier, which is a decimal. This is equivalent to a real-world coin.

Basic Currency Anatomy

In this section, we'll cover the different parts of a currency, as defined in the config.yml Core.Currency section.

Info (Core.Currency.Info)

This section contains basic information about the currency.

Advanced (Core.Currency.Info.Advanced)

Accepted Values: true, false What it does: If set to true, it'll make TNE use the currency configuration in advanced.yml, instead of the one in config.yml. If you set this to true, skip to the Advanced Currency Anatomy section for how to configure your currency system.

Basic (Core.Currency.Basic)

This section contains the configurations nodes used to configure a basic currency system for your server. Note: This section of config.yml is ignored if Core.Currency.Info.Advanced is set to true.

Major_Single (Core.Currency.Basic.Major_Single)

This is used to specify the singular form of your major currency tier's name. Example: Dollar

Major_Plural (Core.Currency.Basic.Major_Plural)

This is used to specify the plural form of your major currency tier's name. Example: Dollars

Minor_Single (Core.Currency.Basic.Minor_Single)

This is used to specify the singular form of your minor currency tier's name. Example: Cent

Minor_Plural (Core.Currency.Basic.Minor_Plural)

This is used to specify the plural form of your minor currency tier's name. Example: Cent

Prefixes (Core.Currency.Basic.Prefixes)

This is used to specify the valid prefixes that will be used when you have included in your currency format. This is based on this site's chart http://www.unitarium.com/si-prefixes.

Example: k for thousands, M for millions

Symbol (Core.Currency.Basic.Symbol)

This is used to specify the character to use as a symbol for your currency. Example: $ for United States Dollar

Item Currency (Core. Currency.Basic.ItemCurrency)

This is used to specify if your currency should be categorized as an item-based currency. Please see the above Currency Categories sections for more information about the Item Category.

Experience Currency (Core. Currency.Basic.ExperienceCurrency)

This is used to specify if your currency should be categorized as an experience-based currency. Please see the above Currency Categories sections for more information about the Experience Category. Note: This configuration is ignored if ItemCurrency is set to true.

Items (Core.Currency.Basic.Items)

This section holds items, and their values if ItemCurrency is set to true. The format is Minecraft Material Name: Value.

Virtual (Core.Currency.Basic.Virtual)

This section holds items, and their values if ItemCurrency and ExperienceCurrency are both set to false. The format is Tier Name: Value. Tier Name should be unique, and is equivalent to denomination name.

Options (Core.Currency.Basic.Options)

This section contains various options that may be used to control your currency in greater detail.

Format (Core.Currency.Basic.Options.Format)

This is the format to use for the currency. Formatting is used anytime an amount of money is sent in chat. If you have anywhere in your format, the format specified will be ignored, and the predefined short format will be used by TNE. Variables allowed:

<symbol> - The currency's symbol
<decimal> - The currency's decimal.
<major> - A combination of the currency's major amount and name
<minor> - A combination of the currency's minor amount and name
<major.name> - The currency's major name.
<minor.name> - The currency's minor name.
<major.amount> - The currency's major amount.
<minor.amount> - The currency's minor amount.
<short.amount> - The currency's shortened amount.
<shorten> - Added to make the outputted value shortened

You may also use the following colour codes in your format.

Char Alt
&b <aqua>
&0 <black>
&9 <blue>
&3 <dark_aqua>
&1 <dark_blue>
&8 <dark_gray>
&2 <dark_green>
&5 <dark_purple>
&4 <dark_red>
&6 <gold>
&7 <gray>
&a <green>
&d <purple>
&c <red>
&f <white>
&e <yellow>
&k <magic>
&l <bold>
&o <italic>
&r <reset>
&m <strike>
&n <underline>
Max Balance (Core.Currency.Basic.Options.MaxBalance)

This is the max amount of currency any player may have at one time. The max supported value is 900 Nonvigintillion.

Balance (Core.Currency.Basic.Options.Balance)

This is the amount of money players start with when they first log in.

Decimal (Core.Currency.Basic.Options.Decimal)

This is the character to use as a decimal in your currency amounts. In the US we use the decimal point ".". Some countries use a comma ",".

EnderChest (Core.Currency.Basic.Options.EnderChest)

Whether or not to include currency items that are in a player's ender chest in their available balance. Note: This value is ignored if ItemCurrency is set to false.

Major_Separate (Core.Currency.Basic.Options.Major_Separate)

Whether or not to separate the major value of a player's balance during formatting. If set to false a formatted balance may look like this: 900000. If set to true a formatted balance may look like this: 900,000.

Major_Separator (Core.Currency.Basic.Options.Major_Separator)

This is the character to use for separation if Major_Separate is set to true. In the example above, the Major_Separator value is set to ",". Note: If Major_Separate is set to false this value is ignored.

Minor_Weight (Core.Currency.Basic.Options.Minor_Weight)

This is the amount of minor denominations are used to make one major denomination. Example: 100 pennies in 1 dollar for the United States Dollar.

Note (Core.Currency.Basic.Note)

This section contains various options that are used for currency noting, i.e. /money note. Currency noting is used to withdraw an amount of virtual currency into a physical item for storage, or trading.

Notable (Core.Currency.Basic.Note.Notable)

This is to specify whether or not players may use /money note with the basic currency.

Fee (Core.Currency.Basic.Note.Fee)

This is the fee charged to the player when using /money note.

Minimum (Core.Currency.Basic.Note.Minimum)

This is the minimum value of a virtual currency that a note may be.

Advanced Currency Anatomy

In this section, we'll cover the different parts of a currency, as defined in the plugins/TheNewEconomy/currencies/ directory.

About

Before Reading Further: Please remember to read the terminology section above. The advanced currency system enables TNE server owners to configure an unlimited amount of tiered-currencies for their server. This can be a simple single tier currency or a complete recreation of a real-world currency such as the United States Dollar.

Overview

After your initial run you'll notice a new directory called "currencies" gets created in TheNewEconomy directory of your plugins folder.

Currencies Image

This directory, by default, contains USD.yml. This is where all the main configurations pertaining to the USD currency are kept(outlined in red). The name of the YAML file is simply for organizational purposes, but it is recommended to keep it the same as your actual currency's name.

You'll also notice a directory, outlined in blue, called "USD." This is where all the configuration files for USD's tiers, or denominations, are kept.

Tiers Directories

The first thing you may notice is that USD has two tiers, one and penny. The file names don't have to be the same name as the tiers themselves, but it is recommended for organizational purposes.

Currency Configurations

In this portion, we'll cover the contents of USD.yml, which contains the basic configurations of the currency.

Configurations Deep Dive

This configuration deep dive is broken down into the parts of the configuration file(Info, Options, Note, and Conversion). We'll cover each configuration node, and what the purpose of it is.

Info

This section of the configuration file contains options that are used to identify the currency. These are the main options of the currency.

Server

Description: This is the name of the server the currency belongs to. This is for data saving purposes.

Default: Main Server

Identifier

Description: This is a unique identifier for the currency. This value is used for data purposes, as well as identifying the currency in command arguments.

Default: "USD"

Major_Single

Description: This is used to specify the singular form of your major currency tier's name.

Default: Dollar

Major_Plural

Description: This is used to specify the plural form of your major currency tier's name.

Default: Dollars

Minor_Single

Description: This is used to specify the singular form of your minor currency tier's name.

Default: Cent

Minor_Plural

Description: This is used to specify the plural form of your minor currency tier's name.

Default: Cent

Prefixes

Description: This is used to specify the valid prefixes that will be used when you have included in your currency format. This is based on this site's chart http://www.unitarium.com/si-prefixes.

Default: kMGTPEZYXWVUN

Example: k for thousands, M for millions

Symbol

Description: This is used to specify the character to use as a symbol for your currency.

Default: $ for United States Dollar

Options

Default

Description: This sets whether or not this currency is the default for the world. Please note only one currency should be set as the world default.

Default: true

Worlds

Description: This is the worlds that this currency is able to be used in. The format is - "world name". Please note that each world name entry should be put on a new line. This is ignored if Global is set to true.

Default: - "world"

Global

Description: This sets whether or not this currency is a global currency and is able to be used in every world.

Default: true

Disabled

Description: This sets whether or not this currency is disabled. Disabled currencies are not able to be used in any world.

Default: false

Format

Description: This is the format to use for the currency. Formatting is used anytime an amount of money is sent in chat. If you have anywhere in your format, the format specified will be ignored, and the predefined short format will be used by TNE. Variables allowed:

<symbol> - The currency's symbol
<decimal> - The currency's decimal.
<major> - A combination of the currency's major amount and name
<minor> - A combination of the currency's minor amount and name
<major.name> - The currency's major name.
<minor.name> - The currency's minor name.
<major.amount> - The currency's major amount.
<minor.amount> - The currency's minor amount.
<short.amount> - The currency's shortened amount.
<shorten> - Added to make the outputted value shortened

You may also use the following colour codes in your format.

Char Alt
&b <aqua>
&0 <black>
&9 <blue>
&3 <dark_aqua>
&1 <dark_blue>
&8 <dark_gray>
&2 <dark_green>
&5 <dark_purple>
&4 <dark_red>
&6 <gold>
&7 <gray>
&a <green>
&d <purple>
&c <red>
&f <white>
&e <yellow>
&k <magic>
&l <bold>
&o <italic>
&r <reset>
&m <strike>
&n <underline>

Default: <major.amount><minor.amount>

Max Balance

Description: This is the max amount of currency any player may have at one time. The max supported value is 900 Nonvigintillion.

Default: 900000000000000000000000000000000000000000000

Balance

Description: This is the amount of money players start with when they first log in.

Default: 200.0

Decimal

Description: This is the character to use as a decimal in your currency amounts. In the US we use the decimal point ".". Some countries use a comma ",".

Default: .

DecimalPlaces

Description: This is the amount of decimal places shown when displaying the player's balance. The maximum value is 4.

Default: 2

Type

Description: This is the currency type, referred to above in the Currency Categories section. The valid values are virtual, item, and experience

Default: virtual

EnderChest

Description: Whether or not to include currency items that are in a player's ender chest in their available balance. Note: This value is ignored if Type is not item

Default: true

Major_Separate

Description: Whether or not to separate the major value of a player's balance during formatting. If set to false a formatted balance may look like this: 900000. If set to true a formatted balance may look like this: 900,000.

Default: true

Major_Separator

Description: This is the character to use for separation if Major_Separate is set to true. In the example above, the Major_Separator value is set to ",". Note: If Major_Separate is set to false this value is ignored.

Default: ,

Minor_Weight

Description: This is the amount of minor denominations are used to make one major denomination. Example: 100 pennies in 1 dollar for the United States Dollar.

Default: 100

Note

This section of the configuration file contains options that affect currency notes for the currency. These are obtained using /money note.

Notable

Description: This denotes if the currency is able to be noted. If this is set to true then players may create currency notes for this currency.

Default: false

Fee

Description: This is the fee charged for creating a currency note for this currency. If this is set to 10 and a player creates a note for 20 monies then the player will receive a currency note with a value of 20 but will be charged a total of 30 monies for creating the note.

Default: 0.00

Minimum

Description: This is the minimum value a currency note for this currency may be. Please note the lowest possible value is 0.0.

Default: 0.00

Item

Description: This contains configurations relating to what the currency note item is. By default currency notes are a piece of paper, but this allows you to let them be anything from Diamonds to custom resource pack items.

Material

Description: This is the name of the item that the currency note is. The value of this configuration should align with your items.yml file in TheNewEconomy directory.

Default: PAPER

ModelData

Description: This is the model data for the material item. This is used for custom resource pack items and should align with their model data value. A deeper explanation of model data may be found here.

Default: 0

Texture

Description: This is the base64 of a custom texture if Material is set to PLAYER_HEAD. This is used to use custom player heads. There's plenty of sites to obtain this value from, I recommended minecraft-heads.com.

Default: eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDA0NzE5YjNiOTdkMTk1YTIwNTcxOGI2ZWUyMWY1Yzk1Y2FmYTE2N2U3YWJjYTg4YTIxMDNkNTJiMzdkNzIyIn19fQ

Note: The default value for this sets the player head to a money bag texture for a more immersive economic experience.

Enchantments

Description: This allows you to add enchantments to currency notes. The format is - "enchantment name". Remember that each enchantment entry should be on a new line. For a list of valid values please check here.

Default: - "example_enchantment"

Flags

Description: This allows you to add item flags to currency notes. These allow you to add various settings to the item such as hide enchantments. The format is - "flag name". Remember that each flag entry should be on a new line. For a list of valid values please check here.

Default: - "example flag"

Conversion

This section of the configuration file contains options which affect converting between this currency and others.

Rate

Description: This is the conversion power of the currency. This is based on a decimal conversion system where 1.0 is equivalent to 100%, or a 1-to-1 conversion.

Default: 1.0

Additional Information

In order to create additional currencies, you'll want to create a new YAML file in the /currencies directory, and copy over the contents of USD.yml and modify to your likings. The recommended naming scheme is .yml.

Tier Configurations

In this portion, we'll cover the contents of one.yml, which contains the configurations of a currency tier, or denomination. The tier configuration files are located in plugins/TheNewEconomy/currencies//.

Configurations Deep Dive

This configuration deep dive is broken down into the parts of the configuration file(Info, Options). We'll cover each configuration node, and what the purpose of it is. You'll notice some configurations will have "Note: Optional" under their description, this notates that the specific configuration is not required and doesn't have to be in the tier YAML file. Another thing to note is that you may see "Note: Item Only" under some configuration descriptions. This means that the configuration is only used if your currency's type is set to "item" and not "virtual" or "experience."

Info

This section of the configuration file contains options that are used to identify the tier. These are the main options of the tier.

Type

Description: This is the type of currency tier, or denomination, that this file represents. There's two viable options for this configuration, which are major and minor. The major type should be used to represent tiers that have a value that is a whole number such as 1, 5, 10, etc. Minor tiers should be used to represent tiers that have a value that is decimal-based such as .5, .01, .25, etc.

Default: Major

Single

Description: This is used to specify the singular form of your tier's name.

Default: One

Plural

Description: This is used to specify the plural form of your tier's name.

Default: Ones

Options

Weight

Description: This is the weight of the tier. Major weights are 1 based while minor weights are .01 based. This means that a Minor Tier with the weight of 1 is actually equivalent to 0.01 while a Major Tier with the same weight is equivalent to 1.

Default: 1

Material

Description: This is the name of the item that represents this currency tier. The value of this configuration should align with your items.yml file in TheNewEconomy directory.

Note: Item Only

Default: PAPER

Damage

Description: This is the damage value of the item that is used to represent the currency tier. This is a legacy Minecraft value and should be ignored in versions above 1.8.

Note: Item Only

Note: Optional

Default: 0

Name

One Tier Item

Description: This is the name that is shown on the item that represents the currency tier. This is displayed in the image above outlined in red.

Note: Item Only

Note: Optional

Default: "One"

Lore

One Tier Item

Description: This is the lore string that is shown on the item that represents the currency tier when hovered over. This value is not able to be added onto items by players, which makes crafting your currency by normal means impossible. This is displayed in the image above outlined in blue.

Note: Item Only

Note: Optional

Default: "Server Currency"

ModelData

Description: This is the model data for the material item. This is used for custom resource pack items and should align with their model data value. A deeper explanation of model data may be found here.

Default: 0

Enchantments

Description: This allows you to add enchantments to currency tier items. The format is - "enchantment name". Remember that each enchantment entry should be on a new line. For a list of valid values please check here.

Default: - "example_enchantment"

Flags

Description: This allows you to add item flags to currency tier items. These allow you to add various settings to the item such as hide enchantments. The format is - "flag name". Remember that each flag entry should be on a new line. For a list of valid values please check here.

Default: - "example flag"

Crafting

TNE provides configurations to add custom crafting recipes for your currency items. This configuration section covers all options relating to this custom crafting system for the currency tier. This section is only relevant if your currency type is "item." The image below is the result of the default crafting configurations and will be referenced below.

crafting one

####### Enabled

Description: This sets whether or not the currency tier item may be crafted.

Default: false

####### Shapeless

Description This sets whether the recipe is shapeless, or shaped. A shapeless recipe just requires the correct amount of materials. While a shaped recipe requires that the materials be in a specific order in the crafting matrix. An example of a shaped recipe is minecart rails.

Default: false

####### Amount

Description: This is the amount of currency items the recipe will return. If this is set to 5 then the player will get 5 currency items for every time they craft the recipe.

Default: 1

####### Materials

Description: These are the materials that each character in the Recipe configuration represent. The format is Character:Material Name. If you wish to use other currency items in your crafting recipe the format is Character:CURRENCY:World Name:Currency Identifier:Tier Singular Name. If you wish to use other currency items, you'll have to set Shapeless to false and be on Minecraft 1.13 or higher.

Default: `- "X:GOLD_NUGGET"

  • "Y:PAPER"`

####### Recipe

Description: This is the crafting recipe for the currency tier item. The crafting recipe should be a maximum of 3 lines with a maximum of 3 characters in length for each line. A space character represents an empty slot if Shapeless is set to false. The characters in the recipe should match the ones set in the Crafting.Materials configuration. The following recipe is the one used for the example recipe image at the top of the Crafting section of this documentation.

Default: `

  • " X "
  • "XYX"
  • " X " `

crafting one

Expanded Explanation: In the default value, the X, as defined in Materials, represent Gold Nuggets, while the Y represents paper. This gives us a shaped recipe that is identical to the one in the image above.

Additional Information

In order to create additional tiers, you'll want to create a new YAML file in the /currencies// directory, and copy over the contents of one.yml and modify to your likings. The recommended naming scheme is .yml.

Clone this wiki locally