Dinar Economy

Dinar Economy

Economy and mod for Minecraft 1.21.1 (Fabric).

杂项

Dinar Economy & Caliphat

A complete economic and governance system for Minecraft servers running Minecraft 1.21.1 with Fabric.

Dinar Economy & Caliphat provides a player-driven economy with banking, loans, shops, auctions, companies, contracts, taxation, salaries, and a complete Caliphat government system.


Table of Contents


Features

  • Complete player economy.
  • Player balances and money transfers.
  • Transaction history.
  • Banking system with interest.
  • Loans with configurable rates and durations.
  • Player-created shops.
  • Stock management for shops.
  • Global auction house.
  • Player-owned businesses and companies.
  • Company treasuries and membership management.
  • Smart contracts between players.
  • Caliphat government system.
  • Caliph appointment and management.
  • Laws, votes, decrees, and fines.
  • Recurring player salaries.
  • Global and personal taxation.
  • Optional live economy scoreboard.
  • Placeholder API integration.
  • Persistent JSON-based data storage.
  • Automatic data saving every five minutes.

Requirements

  • Minecraft 1.21.1.
  • Fabric Loader compatible with Minecraft 1.21.1.
  • Fabric API for Minecraft 1.21.1.
  • Java Development Kit 21 or higher when compiling from source.

Optional Dependencies

For placeholder support and advanced scoreboard integration:

  • Text Placeholder API by Patbox.
  • TAB.

Installation

  1. Install Fabric Loader for Minecraft 1.21.1.

  2. Download the latest compatible version of Fabric API.

  3. Place the following files in your server's mods directory:

    fabric-api-1.21.1.jar
    dinar-1.2.0.jar
    
  4. Optionally install Text Placeholder API and TAB.

  5. Start or restart the server.

  6. Configure the mod in:

    config/dinar.json
    

Player Commands

Economy

Command Description
/bal Check your balance.
/balance Check your balance.
/money Check your balance.
/bal <player> Check another player's balance.
/pay <player> <amount> [reason] Send money to another player.
/dmd <player> <amount> [message] Request money from another player.
/dmd accept <id> Accept a money request.
/dmd deny <id> Deny a money request.
/dmd List your pending money requests.
/dmd list List your pending money requests.
/baltop [page] View the richest players leaderboard.

Banking and Loans

Banking

Command Description
/bank balance View your bank balance and accrued interest.
/bank balance <player> View another player's bank balance.
/bank deposit <amount> Deposit money into your bank account.
/bank withdraw <amount> Withdraw money from your bank account.

Loans

Command Description
/loan take <amount> <rate> <duration> Take out a loan.
/loan repay <amount> Repay part or all of your loan.
/loan info View information about your current loan.
/loan list View all active loans.
/loan help Display help for the loan system.

Player Shops

Command Description
/shop create <item> <buy_price> <sell_price> <max_stock> Create a player shop.
/shop list [page] Browse all active shops.
/shop info <id> View detailed information about a shop.
/shop buy <id> <quantity> Buy items from a shop.
/shop sell <id> <quantity> Sell items to a shop.
/shop remove <id> Remove one of your shops.
/shop help Display help for the shop system.

Auction House

Command Description
/ah sell <price> [quantity] List the item currently held in your hand.
/ah buy <id> Purchase an auction listing.
/ah list [page] Browse auction listings.
/ah cancel <id> Cancel one of your auction listings.
/ah info <id> View information about an auction listing.
/ah help Display help for the auction house.

Businesses

The business system allows players to create companies, manage members, and operate a shared treasury.

Command Description
/entreprise create <name> Create a new company.
/entreprise info [name] View company information.
/entreprise list List all companies.
/entreprise invite <player> Invite a player to your company.
/entreprise kick <player> Remove a member from your company.
/entreprise depot <amount> Deposit money into the company treasury.
/entreprise withdraw <amount> Withdraw money from the company treasury.
/entreprise members [name] List company members.
/entreprise delete <name> Dissolve your company.
/entreprise help Display help for the business system.

Contracts

Contracts allow players to create and sign agreements for sales, services, rentals, and loans.

Command Description
/contract create <player> <type> <details> [amount] Create a contract for another player.
/contract sign <id> Sign a pending contract.
/contract cancel <id> Cancel a contract.
/contract list View your contracts.
/contract pending View contracts awaiting your signature.
/contract info <id> View detailed contract information.
/contract help Display help for the contract system.

Contract Types

The following contract types are supported:

  • sale
  • service
  • rental
  • loan

Caliphat Government

The Caliphat system adds a governance layer to the server. Players can view the current Caliph, inspect laws, participate in votes, and consult active decrees.

Player Commands

Command Description
/caliphat info View information about the current Caliph.
/loi liste List all laws.
/loi livre Open the law book GUI.
/loi voter Open the law voting GUI.
/loi voter <id> <0\|1> Vote on a law. Use 0 for no and 1 for yes.
/loi info <id> View detailed information about a law.
/loi decret View the current decree.
/loi calife View information about the Caliph.
/amende <player> <amount> <reason> Issue a fine. Available to the Caliph or server operators.

System Commands

Command Description
/dinar help Open the comprehensive help panel.
/dinar about Display information about the mod.

Admin Commands

The following commands require operator privileges or permission level 2.

Economy Administration

All economy administration commands use the /eco command.

Command Description
/eco give <player> <amount> Give money to a player.
/eco take <player> <amount> Take money from a player.
/eco set <player> <amount> Set a player's balance.
/eco reset <player> <amount> Reset a player's account.
/eco resetall Reset all player accounts.
/eco panel Open the economy administration GUI.
/eco treasury View the server treasury balance.
/eco treasury add <amount> Add money to the server treasury.
/eco treasury take <amount> Remove money from the server treasury.
/eco history <player> View a player's transaction history.
/eco reload Reload the configuration.
/eco save Save all data manually.

Caliphat Administration

All government administration commands use the /caliphat command.

Command Description
/caliphat set <player> Appoint a new Caliph.
/caliphat remove Remove the current Caliph.
/caliphat loi proposer <title> <content> Propose a law for voting.
/caliphat loi promulguer <title> <content> Enact a law directly.
/caliphat loi voter <id> Open a vote on a law.
/caliphat loi liste List all laws.
/caliphat loi info <id> View detailed information about a law.
/caliphat decret <text> Issue a public decree.
/caliphat config titre on\|off Enable or disable screen titles for law events.
/caliphat config duree_vote <seconds> Set the voting duration.
/caliphat config votes_requis <number> Set the number of votes required to pass a law.

Default Government Settings

Setting Default
Voting duration 300 seconds
Required votes 3

Salaries

All salary administration commands use the /salary command.

Command Description
/salary set <player> <amount> [interval_seconds] Set a recurring salary.
/salary remove <player> Remove a player's salary.
/salary list List all configured salaries.
/salary payall Pay all due salaries.
/salary info <player> View salary information for a player.

Taxes

All tax administration commands use the /tax command.

Command Description
/tax global <percentage> Set the global transaction tax rate.
/tax salary <percentage> Set the salary tax rate.
/tax set <player> <percentage> Set a personal tax rate.
/tax remove <player> Remove a player's personal tax rate.
/tax list List all personal tax rates.
/tax info <player> View tax information for a player.

Scoreboard Configuration

The mod includes an optional sidebar scoreboard displaying economy and government information.

Edit the following section in config/dinar.json:

{
  "scoreboard": {
    "enabled": false,
    "title": "Dinar",
    "showRank": true,
    "showTreasury": true,
    "showLaws": true
  }
}

Scoreboard Options

Option Default Description
enabled false Enables or disables the scoreboard.
title "Dinar" Sets the scoreboard title.
showRank true Displays the player's leaderboard rank.
showTreasury true Displays the server treasury balance.
showLaws true Displays the number of enacted laws.

After changing the configuration, use:

/eco reload

Placeholders

Dinar Economy supports Text Placeholder API placeholders.

Placeholder Description Example
%dinar:balance% Formatted player balance. D 1,234.56
%dinar:balance_raw% Raw balance value. 1234.56
%dinar:balance_int% Integer balance. 1234
%dinar:rank% Player's leaderboard rank. #3
%dinar:treasury% Server treasury balance. D 10,000.00
%dinar:leader% Current Caliph's name. Notch
%dinar:laws% Number of enacted laws. 15
%dinar:decree% Current active decree. No building in spawn
%dinar:is_leader% Whether the player is the Caliph. true
%dinar:currency% Currency symbol. D
%dinar:currency_name% Currency name. Dinar

TAB Example

tab:
  header:
    - "&6&lDinar Economy"
    - "&7Balance: %dinar:balance%"
    - "&7Rank: %dinar:rank%"

Scoreboard Plugin Example

lines:
  - "&eBalance: %dinar:balance%"
  - "&eTreasury: %dinar:treasury%"
  - "&eCaliph: %dinar:leader%"

Chat Formatting Example

chat:
  format: "{prefix} {player} &7| &e%dinar:balance%"

Configuration

The configuration file is located at:

config/dinar.json

Default Configuration

{
  "currencyName": "Dinar",
  "currencySymbol": "D",
  "startingBalance": 0,
  "globalTransactionTax": 0,
  "salaryTax": 0,
  "bankInterestRate": 0.02,
  "bankInterestIntervalTicks": 72000,
  "allowNegative": false,
  "suffixFormat": true,
  "scoreboard": {
    "enabled": false,
    "title": "Dinar",
    "showRank": true,
    "showTreasury": true,
    "showLaws": true
  }
}

Configuration Options

Option Default Description
currencyName "Dinar" Name displayed in messages.
currencySymbol "D" Symbol used to format currency values.
startingBalance 0 Initial balance given to new players.
globalTransactionTax 0 Percentage applied to player-to-player transactions.
salaryTax 0 Percentage applied to salary payments.
bankInterestRate 0.02 Interest rate applied during each interest cycle.
bankInterestIntervalTicks 72000 Number of ticks between interest calculations.
allowNegative false Allows player balances to become negative when enabled.
suffixFormat true Enables compact number formatting such as K, M, and B.

Interest Interval

Minecraft runs at 20 ticks per second. The default value is:

72000 ticks = 1 hour

With the default configuration, players receive 2% interest on eligible bank deposits every hour.


Data Storage

All Dinar data is stored in the following directory:

world/dinar/

Data Files

Data Type File Description
Economy world/dinar/data.json Player balances, bank accounts, and loan information.
Shops world/dinar/shops.json Player shops and their inventory.
Companies world/dinar/companies.json Company information, members, and treasuries.
Auctions world/dinar/auctions.json Active and completed auction listings.
Contracts world/dinar/contracts.json Contracts created between players.
Government world/dinar/government.json Caliph information, laws, decrees, and votes.

Data Management

  • Data is automatically saved every five minutes.
  • Use /eco save to save data manually.
  • Use /eco reload to reload the configuration.
  • To create a backup, copy the complete world/dinar/ directory.

Stop the server before manually copying or modifying data files to reduce the risk of data corruption.


Compilation

Building from Source

Clone or download the project source code, then run:

Linux, macOS, or WSL

./gradlew build

Windows

gradlew.bat build

Requirements

  • JDK 21 or higher.
  • Internet connection for downloading Gradle and project dependencies.
  • The Gradle wrapper included with the project.

Build Output

After a successful build, the compiled mod JAR is generated in:

build/libs/dinar-1.2.0.jar

License

This mod is provided as-is under an open license.

  • Free to use on any Minecraft server.
  • Free to modify for personal use.
  • Redistribution of modified versions is not permitted without permission.
  • Commercial resale is not permitted.

Please consult the repository's license file for the complete legal terms.


Support

If you encounter a problem or want to suggest an improvement:

  • Report bugs through the issue tracker.
  • Submit feature requests through the repository.
  • Open a pull request to contribute improvements.
  • Join the community Discord server.
  • Consult the GitHub repository and wiki for additional documentation.

Troubleshooting

Problem Solution
Commands are not working. Make sure you have the required permissions or operator level 2.
Data is not saving. Check file permissions, available disk space, and server logs.
Placeholders are not displayed. Install Text Placeholder API and restart the server.
The scoreboard is not updating. Set scoreboard.enabled to true, then use /eco reload.
Bank interest is not being calculated. Check bankInterestIntervalTicks and verify that the player has money deposited in the bank.
Configuration changes have no effect. Verify that config/dinar.json contains valid JSON, then restart the server or use /eco reload.
Players lose data after an update. Stop the server and create a backup of world/dinar/ before updating the mod.

Enjoy building your own economic and governmental civilization with Dinar Economy & Caliphat! 🕌💰

Made with ❤️ for the Minecraft community.