From 62169d8fa8389c6bdd99f6f52ea02ac2d962b61f Mon Sep 17 00:00:00 2001 From: sjavi4 <72385460+sjavi4@users.noreply.github.com> Date: Wed, 6 Dec 2023 17:03:21 +0800 Subject: [PATCH] 1.3 --- pom.xml | 2 +- src/main/java/me/autobot/sbcrafter/listener/OnCraft.java | 1 - src/main/java/me/autobot/sbcrafter/listener/PostCraft.java | 7 +++++++ .../java/me/autobot/sbcrafter/utility/RecipeHandler.java | 2 +- src/main/resources/plugin.yml | 2 +- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index ef71c10..c3fb769 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ me.autobot SBCrafter - 1.2 + 1.3 jar SBCrafter diff --git a/src/main/java/me/autobot/sbcrafter/listener/OnCraft.java b/src/main/java/me/autobot/sbcrafter/listener/OnCraft.java index 662b49e..5ff6409 100644 --- a/src/main/java/me/autobot/sbcrafter/listener/OnCraft.java +++ b/src/main/java/me/autobot/sbcrafter/listener/OnCraft.java @@ -15,7 +15,6 @@ import java.util.*; public class OnCraft implements Listener { - final Set recipeKeys = new HashSet<>(); RecipeHandler recipeHandler; ItemStack resultBox; ItemStack resultContent; diff --git a/src/main/java/me/autobot/sbcrafter/listener/PostCraft.java b/src/main/java/me/autobot/sbcrafter/listener/PostCraft.java index ca5ae74..8100dfb 100644 --- a/src/main/java/me/autobot/sbcrafter/listener/PostCraft.java +++ b/src/main/java/me/autobot/sbcrafter/listener/PostCraft.java @@ -9,6 +9,8 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.inventory.CraftItemEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryType; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.Recipe; import org.bukkit.plugin.Plugin; @@ -26,6 +28,11 @@ public void onCraft(CraftItemEvent e) { if (recipe == null) return; if (recipeHandler.getRecipe() == null) return; + + if (e.getCursor().getType() != Material.AIR && !e.isShiftClick()) { + //e.setCancelled(true); + return; + }; ItemStack resultContent = recipeHandler.getRecipe().getResult(); List matrixContents = recipeHandler.getMatrixContentsList(); diff --git a/src/main/java/me/autobot/sbcrafter/utility/RecipeHandler.java b/src/main/java/me/autobot/sbcrafter/utility/RecipeHandler.java index 5f14cfe..4b3ea29 100644 --- a/src/main/java/me/autobot/sbcrafter/utility/RecipeHandler.java +++ b/src/main/java/me/autobot/sbcrafter/utility/RecipeHandler.java @@ -16,7 +16,7 @@ import java.lang.reflect.Method; import java.util.*; -public class RecipeHandler { +public final class RecipeHandler { CraftingInventory inventory; ItemStack[] matrix; ItemStack[] matrixContents; diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index ebe4f3b..a342a26 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: SBCrafter version: '${project.version}' -main: me.autobot.resbcrafter.ReSBCrafter +main: me.autobot.sbcrafter.SBCrafter api-version: '1.17' folia-supported: true load: POSTWORLD