⚒️ fix ItemStack can't be null/air/amount of 0! for anvils

Took 4 minutes
This commit is contained in:
Kiran Hart 2023-08-19 16:20:54 -04:00
parent 961eee800e
commit 13708c8ab4
No known key found for this signature in database
GPG Key ID: 5F36C7BC79D3EBC3
2 changed files with 4 additions and 3 deletions

View File

@ -18,8 +18,9 @@
package ca.tweetzy.auctionhouse.listeners;
import com.Zrips.CMI.events.CMIAnvilItemRepairEvent;
import ca.tweetzy.core.compatibility.XMaterial;
import ca.tweetzy.flight.nbtapi.NBT;
import com.Zrips.CMI.events.CMIAnvilItemRepairEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
@ -35,7 +36,7 @@ public final class CMIListener implements Listener {
@EventHandler
public void onCMIRepair(CMIAnvilItemRepairEvent event) {
ItemStack stack = event.getItemTo();
if (stack == null) return;
if (stack == null || stack.getType() == XMaterial.AIR.parseMaterial() || stack.getAmount() == 0) return;
NBT.modify(stack, nbt -> {
nbt.setBoolean("AuctionHouseRepaired", true);

View File

@ -191,7 +191,7 @@ public class PlayerListeners implements Listener {
@EventHandler
public void onInventoryClick(PrepareAnvilEvent event) {
ItemStack stack = event.getResult();
if (stack == null) return;
if (stack == null || stack.getType() == XMaterial.AIR.parseMaterial() || stack.getAmount() == 0) return;
NBT.modify(stack, nbt -> {
nbt.setBoolean("AuctionHouseRepaired", true);