# Creating a Currency

## Overview

This guide provides step-by-step instructions on creating and configuring new currencies for your Minecraft server using the currency system. Each currency has a central configuration file and required denomination files to define its behavior and appearance. With this system, server owners can create unlimited currencies, which may be virtual, experience-based, or item-based.

***

### Folder Structure

Currencies are organized in the following structure:

```
- currency/
  - <Currency-Identifier>  # Folder matching the Identifier in the main currency YAML
    - <Denomination>.yml   # YAML files defining denominations
- <Currency-Identifier>.yml # Main currency configuration file
```

#### Example Structure for "USD":

```
- currency/
  - USD/
    - one.yml
    - penny.yml
- USD.yml
```

***

### Step-by-Step Instructions

#### Step 1: Define the Main Currency Configuration

1. Navigate to the `currency` folder on your server.
2. Create a YAML file named `<Currency-Identifier>.yml` (e.g., `USD.yml`).
3. Configure the following sections:

**Example `USD.yml` Configuration:**

```yaml
# Main configuration file for the USD currency
config-version: 2
Info:
  Server: "Main Server"        # The server name using this currency
  Identifier: "USD"            # Unique identifier for this currency
  UUIDAsId: false               # Use UUIDs as IDs (true/false)
  Icon: "PAPER"                # Icon material for this currency
  Major_Single: "Dollar"       # Singular name of the major unit
  Major_Plural: "Dollars"      # Plural name of the major unit
  Minor_Single: "Cent"         # Singular name of the minor unit
  Minor_Plural: "Cents"        # Plural name of the minor unit
  Symbol: "$"                  # Symbol for this currency
Options:
  MultiRegion:
    Regions:
      world:
        Default: true          # This currency is default for the "world" region
  Global:
    Enabled: true              # Currency is globally enabled
    Default: true              # Set as the default global currency
  Disabled: false              # If true, disables the currency
  Sync: true                   # Synchronize balances across regions
  MaxBalance: 900000000000000000000000000000000000000000000  # Maximum allowed balance
  Balance: 200.0               # Default starting balance for players
  Decimal: "."                 # Decimal separator
  DecimalPlaces: 2             # Number of decimal places
  Type: "virtual"             # Type of currency (virtual/item/experience)
  Minor_Weight: 100            # Number of minor units per major unit
Formatting:
  Format: "<symbol><major.amount><decimal><minor.amount>"  # Display format for amounts
  Prefixes: "kMGTPEZYXWVUN₮"                              # Prefixes for large numbers
  Major_Separate: true                                      # Separate major units with commas
  Major_Separator: ","                                    # Separator character
```

***

#### Step 2: Add Denomination Files

1. Create a folder named after the currency's Identifier (e.g., `USD`) in the `currency` directory.
2. For each denomination, create a YAML file in this folder.
3. Configure each file with the denomination's settings.

**Example `one.yml` Configuration:**

```yaml
# Configuration for the "One" denomination
config-version: 2
Info:
  Single: "One"               # Singular name of this denomination
  Plural: "Ones"              # Plural name of this denomination
Options:
  Weight: 1                   # Value of this denomination in minor units
  Material: "PAPER"           # Material representing this denomination
  Texture: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDA0NzE5YjNiOTdkMTk1YTIwNTcxOGI2ZWUyMWY1Yzk1Y2FmYTE2N2U3YWJjYTg4YTIxMDNkNTJiMzdkNzIyIn19fQ=="  # Custom texture for this item
  Crafting:
    Enabled: false            # Disable crafting for this denomination
    Shapeless: false          # Require specific crafting shape
    Amount: 1                 # Amount produced per recipe
    Materials:                # Materials needed for crafting
      - "X:GOLD_NUGGET"
      - "Y:PAPER"
    Recipe:                   # Crafting grid recipe
      - " X "
      - "XYX"
      - " X "
```

**Example `penny.yml` Configuration:**

```yaml
# Configuration for the "Penny" denomination
config-version: 2
Info:
  Single: "Penny"              # Singular name of this denomination
  Plural: "Pennies"            # Plural name of this denomination
Options:
  Weight: 0.01                # Value of this denomination in minor units
  Material: "PAPER"           # Material representing this denomination
  Texture: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDA0NzE5YjNiOTdkMTk1YTIwNTcxOGI2ZWUyMWY1Yzk1Y2FmYTE2N2U3YWJjYTg4YTIxMDNkNTJiMzdkNzIyIn19fQ=="  # Custom texture for this item
  Crafting:
    Enabled: false            # Disable crafting for this denomination
    Shapeless: false          # Require specific crafting shape
    Amount: 1                 # Amount produced per recipe
    Materials:                # Materials needed for crafting
      - "X:IRON_NUGGET"
      - "Y:PAPER"
    Recipe:                   # Crafting grid recipe
      - "XYX"
```

***

#### Step 3: Enable the Currency

1. Restart your server or reload the plugin managing the currency system.
2. Verify the currency and its denominations are loaded correctly.

***

### Additional Notes

* **One Denomination Required**: Every currency must include at least one denomination defined in its folder.
* **Customization**: Add as many denominations as needed, following the format above.
* **Crafting**: If crafting is enabled, ensure recipes use unique patterns to avoid conflicts.
* **Virtual Currencies**: While denominations are required, these can represent virtual constructs if desired.
* **Performance**: Set reasonable limits for `MaxBalance` to avoid overflow issues.

For further assistance, contact support or refer to the example configurations included with the plugin.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tne.gitbook.io/tne-docs/intro/creating-a-currency.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
