|
3 | 3 | import fr.traqueur.currencies.CurrencyProvider;
|
4 | 4 | import org.bukkit.OfflinePlayer;
|
5 | 5 | import su.nightexpress.coinsengine.api.CoinsEngineAPI;
|
6 |
| -import su.nightexpress.coinsengine.api.currency.Currency; |
7 | 6 |
|
8 | 7 | import java.math.BigDecimal;
|
9 | 8 |
|
10 | 9 | public class CoinsEngineProvider implements CurrencyProvider {
|
11 | 10 |
|
12 |
| - private final Currency currency; |
| 11 | + private final String currencyName; |
13 | 12 |
|
14 | 13 | public CoinsEngineProvider(String currencyName) {
|
15 |
| - this.currency = CoinsEngineAPI.getCurrency(currencyName); |
| 14 | + this.currencyName = currencyName; |
16 | 15 | }
|
17 | 16 |
|
18 | 17 | @Override
|
19 | 18 | public void deposit(OfflinePlayer offlinePlayer, BigDecimal amount, String reason) {
|
20 |
| - CoinsEngineAPI.addBalance(offlinePlayer.getUniqueId(), this.currency, amount.doubleValue()); |
| 19 | + CoinsEngineAPI.addBalance(offlinePlayer.getUniqueId(), this.currencyName, amount.doubleValue()); |
21 | 20 | }
|
22 | 21 |
|
23 | 22 | @Override
|
24 | 23 | public void withdraw(OfflinePlayer offlinePlayer, BigDecimal amount, String reason) {
|
25 |
| - CoinsEngineAPI.removeBalance(offlinePlayer.getUniqueId(), this.currency, amount.doubleValue()); |
| 24 | + CoinsEngineAPI.removeBalance(offlinePlayer.getUniqueId(), this.currencyName, amount.doubleValue()); |
26 | 25 | }
|
27 | 26 |
|
28 | 27 | @Override
|
29 | 28 | public BigDecimal getBalance(OfflinePlayer offlinePlayer) {
|
30 |
| - return BigDecimal.valueOf(CoinsEngineAPI.getBalance(offlinePlayer.getUniqueId(), this.currency)); |
| 29 | + return BigDecimal.valueOf(CoinsEngineAPI.getBalance(offlinePlayer.getUniqueId(), this.currencyName)); |
31 | 30 | }
|
32 | 31 | }
|
0 commit comments