Skip to content

Commit

Permalink
replace deprecated method
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Aug 2, 2024
1 parent 85ff01e commit f642674
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions shared/src/main/java/me/xginko/aef/utils/ItemUtil.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package me.xginko.aef.utils;

import com.cryptomorin.xseries.XMaterial;
import de.tr7zw.changeme.nbtapi.NBTItem;
import de.tr7zw.changeme.nbtapi.NBT;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.inventory.InventoryHolder;
Expand Down Expand Up @@ -66,7 +66,8 @@ public static int getApproximateByteSize(@Nullable ItemStack itemStack, boolean
if (MaterialUtil.TEXT_BOOKS.contains(itemStack.getType())) {
return getApproximateByteSize((BookMeta) itemStack.getItemMeta(), utf16);
}
return new NBTItem(itemStack).toString().getBytes(utf16 ? StandardCharsets.UTF_16 : StandardCharsets.UTF_8).length;
return NBT.get(itemStack, itemNBT ->
itemNBT.toString().getBytes(utf16 ? StandardCharsets.UTF_16 : StandardCharsets.UTF_8).length);
}

public static int getApproximateByteSize(@Nullable Iterable<ItemStack> inventory, boolean utf16) {
Expand Down

0 comments on commit f642674

Please sign in to comment.