Solved Display bossbar for 10 seconds

Discussion in 'Spigot Plugin Development' started by GCNT, Jun 11, 2018.

  1. Hey spigot
    i'm trying to figure out how to send a bossbar to a player for only 10 sseconds.
    I know i have to use the Runnable, but i'm not good at Runnables. So can someone help me please?

    I'm trying to send this bossbar for 10 seconds:
    BossBar bb = Bukkit.createBossBar(ChatColor.translateAlternateColorCodes('&', "&b&lYea you did it!"), BarColor.GREEN, BarStyle.SOLID);

    Thanks!
     

  2. What have you tried so far? Boss Bar's api seems pretty simple, add the players you want then remove them after 10 seconds with a bukkit task (or BukkitRunnable would work)
     
  3. I did the bossbar code, but haven't done the bukkit scheduler code yet. Don't know how to do so
     
  4. Hmmm, send the bossbar first -> schedule a bukkit delayed task for 20L * 10L (10 seconds) -> on the run() method remove the bossbar.
     
    • Useful Useful x 1
  5. Thanks. This really helped me out. I got it fixed
     
    • Like Like x 1