NoHopper

Removes the Hoppper Recipe
 avatar
unknown
java
2 months ago
814 B
3
Indexable
public class NoHopperCraft extends JavaPlugin implements Listener {

    @Override
    public void onEnable() {
        Bukkit.getPluginManager().registerEvents(this, this);
        removeHopperRecipe();
    }

    private void removeHopperRecipe() {
        NamespacedKey hopperKey = NamespacedKey.minecraft("hopper");
        Recipe recipe = Bukkit.getRecipe(hopperKey);
        if (recipe != null) {
            Bukkit.removeRecipe(hopperKey);
            getLogger().info("Hopper crafting recipe removed.");
        }
    }

    @EventHandler
    public void onPrepareItemCraft(PrepareItemCraftEvent event) {
        if (event.getInventory().getResult() != null && 
            event.getInventory().getResult().getType() == Material.HOPPER) {
            event.getInventory().setResult(null);
        }
    }
}
Leave a Comment