How to break blocks within a Bukkit plugin?

Discussion in 'Plugin Development' started by w0lfx, Apr 26, 2011.

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

    w0lfx

    Hi,

    I'm toying around with some ideas for plugins but I've run into a little snag, wondering if anyone has a solution/suggestions?

    How to destroy a block ?

    How I've currently been dealing with it is somethin of the likes of this:
    Technically this does work and seems like the only way of doing it as far as I could find. However, with Minecraft 1.5 comes the Statistics feature. So any blocks for which breaking is "simulated" with the above steps is not counted as actually breaking a block :(

    Is there a workaround or solution to this? How to make the block actually break (instead of turning it into air) or how to change the properties of a certain tool (make it mine REALLY fast for example)
     
  2. Offline

    Shamebot

    Maybe getServer().getPluginManager().callEvent(new BlockBreakEvent(...));
    I didn't try it, just guessing.
     
  3. Offline

    Daniel Heppner

    You might play around with onBlockDamage.
     
  4. Offline

    cowman24

    I've tried calling events the way shamebot said before, and personally haven't found it to work. However I have had success in calling a function directly from net.minecraft.server, I'd advise the block class, function a(World, EntityHuman, int,int,int,int) or b(World, int, int, int, EntityHuman) (those are the only two that seem to have a world, coordinates, and a player involved)

    You could also use Player.incrimentStatistic(Statistic, Material, int).
     
    R3ality likes this.
Thread Status:
Not open for further replies.

Share This Page