Solved call the BlockBreakEvent for predefined Block and Player?

Discussion in 'Plugin Development' started by InflamedSebi, Apr 10, 2013.

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

    InflamedSebi

    I try to break blocks for a player. For example ... a player is mining a Block at (0,0,0) this will call a BlockBreakEvent where i can get the player, who did this (Player p) and now i want all surrounding blocks of the broken one also get mined.
    But i can't break them with .breakNaturally() because this will not call the BlockBreak event for the other Blocks, but it should ...

    my intention is, to create tools (maybe gold) who will force all nearby blocks of the same type like the mined one also drop their items ...
    Due to there are logging plugins that need the BlockBreakEvent to log the block i have to call the Break event, so other plugins just think the player broke them the ordinary way ...


    Anyone can help?
    (my Problem is, how to call the BlockBreakEvent manually, so bukkit will handle this like a player p broke them with an ordinary diamond tool)
     
  2. Offline

    NoLiver92

    why not do it in the block interact event then break the blocks if the player clicks it, making it instant?
     
  3. Offline

    Hoolean Retired Staff

    InflamedSebi
    You could always manually call the event like that ^_^
    Code:java
    1. BlockBreakEvent event = new BlockBreakEvent(Block block, Player player);
    2. Bukkit.getServer().getPluginManager().callEvent(event);
    3. if(!event.isCancelled()) {/* break block */}
     
  4. Offline

    InflamedSebi

    MrBluebear3 thats so easy? :D
    than i just need a way to determine if the event was called by me or is a real BlockBreakEvent ...
    maybe i'll just add him to a list if the event starts and remove him if it was finished ...
    so my own BlockBreak can check it and not call itself ever and ever again xD
     
    MrBluebear3 likes this.
Thread Status:
Not open for further replies.

Share This Page