title: Java "TRAP" Assertion Error
body: <p>I am writing a class for Spigot, that defines a lot of new crafting recipes. However, it seems that when I call an event, it sometime throws a <code>Assertion Error: TRAP</code>.
  I have researched a lot, and find no useful tips, or anything.</p>
  
  <p>Items.java</p>
  
  <pre><code>package com.myththewolf.omnomnom.lib;
  
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.HashMap;
  import java.util.List;
  
  import org.bukkit.Bukkit;
  import org.bukkit.Material;
  import org.bukkit.SkullType;
  import org.bukkit.inventory.ItemStack;
  import org.bukkit.inventory.ShapedRecipe;
  import org.bukkit.inventory.meta.ItemMeta;
  import org.bukkit.inventory.meta.SkullMeta;
  
  public class Items {
      private static HashMap&lt;ItemStack,Integer&gt; items = new HashMap&lt;ItemStack,Integer&gt;();
      private static List&lt;ShapedRecipe&gt; itemC = new ArrayList&lt;ShapedRecipe&gt;();
      public ItemStack setMeta(ItemStack material, String name, List&lt;String&gt; lore)
      {
          if (((material == null) || material.getType() == Material.AIR) || ((name == null &amp;&amp; lore == null)))
          {
              return null;
          }
          ItemMeta im = material.getItemMeta();
          if (name != null)
          {
              im.setDisplayName(name);
          }
          if (lore != null)
          {
              im.setLore(lore);
          }
          material.setItemMeta(im);
          return material;
      }
  
      public static void makeRecipies()
      {
  
              ItemStack skull; 
              skull = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
              SkullMeta SM; 
              SM = (SkullMeta) skull.getItemMeta();
              SM.setOwner("MHF_CHEST");
              skull.setItemMeta(SM);
          addRecipie(3, "CCC", "BAB", "CCC", skull, Material.COOKED_BEEF, Material.BREAD, Material.AIR);
          for(ShapedRecipe sr : itemC)
          {
              Bukkit.getServer().addRecipe(sr);
          }
      }
  
      public static HashMap&lt;ItemStack,Integer&gt; getItems()
      {
          return items;
      }
  
      public static void addRecipie(int hung,String patA, String patB, String patC, ItemStack out, Material a, Material b, Material c)
      {
          ShapedRecipe rec = new ShapedRecipe(out);
          rec.shape(patA,patB,patC);
          rec.setIngredient('A', a);
          rec.setIngredient('B', b);
          rec.setIngredient('C', c);
          items.put(out, hung);
          itemC.add(rec);
      }
  }
  </code></pre>
  
  <p>RightClickEvent.java</p>
  
  <pre><code>package com.myththewolf.omnomnom.event;
  
  import java.util.HashMap;
  
  import org.bukkit.Material;
  import org.bukkit.event.EventHandler;
  import org.bukkit.event.Listener;
  import org.bukkit.event.block.Action;
  import org.bukkit.event.player.PlayerInteractEvent;
  import org.bukkit.inventory.ItemStack;
  import org.bukkit.inventory.meta.ItemMeta;
  
  import com.myththewolf.omnomnom.lib.Items;
  
  public class RightClickEvent implements Listener {
      @EventHandler
  
      public void onInteractEvent(PlayerInteractEvent e)
      {
          Action a= e.getAction();
  
  
          if(a == Action.RIGHT_CLICK_BLOCK || a==  Action.RIGHT_CLICK_AIR)
          {
  
              final HashMap&lt;ItemStack,Integer&gt; items = Items.getItems();
              if(items.containsKey(e.getItem()))
              {
                  int foodL = e.getPlayer().getFoodLevel();
  
                  e.getPlayer().setFoodLevel(foodL + items.get(e.getItem()));
                  ItemStack hand = e.getPlayer().getItemInHand();
                  int amount = hand.getAmount();
                  if (amount &gt; 1) {
                      hand.setAmount(amount - 1);
                      e.getPlayer().setItemInHand(hand);
                  } else {
                      e.getPlayer().setItemInHand(new ItemStack(Material.AIR));
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>Here is the stack trace:</p>
  
  <pre><code>[22:50:18 FATAL]: Error executing task
  java.util.concurrent.ExecutionException: java.lang.AssertionError: TRAP
      at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_101]
      at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_101]
      at net.minecraft.server.v1_11_R1.SystemUtils.a(SourceFile:47) [spigot.jar:git-Spigot-f950f8e-4f47972]
      at net.minecraft.server.v1_11_R1.MinecraftServer.D(MinecraftServer.java:739) [spigot.jar:git-Spigot-f950f8e-4f47972]
      at net.minecraft.server.v1_11_R1.DedicatedServer.D(DedicatedServer.java:399) [spigot.jar:git-Spigot-f950f8e-4f47972]
      at net.minecraft.server.v1_11_R1.MinecraftServer.C(MinecraftServer.java:675) [spigot.jar:git-Spigot-f950f8e-4f47972]
      at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:574) [spigot.jar:git-Spigot-f950f8e-4f47972]
      at java.lang.Thread.run(Thread.java:745) [?:1.8.0_101]
  Caused by: java.lang.AssertionError: TRAP
      at net.minecraft.server.v1_11_R1.ItemStack.F(ItemStack.java:86) ~[spigot.jar:git-Spigot-f950f8e-4f47972]
      at net.minecraft.server.v1_11_R1.ItemStack.setCount(ItemStack.java:814) ~[spigot.jar:git-Spigot-f950f8e-4f47972]
      at net.minecraft.server.v1_11_R1.ItemStack.add(ItemStack.java:818) ~[spigot.jar:git-Spigot-f950f8e-4f47972]
      at net.minecraft.server.v1_11_R1.ItemStack.subtract(ItemStack.java:822) ~[spigot.jar:git-Spigot-f950f8e-4f47972]
      at net.minecraft.server.v1_11_R1.ItemSkull.a(ItemSkull.java:79) ~[spigot.jar:git-Spigot-f950f8e-4f47972]
      at net.minecraft.server.v1_11_R1.ItemStack.placeItem(ItemStack.java:152) ~[spigot.jar:git-Spigot-f950f8e-4f47972]
      at net.minecraft.server.v1_11_R1.PlayerInteractManager.a(PlayerInteractManager.java:491) ~[spigot.jar:git-Spigot-f950f8e-4f47972]
      at net.minecraft.server.v1_11_R1.PlayerConnection.a(PlayerConnection.java:897) ~[spigot.jar:git-Spigot-f950f8e-4f47972]
      at net.minecraft.server.v1_11_R1.PacketPlayInUseItem.a(PacketPlayInUseItem.java:37) ~[spigot.jar:git-Spigot-f950f8e-4f47972]
      at net.minecraft.server.v1_11_R1.PacketPlayInUseItem.a(PacketPlayInUseItem.java:1) ~[spigot.jar:git-Spigot-f950f8e-4f47972]
      at net.minecraft.server.v1_11_R1.PlayerConnectionUtils$1.run(SourceFile:13) ~[spigot.jar:git-Spigot-f950f8e-4f47972]
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_101]
      at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_101]
      at net.minecraft.server.v1_11_R1.SystemUtils.a(SourceFile:46) ~[spigot.jar:git-Spigot-f950f8e-4f47972]
      ... 5 more
  </code></pre>
  
  <p>What exactly IS this error?</p>
  
  <p>Did I do something wrong?</p>