[SOLVED] Help with passing REDSTONE_ORE to BlockDamageEvent

Discussion in 'Spigot Plugin Development' started by GODofCRAFTERS, May 17, 2015.

  1. I am having issues with breaking REDSTONE_ORE. Here's what I'm trying to do.

    Somewhere in my PlayerInteractEvent, I type:
    Bukkit.getServer().getPluginManager().callEvent(new BlockDamageEvent(event.getPlayer(), event.getClickedBlock(), event.getItem(), true));

    Then in my BlockDamageEvent, I type:
    event.setInstaBreak(true);

    But it doesn't work. No errors, it just doesn't pass to the code. I think this is because REDSTONE_ORE has two states and when the block is passed it has one state, but then when a new event is called, the block gets a different state as it was hit. Please help!
     
  2. So when i tried to make Redstone ore break instantly it worked.

    What is the setBreakInstantly?

    What are you trying to accomplish?
     
    #2 sleepipanda, May 17, 2015
    Last edited: May 17, 2015
  3. If you're having the same issue I think I can help. If you are doing something based on whether the block is REDSTONE_ORE after hitting the block, keep in mind that the block gets activated, which means it's glowing. The correct name for it GLOWING_REDSTONE_ORE. So make sure you're checking for that material if you know a PlayerInteractEvent has activated the REDSTONE_ORE.
     
  4. proceeding to facepalm... Firing events doesn't do anything on it's own, you need to act upon the result of the event. Or just set the block to AIR on player interact.
     
  5. Ummm. @DarkSeraphim, I did exactly that. I just didn't post the full code here. It was unrelated. Anyways, I solved my issue. And if you were dealing with someone who indeed didn't know what you said, then you should be a little more less attitude-ish, just saying, Up to you to take the advice. Thanks for your input though, I guess.