mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-01-02 06:27:42 +01:00
tested and fixed!
This commit is contained in:
parent
99c52d3c31
commit
743bcc2a98
@ -8,6 +8,7 @@ import io.lumine.mythic.lib.api.crafting.recipes.ShapelessRecipe;
|
||||
import io.lumine.mythic.lib.api.crafting.uimanager.ProvidedUIFilter;
|
||||
import io.lumine.mythic.lib.api.util.Ref;
|
||||
import io.lumine.mythic.lib.api.util.ui.FriendlyFeedbackProvider;
|
||||
fiimport net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.api.crafting.recipe.CustomSmithingRecipe;
|
||||
import net.Indyuce.mmoitems.api.crafting.recipe.SmithingCombinationType;
|
||||
import net.Indyuce.mmoitems.api.item.template.MMOItemTemplate;
|
||||
@ -17,6 +18,8 @@ import net.Indyuce.mmoitems.gui.edition.recipe.interpreter.RMGRI_Smithing;
|
||||
import net.Indyuce.mmoitems.gui.edition.recipe.rba.*;
|
||||
import net.Indyuce.mmoitems.gui.edition.recipe.gui.RMG_Smithing;
|
||||
import net.Indyuce.mmoitems.gui.edition.recipe.gui.RecipeMakerGUI;
|
||||
import net.Indyuce.mmoitems.stat.data.StringData;
|
||||
import net.Indyuce.mmoitems.stat.data.random.RandomStatData;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
@ -97,6 +100,15 @@ public class RMGRR_Smithing implements RecipeRegistry {
|
||||
MythicRecipeBlueprint ret = new MythicRecipeBlueprint(inputItem, outputRecipe, nk);
|
||||
ret.addSideCheck("ingot", inputIngot);
|
||||
|
||||
RandomStatData perm = template.getBaseItemData().get(ItemStats.CRAFT_PERMISSION);
|
||||
if (perm instanceof StringData) {
|
||||
|
||||
// Ah yes
|
||||
String permission = ((StringData) perm).getString();
|
||||
|
||||
// Finally
|
||||
if (permission != null) { ret.addRequiredPermission(permission); } }
|
||||
|
||||
// Enable it
|
||||
ret.deploy(MythicRecipeStation.SMITHING, namespace);
|
||||
|
||||
|
@ -55,21 +55,17 @@ public class DisableInteractions implements Listener {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void smithingTableInteractions(InventoryClickEvent event) {
|
||||
if (MythicLib.plugin.getVersion().isBelowOrEqual(1, 15))
|
||||
return;
|
||||
|
||||
Inventory inv = event.getClickedInventory();
|
||||
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user