-2

So, I wrote a rescue bar plugin, where if you right click on a blaze bar you get a block underneath. Now I want that block to disappear after 5 seconds, I guess this could be done with a simple runnabel, I just don't know how. I just started writing this plugin. IntelliJ idea, java. Sorry, I translate with google.

  • 1
    Welcome! Could you edit your post with what you've tried so far and any errors you get? It may help for you to take the [tour](https://stackoverflow.com/tour) and read [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask). – Lucan Jun 25 '21 at 08:11
  • Does this answer your question? [java: run a function after a specific number of seconds](https://stackoverflow.com/questions/2258066/java-run-a-function-after-a-specific-number-of-seconds) – dan1st Jun 25 '21 at 08:17

1 Answers1

0

When you place the block you could run a delayed task, which runs 100 ticks later (1 second is 20 ticks) and remove the block there (set it to air)

Bukkit.getScheduler().sheduleSyncDelayedTask(this, new Runnable() {
    public void run() {
        // Remove the block here
        // block.setType(Material.Air)
    }
}, 100L);

For more information on using Bukkit Scheudler look at this entry in the bukkit wiki.