Solved Item entity XXX has no item?!

Discussion in 'Bukkit Help' started by dNiym, Dec 15, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    dNiym

    I spent quite a while trying to research the cause of this and I have a solution. If your server is getting spammed with this error and you have a plugin that drops custom / random items here's the solution:

    1) This problem can be caused by a plugin trying to spawn a non-spawnable item stack. IE a plugin tries to spawn Material.wall_sign or Material.melon_stem (there are a BUNCH more) these are items that players aren't "allowed" to hold thus they become invalid and typically get rendered as smooth stone when they are actually dropped in the world.
    2) Every time one of these non-spawnable items gets "dropped" in the world it will cause this error at least once. Often times it will constantly spam until the offending item is picked up and /clear is run on the player holding the item.

    To fix a plugin that is spawning illegal items add this bit of code:

    You must have essentials installed and the plugin will need to hook essentials.

    Code:
           
    ItemStack is = new ItemStack(Material_To_Spawn);
    
              MetaItemStack metaStack = new MetaItemStack(is);
               if(!metaStack.canSpawn(yourPlugin.getES()))  {
                 //System.out.println("Unspawnable item: " + is.getType().name());
                //do whatever they you need to do here, eg: return/continue/break etc.
                }
     
    Last edited: Dec 15, 2015
Thread Status:
Not open for further replies.

Share This Page