org.MachinaBanItem.ThePrometeus
    Main.class
    package org.MachinaBanItem.ThePrometeus;

import org.bukkit.plugin.java.*;
import org.bukkit.event.*;
import org.bukkit.inventory.*;
import org.bukkit.*;
import org.MachinaBanItem.ThePrometeus.Listeners.*;
import java.util.logging.*;
import org.bukkit.plugin.*;
import org.bukkit.command.*;
import org.bukkit.entity.*;
import java.util.*;

public class Main extends JavaPlugin implements Listener
{
    public static List<String> blockedCraftItems;
    public static Map<String, String> blockedUseItems;
    public static Boolean debug;
    
    public static boolean canUseItem(final ItemStack i, final World w) {
        final String it = i.getTypeId() + ":" + i.getData().getData();
        final String itId = Integer.toString(i.getTypeId()) + ":-1";
        final String wn = (w == null) ? "global" : (w.getName() + "|");
        return ((Main.blockedUseItems.containsKey(it) || Main.blockedUseItems.containsKey(itId)) && ("global".equals(wn) || "global".equals(Main.blockedUseItems.get(it)) || (Main.blockedUseItems.containsKey(it) && Main.blockedUseItems.get(it).contains(wn)) || (Main.blockedUseItems.containsKey(itId) && Main.blockedUseItems.get(itId).contains(wn)))) || canCraftItem(i);
    }
    
    public static boolean canCraftItem(final ItemStack i) {
        return Main.blockedCraftItems.contains(i.getTypeId() + ":" + i.getData().getData()) || Main.blockedCraftItems.contains(i.getTypeId() + ":-1");
    }
    
    public void onEnable() {
        final PluginManager pm = this.getServer().getPluginManager();
        try {
            pm.registerEvents((Listener)this, (Plugin)this);
            pm.registerEvents((Listener)new VanillaListener(this), (Plugin)this);
        }
        catch (Exception ex) {
            this.getPluginLoader().disablePlugin((Plugin)this);
            this.getLogger().info("An error ocurred registering plugin events. Plugin disabled.");
        }
        this.getCommand("mbi").setExecutor((CommandExecutor)this);
        this.SetDefaults();
        this.ReadConfig();
        this.getLogger().log(Level.INFO, "MachinaBanItem v{0} on!", this.getDescription().getVersion());
    }
    
    public void onDisable() {
        this.getLogger().log(Level.INFO, "MachinaBanItem v{0} off!", this.getDescription().getVersion());
    }
    
    public void SetDefaults() {
        this.getConfig().addDefault("BlackList", (Object)Main.blockedCraftItems);
        this.getConfig().addDefault("Messages.cantCraft", (Object)"You can't craft this item, because it's banned.");
        this.getConfig().addDefault("Messages.cantUse", (Object)"You can't use this item, because it's banned.");
        this.getConfig().addDefault("Messages.cantDrop", (Object)"You can't drop / get this item, because it's banned.");
        this.getConfig().options().copyDefaults(true);
        this.saveConfig();
    }
    
    public void ReadConfig() {
        Main.blockedUseItems.clear();
        Main.blockedCraftItems.clear();
        Strings.cantCraft = Utils.fixAccents(this.getConfig().getString("Messages.cantCraft"));
        Strings.cantUse = Utils.fixAccents(this.getConfig().getString("Messages.cantUse"));
        Strings.cantDrop = Utils.fixAccents(this.getConfig().getString("Messages.cantDrop"));
        for (final String i : this.getConfig().getStringList("BlackList")) {
            final String[] item = i.split(";");
            if (item.length == 2 || "both".equals(item[1])) {
                Main.blockedUseItems.put(item[0], "global");
                Main.blockedCraftItems.add(item[0]);
            }
            else if ("use".equals(item[1])) {
                Main.blockedUseItems.put(item[0], item[2]);
            }
            else {
                if (!"craft".equals(item[1])) {
                    continue;
                }
                Main.blockedCraftItems.add(item[0]);
            }
        }
        this.getLogger().log(Level.INFO, "{0} items banned from craft", Main.blockedCraftItems.size());
        this.getLogger().log(Level.INFO, "{0} items banned from use", Main.blockedUseItems.size());
    }
    
    public boolean onCommand(final CommandSender s, final Command cmd, final String label, final String[] args) {
        final Player p = (Player)s;
        if (!cmd.getName().equalsIgnoreCase("mbi")) {
            return false;
        }
        if (!p.isOp() || !p.hasPermission("machinabanitem.admin")) {
            p.sendMessage(Strings.prefix + "You don't have permission to do that.");
            return true;
        }
        if (args.length == 0) {
            p.sendMessage(Strings.prefix + "/mbi reload - Reload configuration");
            p.sendMessage(Strings.prefix + "/mbi ban [action] [world] - Ban item in hand");
            return true;
        }
        final String s2 = args[0];
        switch (s2) {
            case "reload": {
                this.reloadConfig();
                this.ReadConfig();
                p.sendMessage(Strings.prefix + Utils.fixAccents("Configuration reloaded."));
                break;
            }
            case "ban": {
                final ItemStack i = p.getItemInHand();
                String w = "global";
                String o = "both";
                if (args.length == 1) {
                    w = "global";
                    o = "both";
                }
                else if (args.length == 2) {
                    o = args[1];
                    w = "global";
                }
                else if (args.length >= 3) {
                    o = args[1];
                    w = args[2] + "|";
                }
                if ("both".equals(o) || "use".equals(o)) {
                    Main.blockedUseItems.put(i.getType().getId() + ":" + i.getData().getData(), w);
                }
                if ("both".equals(o) || "craft".equals(o)) {
                    Main.blockedCraftItems.add(i.getType().getId() + ":" + i.getData().getData());
                }
                final List b = this.getConfig().getStringList("BlackList");
                b.add(i.getType().getId() + ":" + i.getData().getData() + ";" + o + ";" + w);
                this.getConfig().set("BlackList", (Object)b);
                this.saveConfig();
                p.sendMessage(Strings.prefix + "Item banned by '" + o + "' on world '" + w + "'");
                break;
            }
            default: {
                p.sendMessage(Strings.prefix + "Command not found.");
                break;
            }
        }
        return true;
    }
    
    static {
        Main.blockedCraftItems = new ArrayList<String>();
        Main.blockedUseItems = new HashMap<String, String>();
        Main.debug = true;
    }
}

        Strings.class
        package org.MachinaBanItem.ThePrometeus;

import org.bukkit.*;

public class Strings
{
    public static final String prefix;
    public static String cantUse;
    public static String cantCraft;
    public static String cantDrop;
    
    static {
        prefix = ChatColor.RED + "" + ChatColor.BOLD + "[BanItem] " + ChatColor.LIGHT_PURPLE;
    }
}

            Utils.class
            package org.MachinaBanItem.ThePrometeus;

import java.util.*;

public class Utils
{
    private static final Map<String, String> accents;
    
    public static String fixAccents(String m) {
        for (final Map.Entry<String, String> entry : Utils.accents.entrySet()) {
            m = m.replace(entry.getKey(), entry.getValue());
        }
        return m;
    }
    
    static {
        accents = new HashMap<String, String>() {
            {
                this.put("\u00e1", "\u00e1");
                this.put("\u00e0", "\u00e0");
                this.put("\u00e2", "\u00e2");
                this.put("\u00e3", "\u00e3");
                this.put("\u00e4", "\u00e4");
                this.put("\u00c1", "\u00c1");
                this.put("\u00c0", "\u00c0");
                this.put("\u00c2", "\u00c2");
                this.put("\u00c3", "\u00c3");
                this.put("\u00c4", "\u00c4");
                this.put("\u00e9", "\u00e9");
                this.put("\u00e8", "\u00e8");
                this.put("\u00ea", "\u00ea");
                this.put("\u00ea", "\u00ea");
                this.put("\u00c9", "\u00c9");
                this.put("\u00c8", "\u00c8");
                this.put("\u00ca", "\u00ca");
                this.put("\u00cb", "\u00cb");
                this.put("\u00ed", "\u00ed");
                this.put("\u00ec", "\u00ec");
                this.put("\u00ee", "\u00ee");
                this.put("\u00ef", "\u00ef");
                this.put("\u00cd", "\u00cd");
                this.put("\u00cc", "\u00cc");
                this.put("\u00ce", "\u00ce");
                this.put("\u00cf", "\u00cf");
                this.put("\u00f3", "\u00f3");
                this.put("\u00f2", "\u00f2");
                this.put("\u00f4", "\u00f4");
                this.put("\u00f5", "\u00f5");
                this.put("\u00f6", "\u00f6");
                this.put("\u00d3", "\u00d3");
                this.put("\u00d2", "\u00d2");
                this.put("\u00d4", "\u00d4");
                this.put("\u00d5", "\u00d5");
                this.put("\u00d6", "\u00d6");
                this.put("\u00fa", "\u00fa");
                this.put("\u00f9", "\u00f9");
                this.put("\u00fb", "\u00fb");
                this.put("\u00fc", "\u00fc");
                this.put("\u00da", "\u00da");
                this.put("\u00d9", "\u00d9");
                this.put("\u00db", "\u00db");
                this.put("\u00e7", "\u00e7");
                this.put("\u00c7", "\u00c7");
                this.put("\u00f1", "\u00f1");
                this.put("\u00d1", "\u00d1");
            }
        };
    }
}

                org.MachinaBanItem.ThePrometus.Listener
            VanillaListener.class
                    `            package org.MachinaBanItem.ThePrometeus.Listeners;

import org.MachinaBanItem.ThePrometeus.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
import org.bukkit.event.player.*;
import org.bukkit.event.inventory.*;
import org.bukkit.*;
import org.bukkit.inventory.*;

public class VanillaListener implements Listener
{
    private final Main m;
    
    public VanillaListener(final Main aThis) {
        this.m = aThis;
    }
    
    @EventHandler(priority = EventPriority.MONITOR)
    public void onPlayerInteract(final PlayerInteractEvent e) {
        final Player p = e.getPlayer();
        if ((p.isOp() || p.hasPermission("machinabanitem.bypass") || p.hasPermission("machinabanitem.admin")) && !Main.debug) {
            return;
        }
        if (p.getItemInHand().getTypeId() != 0 && (e.hasItem() || e.hasBlock()) && Main.canUseItem(p.getItemInHand(), p.getWorld())) {
            e.setCancelled(true);
            p.sendMessage(Strings.prefix + Strings.cantUse);
        }
    }
    
    @EventHandler(priority = EventPriority.MONITOR)
    public void onPlayerPickupItem(final PlayerPickupItemEvent e) {
        final Player p = e.getPlayer();
        if ((p.isOp() || p.hasPermission("machinabanitem.bypass") || p.hasPermission("machinabanitem.admin")) && !Main.debug) {
            return;
        }
        if (Main.canUseItem(e.getItem().getItemStack(), p.getWorld())) {
            e.setCancelled(true);
            p.sendMessage(Strings.prefix + Strings.cantDrop);
        }
    }
    
    @EventHandler(priority = EventPriority.MONITOR)
    public void onPlayerDropItem(final PlayerDropItemEvent e) {
        final Player p = e.getPlayer();
        if ((p.isOp() || p.hasPermission("machinabanitem.bypass") || p.hasPermission("machinabanitem.admin")) && !Main.debug) {
            return;
        }
        if (Main.canUseItem(e.getItemDrop().getItemStack(), p.getWorld())) {
            e.setCancelled(true);
            p.sendMessage(Strings.prefix + Strings.cantDrop);
            e.getItemDrop().remove();
        }
    }
    
    @EventHandler(priority = EventPriority.MONITOR)
    public void onCraftItem(final CraftItemEvent e) {
        if (!(e.getWhoClicked() instanceof Player)) {
            return;
        }
        final Player p = (Player)e.getWhoClicked();
        if ((p.isOp() || p.hasPermission("machinabanitem.bypass") || p.hasPermission("machinabanitem.admin")) && !Main.debug) {
            return;
        }
        if (Main.canCraftItem(e.getCurrentItem())) {
            e.setCancelled(true);
            e.setCurrentItem(new ItemStack(Material.AIR));
            if (e.getWhoClicked() instanceof Player) {
                p.sendMessage(Strings.prefix + Strings.cantCraft);
            }
        }
    }
}

plugin.yml
            name: MachinaBanItem
main: org.MachinaBanItem.ThePrometeus.Main
version: 1.1

commands:
    mbi:
        usage: /mbi
        aliases: [mbanitem, machinabanitem]
        description: Machina Ban Item Command