From 99c52d3c313ffb8d0f41d79565130116e54b5c4c Mon Sep 17 00:00:00 2001 From: Rosenthalk0 Date: Sun, 14 May 2023 18:37:00 -0500 Subject: [PATCH] Fix Smithing Table to use 'CRAFT' permission system! --- .../net/Indyuce/mmoitems/listener/DisableInteractions.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/MMOItems-Dist/src/main/java/net/Indyuce/mmoitems/listener/DisableInteractions.java b/MMOItems-Dist/src/main/java/net/Indyuce/mmoitems/listener/DisableInteractions.java index bf73c4d4..3b21f4b5 100644 --- a/MMOItems-Dist/src/main/java/net/Indyuce/mmoitems/listener/DisableInteractions.java +++ b/MMOItems-Dist/src/main/java/net/Indyuce/mmoitems/listener/DisableInteractions.java @@ -8,7 +8,6 @@ import org.bukkit.Keyed; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; -import org.bukkit.event.Event; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; @@ -65,6 +64,12 @@ public class DisableInteractions implements Listener { if (inv == null || inv.getType() != InventoryType.SMITHING || event.getSlotType() != SlotType.RESULT) return; + ItemStack currentItem = event.getCurrentItem(); + if (currentItem != null){ + String craftingPerm = NBTItem.get(event.getCurrentItem()).getString("MMOITEMS_CRAFT_PERMISSION"); + if (!craftingPerm.isEmpty() && !event.getWhoClicked().hasPermission(craftingPerm)) + event.setCancelled(true); + } if (isDisabled(NBTItem.get(inv.getItem(0)), "smith") || isDisabled(NBTItem.get(inv.getItem(1)), "smith")) event.setCancelled(true); }