Solved Bossbar help

Discussion in 'Plugin Development' started by advancedjus, Oct 9, 2019.

  1. Offline

    advancedjus

    I'm trying to make a bossbar, but it does not seem to appear. Does anyone have any ideas? If so, that would be greatly appreciated!
    Code:
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.boss.BarColor;
    import org.bukkit.boss.BarStyle;
    import org.bukkit.boss.BossBar;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerJoinEvent;
    
    public class Bossbar implements Listener {
    
        @EventHandler
            public void onPlayerJoin (PlayerJoinEvent e) {
            Player p = e.getPlayer();
       
                String message = (ChatColor.translateAlternateColorCodes('&', ChatColor.GOLD + "&LHAPPY " + ChatColor.BLACK + "&LHALLOWEEN"));
                BarColor color = BarColor.PURPLE;
                BarStyle style = BarStyle.SOLID;
                BossBar bar = Bukkit.createBossBar(message, color, style);
                bar.addPlayer(p);
    }
    }
     
  2. Offline

    timtower Moderator Moderator

Share This Page