Type of skull placed?

Discussion in 'Spigot Plugin Development' started by Inkzzz, Jun 15, 2015.

  1. Inkzzz

    Resource Staff

    Dear,
    I'm trying to check if the type of skull placed is a wither skull, if so, it cancels it, but it's not working. The event is registered, but my code isn't working?

    Code:
    Code (Text):
        @EventHandler
        public void onBlockPlace(BlockPlaceEvent e) {
            Player p = e.getPlayer();
            Material m = e.getBlock().getType();
         
            if (m == Material.SKULL_ITEM) {
                Skull sk = (Skull) e.getBlock().getState();
                if (sk.getSkullType() == SkullType.WITHER) {
                    e.setCancelled(true);

                }
            }
        }
    Thanks
     
  2. maybe get the ItemID and Data. Just cancel the event if the item with the id X:X was placed