1.12.2 BreakBlockEvent Not Work

Discussion in 'Spigot Plugin Development' started by OrgeAlexj06, Jul 1, 2021.

  1. Hello,
    I will want that when I break a certain block because increase my variable set to 0 base except that when I try nothing happens even though I have put the correct id of the block.

    My class :
    @EventHandler
    public void onGloriumBreak(BlockBreakEvent event) {
    Block gloriumOre = event.getBlock();
    if(gloriumOre.getType() == Material.getMaterial("FALLENGLORYMODS_GLORIUM_ORE")) {
    glorium = glorium + 1;
    }
    }

    Thanks for help me :)
     
  2. It may have to do with the material name, "FALLENGLORYMODS_GLORIUM_ORE" I don't think there is a material with that name
     
    • Like Like x 2
  3. It seems you're trying to run this on a modded server - don't know if it'll work the same...
    This forum is for Spigot - you want help with modded stuff then I suggest you go to CurseForge or something similar.
     
    • Like Like x 1
  4. Yeah. Besides, use .equals() instead of ==
     
  5. FALLENGLORYMODS_GLORIUM_ORE is mode material?
     
  6. Why? It‘s an enum.
     
    • Agree Agree x 3
  7. Im going to go on a limb and guess they're using one of those hybrid servers, and that method pulls materials from mods maybe.

    That said, if that is the case, I have no clue why they're asking for help on Spigot if they aint using Spigot.

    My guess is you didnt register your event listener.
     
  8. AFAIK Bukkit methods cannot be called for custom materials. Also, those hybrid servers are pretty buggy. There's (or was) even a bug in mohist that prevents the PlayerDeathEvent from being called -> https://github.com/MohistMC/Mohist/issues/1494