Solved Block #setType() not work

Discussion in 'Plugin Development' started by 0verFull, Jun 24, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    0verFull

    Hi,

    I'm developing a new plugin in 1.10 (version : 1.10-snapshotR1), and I want to replace a block when a player break a block and for this I use Block#setType(Material.GLASS) but It's work randomly. Sometime block become Glass, but sometime the block stay air. I have try to replace Block#setType() by Bukkit.dispatchCommand(...) with the "/setblock" command and the block change randomly to.

    I need help.

    Thanks for all next replies.
     
  2. Offline

    I Al Istannen

    @0verFull
    The BlockBreakEvent is triggered before the block is replaced. Try either cancelleing the event and setting the block type with setType or scheduling the replace code to run a tick later.

    If that doesn't work, I would like to know if there are any console errors and your code :)
     
  3. Offline

    0verFull

    Thanks, it work. It's very strange because in 1.9 It work without scheduling.
     
  4. Offline

    I Al Istannen

    @0verFull
    If this is solved, please mark it as such using the Thread Tools and then Edit Title at the top right of your first post.

    Good luck with your project :)
     
Thread Status:
Not open for further replies.

Share This Page