Help with setting a monster spawners entity type

Discussion in 'Spigot Help' started by ZachThePwn, Jul 3, 2018.

  1. Im trying to set a monster spawn so that it spawns one of my custom mobs. Currently I have this code that I put together through what i knew and some googlejobs and it does not even change the spawner to a zombie, and just keeps it as pigs. Does anyone know whats wrong with it or how to fix it? There are no errors in console or in the code.

    Code (Text):
        public void setSpawner(Block block, EntityType entity) {
                BlockState blockState = block.getState();
                CreatureSpawner spawner = ((CreatureSpawner) blockState);
        public void onSpawnerPlace(BlockPlaceEvent event) {
            Block block = event.getBlockPlaced();
            ItemStack hand = event.getPlayer().getInventory().getItemInMainHand();
            if (block != null && hand != null) {
                if (block.getType() == Material.MOB_SPAWNER && hand.getType() == Material.MOB_SPAWNER) {
                    ItemMeta handmeta = hand.getItemMeta();
                    if (handmeta.getDisplayName().equals(ChatColor.stripColor("Tier 1 Zombie"))) {
                        setSpawner(block, EntityType.ZOMBIE);