Solved BlockBreakEvent block type returns AIR when breaking SPAWNER

Discussion in 'Spigot Plugin Development' started by ajgeiss0702, Jan 14, 2020.

  1. Hello,

    I am having an issue where when I break a spawner, e.getBlock().getType() returns AIR instead of SPAWNER.

    Here is a snippet of my code:

    Code (Java):
    @EventHandler(priority = EventPriority.LOWEST)
    public void onPlayerBreakBlock(BlockBreakEvent e) {
         
        String block = e.getBlock().getType().toString();
        e.getPlayer().sendMessage(block);

    }
    For the EventPriority, I have tried both LOWEST and MONITOR. They gave the same result both times.

    Thank you in advance.
     
    #1 ajgeiss0702, Jan 14, 2020
    Last edited: Jan 14, 2020
  2. md_5

    Administrator Developer

    Did you set api-version?
     
  3. No, I didn't. Setting it fixed it. Thank you!