Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add boss bar customization with Spigot 1.9 #7

Open
jwflory opened this issue Dec 29, 2015 · 0 comments
Open

Add boss bar customization with Spigot 1.9 #7

jwflory opened this issue Dec 29, 2015 · 0 comments

Comments

@jwflory
Copy link
Member

jwflory commented Dec 29, 2015

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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant