mirror of
https://github.com/Artillex-Studios/AxTrade.git
synced 2025-01-22 21:41:27 +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>
|
<groupId>com.artillexstudios</groupId>
|
||||||
<artifactId>AxTrade</artifactId>
|
<artifactId>AxTrade</artifactId>
|
||||||
<version>1.3.0</version>
|
<version>1.3.1</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>AxTrade</name>
|
<name>AxTrade</name>
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
package com.artillexstudios.axtrade.hooks.currency;
|
package com.artillexstudios.axtrade.hooks.currency;
|
||||||
|
|
||||||
|
import com.artillexstudios.axapi.utils.StringUtils;
|
||||||
import me.TechsCode.UltraEconomy.UltraEconomy;
|
import me.TechsCode.UltraEconomy.UltraEconomy;
|
||||||
import me.TechsCode.UltraEconomy.objects.Account;
|
import me.TechsCode.UltraEconomy.objects.Account;
|
||||||
import me.TechsCode.UltraEconomy.objects.Currency;
|
import me.TechsCode.UltraEconomy.objects.Currency;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@ -15,8 +17,12 @@ public class UltraEconomyHook implements CurrencyHook {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setup() {
|
public void setup() {
|
||||||
final Optional<Currency> currencyOptional = UltraEconomy.getAPI().getCurrencies().name(HOOKS.getString("currencies.UltraEconomy.currency-name", "coins"));
|
final String name = HOOKS.getString("currencies.UltraEconomy.currency-name", "coins");
|
||||||
if (!currencyOptional.isPresent()) throw new RuntimeException("Currency not found!");
|
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();
|
currency = currencyOptional.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,6 +48,7 @@ public class UltraEconomyHook implements CurrencyHook {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getBalance(@NotNull UUID player) {
|
public double getBalance(@NotNull UUID player) {
|
||||||
|
if (currency == null) return 0.0D;
|
||||||
final Optional<Account> account = UltraEconomy.getAPI().getAccounts().uuid(player);
|
final Optional<Account> account = UltraEconomy.getAPI().getAccounts().uuid(player);
|
||||||
if (!account.isPresent()) return 0.0D;
|
if (!account.isPresent()) return 0.0D;
|
||||||
return account.get().getBalance(currency).getOnHand();
|
return account.get().getBalance(currency).getOnHand();
|
||||||
@ -49,6 +56,7 @@ public class UltraEconomyHook implements CurrencyHook {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void giveBalance(@NotNull UUID player, double amount) {
|
public void giveBalance(@NotNull UUID player, double amount) {
|
||||||
|
if (currency == null) return;
|
||||||
final Optional<Account> account = UltraEconomy.getAPI().getAccounts().uuid(player);
|
final Optional<Account> account = UltraEconomy.getAPI().getAccounts().uuid(player);
|
||||||
if (account.isEmpty()) return;
|
if (account.isEmpty()) return;
|
||||||
account.get().addBalance(currency, amount);
|
account.get().addBalance(currency, amount);
|
||||||
@ -56,6 +64,7 @@ public class UltraEconomyHook implements CurrencyHook {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void takeBalance(@NotNull UUID player, double amount) {
|
public void takeBalance(@NotNull UUID player, double amount) {
|
||||||
|
if (currency == null) return;
|
||||||
final Optional<Account> account = UltraEconomy.getAPI().getAccounts().uuid(player);
|
final Optional<Account> account = UltraEconomy.getAPI().getAccounts().uuid(player);
|
||||||
if (account.isEmpty()) return;
|
if (account.isEmpty()) return;
|
||||||
account.get().removeBalance(currency, amount);
|
account.get().removeBalance(currency, amount);
|
||||||
|
@ -76,6 +76,7 @@ public class TradeGui extends GuiFrame {
|
|||||||
gui.open(player.getPlayer());
|
gui.open(player.getPlayer());
|
||||||
inSign = false;
|
inSign = false;
|
||||||
trade.update();
|
trade.update();
|
||||||
|
updateTitle();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
shulkerGui.open(player.getPlayer());
|
shulkerGui.open(player.getPlayer());
|
||||||
@ -207,6 +208,7 @@ public class TradeGui extends GuiFrame {
|
|||||||
gui.open(player.getPlayer());
|
gui.open(player.getPlayer());
|
||||||
inSign = false;
|
inSign = false;
|
||||||
trade.update();
|
trade.update();
|
||||||
|
updateTitle();
|
||||||
});
|
});
|
||||||
}).build(player.getPlayer());
|
}).build(player.getPlayer());
|
||||||
sign.open();
|
sign.open();
|
||||||
|
Loading…
Reference in New Issue
Block a user