mirror of
https://github.com/Artillex-Studios/AxTrade.git
synced 2025-01-04 18:47:51 +01:00
1.3.1
This commit is contained in:
parent
298bfb1c38
commit
29d0ee0053
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.artillexstudios</groupId>
|
||||
<artifactId>AxTrade</artifactId>
|
||||
<version>1.3.0</version>
|
||||
<version>1.3.1</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>AxTrade</name>
|
||||
|
@ -1,8 +1,10 @@
|
||||
package com.artillexstudios.axtrade.hooks.currency;
|
||||
|
||||
import com.artillexstudios.axapi.utils.StringUtils;
|
||||
import me.TechsCode.UltraEconomy.UltraEconomy;
|
||||
import me.TechsCode.UltraEconomy.objects.Account;
|
||||
import me.TechsCode.UltraEconomy.objects.Currency;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Optional;
|
||||
@ -15,8 +17,12 @@ public class UltraEconomyHook implements CurrencyHook {
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
final Optional<Currency> currencyOptional = UltraEconomy.getAPI().getCurrencies().name(HOOKS.getString("currencies.UltraEconomy.currency-name", "coins"));
|
||||
if (!currencyOptional.isPresent()) throw new RuntimeException("Currency not found!");
|
||||
final String name = HOOKS.getString("currencies.UltraEconomy.currency-name", "coins");
|
||||
final Optional<Currency> currencyOptional = UltraEconomy.getAPI().getCurrencies().name(name);
|
||||
if (!currencyOptional.isPresent()) {
|
||||
Bukkit.getConsoleSender().sendMessage(StringUtils.formatToString("&#FF0000[AxAuctions] UltraEconomy currency named &#DD0000" + name + " &#FF0000not found! Change the currency-name or disable the hook to get rid of this warning!"));
|
||||
return;
|
||||
}
|
||||
currency = currencyOptional.get();
|
||||
}
|
||||
|
||||
@ -42,6 +48,7 @@ public class UltraEconomyHook implements CurrencyHook {
|
||||
|
||||
@Override
|
||||
public double getBalance(@NotNull UUID player) {
|
||||
if (currency == null) return 0.0D;
|
||||
final Optional<Account> account = UltraEconomy.getAPI().getAccounts().uuid(player);
|
||||
if (!account.isPresent()) return 0.0D;
|
||||
return account.get().getBalance(currency).getOnHand();
|
||||
@ -49,6 +56,7 @@ public class UltraEconomyHook implements CurrencyHook {
|
||||
|
||||
@Override
|
||||
public void giveBalance(@NotNull UUID player, double amount) {
|
||||
if (currency == null) return;
|
||||
final Optional<Account> account = UltraEconomy.getAPI().getAccounts().uuid(player);
|
||||
if (account.isEmpty()) return;
|
||||
account.get().addBalance(currency, amount);
|
||||
@ -56,6 +64,7 @@ public class UltraEconomyHook implements CurrencyHook {
|
||||
|
||||
@Override
|
||||
public void takeBalance(@NotNull UUID player, double amount) {
|
||||
if (currency == null) return;
|
||||
final Optional<Account> account = UltraEconomy.getAPI().getAccounts().uuid(player);
|
||||
if (account.isEmpty()) return;
|
||||
account.get().removeBalance(currency, amount);
|
||||
|
@ -76,6 +76,7 @@ public class TradeGui extends GuiFrame {
|
||||
gui.open(player.getPlayer());
|
||||
inSign = false;
|
||||
trade.update();
|
||||
updateTitle();
|
||||
}
|
||||
}));
|
||||
shulkerGui.open(player.getPlayer());
|
||||
@ -207,6 +208,7 @@ public class TradeGui extends GuiFrame {
|
||||
gui.open(player.getPlayer());
|
||||
inSign = false;
|
||||
trade.update();
|
||||
updateTitle();
|
||||
});
|
||||
}).build(player.getPlayer());
|
||||
sign.open();
|
||||
|
Loading…
Reference in New Issue
Block a user