Skip to content

MemoriesOfTime/EconomyAPI

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EconomyAPI

Core of economy system for Nukkit

Commands

  • /mymoney
  • /seemoney
  • /givemoney
  • /takemoney
  • /topmoney
  • /setmoney

Permissions

  • economyapi
    • economyapi.command
      • economyapi.command.mymoney
      • economyapi.command.givemoney OP
      • economyapi.command.takemoney OP
      • economyapi.command.setmoney OP
      • economyapi.command.topmoney

For developers

Warning

MySQL provider: Due to precision issues, MySQL uses bigint to store monetary amounts. The retrieved values need to be divided by 100 to convert them to the actual amounts.

Single Currency Economies

Developers can access to EconomyAPI's API by using:

EconomyAPI.getInstance().myMoney(player);
EconomyAPI.getInstance().reduceMoney(player, amount);
EconomyAPI.getInstance().addMoney(player, amount);

Tip

Operating through the provider:

  • provider.addMoney(player, amount);

Multiple Currency Economies

currencyName: This parameter is a String that specifies the currency you want to interact with. If your economy system supports multiple currencies (e.g., real-world currencies like "USD", "EUR", "GBP" or in-game items like "Gold", "Silver", "Diamonds"), you can use this parameter to target a specific currency.

If your system only has one currency, use the first set of methods (without the currencyName parameter).

EconomyAPI.getInstance().myMoney(player, currencyName);
EconomyAPI.getInstance().reduceMoney(player, amount, currencyName);
EconomyAPI.getInstance().addMoney(player, amount, currencyName);

Tip

When operating through the provider, the parameter order needs to be adjusted:

  • provider.addMoney(currencyName, player, amount);

Maven repository

<repository>
    <id>nukkitx-repo</id>
    <url>https://repo.nukkitx.com/snapshot</url>
</repository>

<dependency>
    <groupId>me.onebone</groupId>
    <artifactId>economyapi</artifactId>
    <version>2.0.2</version>
    <scope>provided</scope>
</dependency>

About

Core of economy system for Nukkit

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%