Event Cooldown

Discussion in 'Plugin Development' started by LordManegane, Jul 25, 2013.

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

    LordManegane

    Well, i need some help with cooldown on events.
    I want to achieve that the event BlockBreakEvent have a cooldown so when the player break a block, it dissapears and apears again after a cooldown.
    I try to do this. But it stops all the thread and stuff and its a bit odd.
    Code:java
    1. Thread.sleep(1000);
    2. event.setCancelled(true);
     
  2. Offline

    Rocoty

    Why do you find that odd? Putting the main thread to sleep stopping the thread?

    To achieve what you want, you'll have to use a scheduler and manually place the block back
     
  3. Offline

    LordManegane

    Rocoty Can you bring me a hand please?
    I found it a bit odd because its "easy"
    And it stops the server. I do it on other class with the same code, but its the same, stops all the server stuff before the blocks re apears
     
  4. Offline

    fanaticmw2

    Thread.Sleep basically freezes the whole server. Use BukkitRunnables.
     
  5. Offline

    LordManegane

    fanaticmw2 Do you have a post or something that explains a little bit? I dindt work with BukkitRunnables by this way
     
Thread Status:
Not open for further replies.

Share This Page