9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2026-01-06 15:52:03 +00:00

Update RecipeEventListener.java

This commit is contained in:
XiaoMoMi
2025-02-14 00:18:28 +08:00
parent d8423cf137
commit 70e80e0451

View File

@@ -1,5 +1,6 @@
package net.momirealms.craftengine.bukkit.item.recipe;
import com.destroystokyo.paper.event.inventory.PrepareResultEvent;
import net.momirealms.craftengine.bukkit.plugin.BukkitCraftEngine;
import net.momirealms.craftengine.bukkit.plugin.user.BukkitServerPlayer;
import net.momirealms.craftengine.bukkit.util.ItemUtils;
@@ -51,6 +52,21 @@ public class RecipeEventListener implements Listener {
});
}
@EventHandler
public void onSpecialRecipe(PrepareItemCraftEvent event) {
org.bukkit.inventory.Recipe recipe = event.getRecipe();
if (recipe == null)
return;
if (!(recipe instanceof ComplexRecipe complexRecipe)) {
return;
}
if (ItemUtils.hasCustomItem(event.getInventory().getMatrix())) {
event.getInventory().setResult(null);
}
}
@EventHandler
public void onCrafting(PrepareItemCraftEvent event) {
org.bukkit.inventory.Recipe recipe = event.getRecipe();