ricsi0663

minecraft plugin that blocks the crafting of the crafter block

Kodari AI
KodariApr 7 at 11:06 am 4,272 (v2)

I’ll create a simple plugin that prevents players from crafting the crafter block.

CrafterBlocker
A lightweight plugin that blocks players from crafting the crafter block introduced in Minecraft 1.21. Features include configurable block messages, automatic recipe detection, and optional debug logging. Prevents automation chains by restricting access to the crafter block while maintaining normal gameplay for other recipes.

Project created! The CrafterBlocker plugin prevents players from crafting the crafter block with the following features:

  • Blocks crafter crafting: Intercepts crafting attempts and cancels them

  • Configurable message: Customizable denial message in config.yml

  • Bypass permission: crafterblocker.bypass allows specific players to craft it

  • Reload command: /crafterblocker reload to reload config without restart

  • Debug mode: Optional logging for troubleshooting

  • Version compatible: Uses XSeries to work across Minecraft versions

The plugin listens to PrepareItemCraftEvent and sets the result to null when detecting a crafter block, effectively preventing the craft from completing.

Kodari can make mistakes. Review important code before using.
Files
src
.gitignore
build.gradle
settings.gradle
Code
9 238
src/main/java/com/crafterblocker/CrafterBlocker.java
package com.crafterblocker;

import com.crafterblocker.listener.CraftListener;
import com.crafterblocker.manager.ConfigManager;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public final class CrafterBlocker extends JavaPlugin {

    private ConfigManager configManager;

    @Override
    public void onEnable() {
        this.configManager = new ConfigManager(this);
        
        getServer().getPluginManager().registerEvents(new CraftListener(this), this);
        
        if (getCommand("crafterblocker") != null) {
            getCommand("crafterblocker").setExecutor(new ReloadCommand(this));
        }
        
        getLogger().info("CrafterBlocker has been enabled!");
    }

    @Override
    public void onDisable() {
        getLogger().info("CrafterBlocker has been disabled!");
    }
}