breakNaturally() dropping 2 blocks?

Discussion in 'Plugin Development' started by Satros, Mar 24, 2012.

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

    Satros

    Hello, i'm not sure if this is a bug or not, but when I use breakNaturally() it drops 2 blocks instead of 1.

    I guess I could set the block to air and use drop item instead (but then I will have to do a lot of additional work for stuff like chests which may have stuff inside), but does anyone know if this is a bukkit bug or if I am just doing it wrong?

    Code:
    getServer().getWorld("world").getBlockAt(block.getLocation()).breakNaturally();
    To test if it was just a bug in my program or if it was the function I made my onBlockBreak()
    Code:
    event.setCancelled(true);
    event.getBlock.breakNaturally();
    And it gives me 2 blocks for everything I break.

    Edit: Using the latest development build(s) of bukkit.
     
  2. Offline

    Lolmewn

    I think that's a bug from the latest dev-builds.
     
  3. Fixed in the latest update.
     
  4. Offline

    Satros

    Hmm I updated to the latest build, but it seems to still be happening on obsidian only now.

    Using this code for the time being to work around it.
    Code:
                if(getServer().getWorld("world").getBlockAt(block.getLocation()).getTypeId() != 49) //should fix double obsidian problem
                    getServer().getWorld("world").getBlockAt(block.getLocation()).breakNaturally();
                else {
                    getServer().getWorld("world").getBlockAt(block.getLocation()).setTypeId(0);
                    getServer().getWorld("world").dropItem(block.getLocation(), new ItemStack(49));
                }
     
Thread Status:
Not open for further replies.

Share This Page