mirror of
https://github.com/kiranhart/Auction-House.git
synced 2024-11-25 05:55:13 +01:00
⚒️ fix ItemStack can't be null/air/amount of 0! for anvils
Took 4 minutes
This commit is contained in:
parent
961eee800e
commit
13708c8ab4
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user