Solved Adding the CanPlaceOn to an item?!

Discussion in 'Plugin Development' started by mcrazmouze, Aug 27, 2016.

Thread Status:
Not open for further replies.
  1. I have this:
    ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
    SkullMeta meta = (SkullMeta) skull.getItemMeta();
    meta.setDisplayName(ChatColor.GOLD + "TNT Piece 1/8");
    So i wanna do so this item can't be placed..? HELP!

    Please keep in mind i'm new to Java
  2. Offline


    1. BlockPlaceEvent
    2. If the block that was placed is equal to this item.
    3. cancel the event.
  3. Can't i just add the NBT-Tag somehow?
  4. Offline


    You can, but you will then also need to check for that tag in the BlockPlaceEvent.
  5. I do believe he means this NBT tag, which regulates which blocks you can place the block on. However, you would need to be in adventure mode for it to have effect.
Thread Status:
Not open for further replies.

Share This Page