Skip to content

Commit

Permalink
Feature: Multi-currency support (#5)
Browse files Browse the repository at this point in the history
* change: new version config.yml

* refactor: yaml provider

* refactor: sqlite provider

* refactor: command supports multiple currencies.

* feat(config): upgrade config and data format to version 3

- Update config.yml to version 3
- Add support for multiple currencies
- Upgrade SQLite database to new format
- Update YAML data to new structure
- Add upgrade confirmation and migration process

* refactor: remove unused language files, update README.
  • Loading branch information
Mcayear authored Feb 16, 2025
1 parent 253b1ed commit 4166b72
Show file tree
Hide file tree
Showing 24 changed files with 1,055 additions and 293 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,37 @@ Core of economy system for Nukkit

## For developers

### Single Currency Economies

Developers can access to EconomyAPI's API by using:
```java
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).

```java
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

```xml
<repository>
<id>nukkitx-repo</id>
Expand Down
28 changes: 23 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>me.onebone</groupId>
<artifactId>economyapi</artifactId>
<version>2.0.6-SNAPSHOT</version>
<name>EconomyAPI</name>
<groupId>me.onebone.economyapi.EconomyAPI</groupId>
<artifactId>EconomyAPI</artifactId>
<version>2.1.0-SNAPSHOT</version>
<url>https://github.com/MemoriesOfTime/EconomyAPI</url>

<repositories>
Expand Down Expand Up @@ -49,7 +48,26 @@
</distributionManagement>

<build>
<finalName>${project.name}-${project.version}</finalName>
<finalName>${project.name}-${project.version}-MOT</finalName>

<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/plugin.yml</include>
</includes>
<filtering>true</filtering>
</resource>

<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>**/plugin.yml</exclude>
</excludes>
<filtering>false</filtering>
</resource>
</resources>

<defaultGoal>clean package</defaultGoal>
<plugins>
<plugin>
Expand Down
Loading

0 comments on commit 4166b72

Please sign in to comment.