Skip to content

Commit

Permalink
don't fetch item meta, since we call container directly from the item…
Browse files Browse the repository at this point in the history
…stack
  • Loading branch information
ryderbelserion committed Oct 22, 2024
1 parent 1d06fca commit 3c7d7c3
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
import com.badbones69.crazyvouchers.api.enums.PersistentKeys;
import com.badbones69.crazyvouchers.api.objects.Voucher;
import com.badbones69.crazyvouchers.api.objects.other.ItemBuilder;
import io.papermc.paper.persistence.PersistentDataContainerView;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.SoundCategory;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.persistence.PersistentDataType;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
Expand Down Expand Up @@ -64,9 +64,7 @@ public void run(InventoryClickEvent event) {

if (item == null || item.getType() == Material.AIR) return;

if (!item.hasItemMeta()) return;

final PersistentDataContainer container = item.getItemMeta().getPersistentDataContainer();
final PersistentDataContainerView container = item.getPersistentDataContainer();

if (container.has(PersistentKeys.back_button.getNamespacedKey())) {
player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_XYLOPHONE, SoundCategory.PLAYERS, 1F, 1F);
Expand Down

0 comments on commit 3c7d7c3

Please sign in to comment.