Boss bar

Discussion in 'Plugin Development' started by SiezureSalad, Jun 30, 2018.

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

    SiezureSalad

    Hello,

    I was wondering if anyone could help me in utilizing the different colored boss bars. When a new ender dragon is spawned I want to remove the default purple health bar from the top of the screen and add in a colored one with a custom name.

    The main problem I'm facing is removing the default health bar. And future problems I can see arising are linking the enderdragon's health with the new boss bar.

    Thanks in advance
     
    Last edited: Jun 30, 2018
  2. Offline

    SiezureSalad

  3. Online

    KarimAKL

    @SiezureSalad Maybe "EnderDragon.removePlayer(Player player)", haven't tried and i'm not sure. :7
     
  4. Offline

    SiezureSalad

    No such method :(
     
  5. Online

    KarimAKL

  6. Offline

    SiezureSalad

  7. Online

    KarimAKL

    @SiezureSalad Have you tried something like this?:
    Code:Java
    1.  
    2. BossBar whatever = //Create bossbar
    3. whatever.removePlayer(player);
    4.  

    EDIT: I tried doing this and it didn't come with any errors. (Didn't test in-game tho)
     
    Last edited: Jul 1, 2018
  8. Offline

    SiezureSalad

    I don't have a problem with creating a new BossBar. When you spawn an ender dragon you get the purple bossbar at the top of your screen saying Ender Dragon, I wan't to remove players from this so that players can't see it.
     
  9. Online

    KarimAKL

  10. Offline

    SiezureSalad

    Read the replies. I can't get the BossBar object to .removeAll();
     
  11. Could you not do a for loop getting all the players on the server then do #removePlayer(player)


    CODE (open)

    Code:
    for(Player p : Bukkit.getServer().getOnlinePlayers()){
    bar.removePlayer(p);
    }
    
     
  12. Online

    KarimAKL

    @NullPointerExptn I think the problem is that he can't get the boss bar from the EnderDragon's boss bar when it's summoned, not the bar he created so therefore that wouldn't work.
     
Thread Status:
Not open for further replies.

Share This Page