package com.minetexas.nodroppingoffline;

import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;

import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
import com.comphenix.protocol.events.ListenerPriority;
import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketEvent;
import com.minetexas.util.MTLog;

public class NoDroppingOffline extends JavaPlugin {
	private ProtocolManager protocolManager;

	@Override
	public void onEnable() {
		MTLog.init(this);
		MTLog.info("Enabled");
		final PluginManager pluginManager = getServer().getPluginManager();
		pluginManager.registerEvents(new DropListener(), this);
	    protocolManager = ProtocolLibrary.getProtocolManager();
	    protocolManager.addPacketListener(
	    		  new PacketAdapter(this, ListenerPriority.NORMAL, 
	    		          PacketType.Play.Client.AUTO_RECIPE) {
	    		    @Override
	    		    public void onPacketReceiving(PacketEvent event) {
	    		        // Item packets (id: 0x29)
	    		        if (event.getPacketType() == 
	    		                PacketType.Play.Client.AUTO_RECIPE ) {
	    		            event.setCancelled(true);
	    		        }
	    		    }
	    		});

	}
	
	
	@Override
	public void onDisable() {
		MTLog.info("Disabled");
	}

	
	public boolean hasPlugin(String name) {
		Plugin p;
		p = getServer().getPluginManager().getPlugin(name);
		return (p != null);
	}
	
}

@@ -1275,16 +1275,320 @@
 (true);%0A
+                                    // Instead of sending a transaction packet, we can do this instead!%0A                                    // (I couldn't get sending a transaction packet with false, this this will have to do :( )%0A                                    event.getPlayer().updateInventory();%0A
 %09    %09%09 

Update the players inventory after cancelling the transaction from recipe books