mirror of
https://github.com/kiranhart/Auction-House.git
synced 2024-12-01 06:53:23 +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;
|
package ca.tweetzy.auctionhouse.listeners;
|
||||||
|
|
||||||
import com.Zrips.CMI.events.CMIAnvilItemRepairEvent;
|
import ca.tweetzy.core.compatibility.XMaterial;
|
||||||
import ca.tweetzy.flight.nbtapi.NBT;
|
import ca.tweetzy.flight.nbtapi.NBT;
|
||||||
|
import com.Zrips.CMI.events.CMIAnvilItemRepairEvent;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -35,7 +36,7 @@ public final class CMIListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onCMIRepair(CMIAnvilItemRepairEvent event) {
|
public void onCMIRepair(CMIAnvilItemRepairEvent event) {
|
||||||
ItemStack stack = event.getItemTo();
|
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.modify(stack, nbt -> {
|
||||||
nbt.setBoolean("AuctionHouseRepaired", true);
|
nbt.setBoolean("AuctionHouseRepaired", true);
|
||||||
|
@ -191,7 +191,7 @@ public class PlayerListeners implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInventoryClick(PrepareAnvilEvent event) {
|
public void onInventoryClick(PrepareAnvilEvent event) {
|
||||||
ItemStack stack = event.getResult();
|
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.modify(stack, nbt -> {
|
||||||
nbt.setBoolean("AuctionHouseRepaired", true);
|
nbt.setBoolean("AuctionHouseRepaired", true);
|
||||||
|
Loading…
Reference in New Issue
Block a user