From 29d0ee0053f4efe2118fb034663580baa0587dca Mon Sep 17 00:00:00 2001
From: BenceX100 <52270269+BenceX100@users.noreply.github.com>
Date: Thu, 30 May 2024 19:20:45 +0200
Subject: [PATCH] 1.3.1
---
pom.xml | 2 +-
.../axtrade/hooks/currency/UltraEconomyHook.java | 13 +++++++++++--
.../com/artillexstudios/axtrade/trade/TradeGui.java | 2 ++
3 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/pom.xml b/pom.xml
index c991526..e16e890 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.artillexstudios
AxTrade
- 1.3.0
+ 1.3.1
jar
AxTrade
diff --git a/src/main/java/com/artillexstudios/axtrade/hooks/currency/UltraEconomyHook.java b/src/main/java/com/artillexstudios/axtrade/hooks/currency/UltraEconomyHook.java
index 95dcec0..9d97f6c 100644
--- a/src/main/java/com/artillexstudios/axtrade/hooks/currency/UltraEconomyHook.java
+++ b/src/main/java/com/artillexstudios/axtrade/hooks/currency/UltraEconomyHook.java
@@ -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 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 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 = 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 = 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 = UltraEconomy.getAPI().getAccounts().uuid(player);
if (account.isEmpty()) return;
account.get().removeBalance(currency, amount);
diff --git a/src/main/java/com/artillexstudios/axtrade/trade/TradeGui.java b/src/main/java/com/artillexstudios/axtrade/trade/TradeGui.java
index 41915b9..c150e2b 100644
--- a/src/main/java/com/artillexstudios/axtrade/trade/TradeGui.java
+++ b/src/main/java/com/artillexstudios/axtrade/trade/TradeGui.java
@@ -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();