How can I cancel block breaking?

Discussion in 'Plugin Development' started by TheEyeMonster, Oct 4, 2013.

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

    TheEyeMonster

    How can I respawn blocks after breaking them?

    I just need the code to cancel it and respawn the block.
     
  2. Offline

    GaaTavares

    If you cancel the BlockBreakEvent he will be respawned after breaked (tried to break)
     
  3. Offline

    TheEyeMonster

    But I did,

    event.setCancelled(true);

    didn't work, but it did send the sendMessage that is in the same brackets.
     
  4. Offline

    TomTheDeveloper

    weird. Can you post your whole code?
     
  5. Offline

    The_Doctor_123

    TheEyeMonster
    That must mean you either did not:
    1. Add the @EventHander annotation before the method.
    2. Register your events to the class you're listening in.
     
    TheEyeMonster likes this.
  6. Offline

    TheEyeMonster

    The_Doctor_123 I have done that already before I started to code.

    [​IMG]
    [​IMG]

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  7. Offline

    The_Doctor_123

  8. Offline

    TheEyeMonster

    The console error: All text showedup after I broke a block.

    [​IMG]

    The_Doctor_123 I tried it with and without permission and also with and without OP.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  9. Offline

    adam753

    Code:
    Player player = (Player)event;
    
    lol
     
    The_Doctor_123 likes this.
  10. Offline

    TheEyeMonster

    So what did I do wrong? I am new to bukkit developing so....
     
  11. Offline

    d33k40

    You cant cast Player to event.

    Use this:
    Code:
    Player player = event.getPlayer();

    EDIT:
    And please learn the bassics before trying coding plugins.
     
    TheEyeMonster likes this.
Thread Status:
Not open for further replies.

Share This Page