Skip to content

Add boss bar customization with Spigot 1.9 #7

@justwheel

Description

@justwheel

Originally, the plan for this plugin was to display messages and information about the current storm via a boss bar. This was planned to be accomplished with the BarAPI. However, this third-party API has dependencies on repositories that no longer exist or are frequently offline, namely being the MCStats repo. Even at the time of writing this issue, it is offline.

As a result, this causes a multitude of errors and issues when using BarAPI. At the current point in time, it is not sustainable to keep using this as it triggers build failures and other issues when using it. The code created by @woodrow73 is being commented out in the meanwhile.

Solution: It has been noted that Spigot will include a boss bar API with the 1.9 release. Once 1.9 is released for Spigot, the plan is to rewrite this method using the official Spigot API.

The original code is quoted below as a reference. It is being removed from the project in the interim to keep the code clean.

    /**
     * Method to set the message of the boss bar at top of client window.
     *
     * @param message the string to set the boss bar to
     */
    private void setBar(String message) {
        for(Player p : Bukkit.getOnlinePlayers()){
            if(BarAPI.hasBar(p)){
                BarAPI.removeBar(p);
            }
            BarAPI.setMessage(p, message);
        }
    }
                if (args[0].equalsIgnoreCase("start")) {
                    Bukkit.broadcastMessage(ChatColor.DARK_RED + getConfig().getString("start-message"));
                    if (getServer().getPluginManager().getPlugin("BarAPI") != null) setBar(ChatColor.DARK_RED +
                            getConfig().getString("start-message"));
                    world.setStorm(true);
                    this.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
                        //@Override
                        public void run() {
                            Bukkit.broadcastMessage(ChatColor.DARK_RED + "The PvP Storm is now hitting the Arena!");
                            if (getServer().getPluginManager().getPlugin("BarAPI") != null) setBar(ChatColor.DARK_RED +
                                    "The PvP Storm is now hitting the Arena!");
                        }
                    }, 12000L);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions