Bossbar Per Player

Discussion in 'Spigot Plugin Development' started by eMuffin, Jul 8, 2018.

  1. How do I send bossbars to specific players with player-specific information?
    Will I have to use packets instead or can I just create many bossbars.
     
  2. You can use Bukkit to create a boss bar, an example is like this:
    Code (Text):
    BossBar bossBar = Bukkit.createBossBar("This is the title", BarColor.BLUE, BarStyle.SOLID);
    There are other methods for BossBar that I have found need to be set separately than when it is initialized, for example, its progress.

    You can control who gets the boss bar by doing bossBar.addPlayer(Player) or .removePlayer(Player).
     
  3. The bossbars aren't per player though.
    I can't dynamically create the bossbars either (as to utilize addPlayer)
    I'm doing player specific stats so it isn't like a bossbar you can tune into from a set list.
     
  4. md_5

    Administrator Developer

    Don't see how any of these are an issue.
    Yes, one per player
     
    • Useful Useful x 1
  5. Kind of a more basic question, how would I go about making these bars?
    At the moment I've made a bossbar in onEnable and I add players as they join, and update it periodically. Updating it broadcasts to all players though, hence the predicament.

    Not on my PC atm so would this work?
    Send a bossbar to a player on join, and make a runnable right after that updates the tbossbar
     
  6. md_5

    Administrator Developer

    You need to make a bossbar for each player as they join.
    You can store that bossbar in a HashMap
     
    • Agree Agree x 2
    • Like Like x 1
  7. Alright, it works! Thanks for the help.