From 4f1c55c29936d01c10831344e9cc3aa3ae956648 Mon Sep 17 00:00:00 2001 From: PikaMug <2267126+PikaMug@users.noreply.github.com> Date: Mon, 21 Jun 2021 22:52:25 -0400 Subject: [PATCH] Disallow uncraftable items in trial mode --- .../quests/convo/generic/ItemStackPrompt.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main/src/main/java/me/blackvein/quests/convo/generic/ItemStackPrompt.java b/main/src/main/java/me/blackvein/quests/convo/generic/ItemStackPrompt.java index 207fc8ee7..09f87a24b 100644 --- a/main/src/main/java/me/blackvein/quests/convo/generic/ItemStackPrompt.java +++ b/main/src/main/java/me/blackvein/quests/convo/generic/ItemStackPrompt.java @@ -21,6 +21,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import me.blackvein.quests.Quests; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -462,6 +463,15 @@ public class ItemStackPrompt extends QuestsEditorNumericPrompt { context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidName")); return new ItemNamePrompt(context); } else { + if (context.getPlugin() instanceof Quests) { + final Quests plugin = (Quests)context.getPlugin(); + if (plugin.hasLimitedAccess(context.getForWhom())) { + if (plugin.getServer().getRecipesFor(new ItemStack(mat)).isEmpty()) { + context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("noPermission")); + return new ItemStackPrompt(context, oldPrompt); + } + } + } context.setSessionData("tempName", mat.name()); context.setSessionData("tempAmount", 1); return new ItemStackPrompt(context, oldPrompt);