Skip to content

Commit

Permalink
🔨 fix nbtapi method changes
Browse files Browse the repository at this point in the history
Took 1 minute
  • Loading branch information
kiranhart committed Sep 29, 2023
1 parent e8f4db1 commit ace1372
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions buildNumber.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#maven.buildNumber.plugin properties file
#Fri Jun 16 15:17:34 EDT 2023
buildNumber=325
#Fri Sep 29 13:20:55 EDT 2023
buildNumber=331
12 changes: 6 additions & 6 deletions src/main/java/ca/tweetzy/funds/listeners/FundsListeners.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,18 @@ public void onCurrencyRedeemEvent(final PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) return;

final ItemStack item = event.getItem();
if (!NBT.get(item, nbt -> nbt.hasTag("Funds:CurrencyID"))) return;
if (!NBT.get(item, nbt -> (boolean) nbt.hasTag("Funds:CurrencyID"))) return;

final Player player = event.getPlayer();
final Account account = Funds.getAccountManager().getAccount(player);

if (account == null) return;

final String currencyId = NBT.get(item, nbt -> nbt.getString("Funds:CurrencyID"));
final String currencyId = NBT.get(item, nbt -> (String) nbt.getString("Funds:CurrencyID"));
final Currency currency = Funds.getCurrencyManager().getCurrency(currencyId);

if (currency == null) return;
final double currencyAmount = NBT.get(item, nbt -> nbt.getDouble("Funds:CurrencyAmount"));
final double currencyAmount = NBT.get(item, nbt -> (double) nbt.getDouble("Funds:CurrencyAmount"));

final CurrencyDepositEvent currencyDepositEvent = new CurrencyDepositEvent(false, account, currency, currencyAmount);
Funds.getInstance().getServer().getPluginManager().callEvent(currencyDepositEvent);
Expand All @@ -110,16 +110,16 @@ public void onCurrencyPickup(final EntityPickupItemEvent event) {
if (!(event.getEntity() instanceof final Player player)) return;

final ItemStack itemStack = event.getItem().getItemStack();
if (!NBT.get(itemStack, nbt -> nbt.hasTag("Funds:CurrencyID"))) return;
if (!NBT.get(itemStack, nbt -> (boolean) nbt.hasTag("Funds:CurrencyID"))) return;

final Account account = Funds.getAccountManager().getAccount(player);
if (account == null) return;

final String currencyId = NBT.get(itemStack, nbt -> nbt.getString("Funds:CurrencyID"));
final String currencyId = NBT.get(itemStack, nbt -> (String) nbt.getString("Funds:CurrencyID"));
final Currency currency = Funds.getCurrencyManager().getCurrency(currencyId);

if (currency == null) return;
final double currencyAmount = NBT.get(itemStack, nbt -> nbt.getDouble("Funds:CurrencyAmount"));
final double currencyAmount = NBT.get(itemStack, nbt -> (double) nbt.getDouble("Funds:CurrencyAmount"));

final CurrencyDepositEvent currencyDepositEvent = new CurrencyDepositEvent(false, account, currency, currencyAmount);
Funds.getInstance().getServer().getPluginManager().callEvent(currencyDepositEvent);
Expand Down

0 comments on commit ace1372

Please sign in to comment.