Java Code Examples for org.bukkit.Bukkit.createBossBar()

The following are Jave code examples for showing how to use createBossBar() of the org.bukkit.Bukkit class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: SamaGamesAPI   File: BossBarAPI.java   View Source Code Vote up 7 votes
/**
 * Set a boss bar with a given color, style, percentage to a given
 * player. Also you can enable the darken sky, the boss music ambiance
 * and enable fog to a given player
 *
 * @param message Message on the top of the bar
 * @param color Color of the bar
 * @param style Style of the bar
 * @param progress Filling percentage
 * @param darkenSky Enable darken sky
 * @param playMusic Enable boss music
 * @param createFog Enable the fog
 */
public static Pair<UUID, BossBar> getBar(String message, BarColor color, BarStyle style, double progress, boolean darkenSky, boolean playMusic, boolean createFog)
{
    BossBar bossBar = Bukkit.createBossBar(message, color, style);
    bossBar.setProgress(progress < 0 ? 0D : progress / 100.0D);

    if (darkenSky)
        bossBar.addFlag(BarFlag.DARKEN_SKY);

    if (playMusic)
        bossBar.addFlag(BarFlag.PLAY_BOSS_MUSIC);

    if (createFog)
        bossBar.addFlag(BarFlag.CREATE_FOG);

    UUID random = UUID.randomUUID();
    bossBars.put(random, bossBar);

    return Pair.of(random, bossBar);
}
 
Example 2
Project: SkipNight   File: Vote.java   View Source Code Vote up 6 votes
private void doInit() {
    voters = new ArrayList();
    plugin.getServer().getPluginManager().registerEvents(this, plugin);

    messageArray[0] = Messages.voteStarted();
    messageArray[1] = Messages.voteButtons();

    yes = 1;
    no = 0;
    countDown = 30;

    bar = Bukkit.createBossBar("Current Vote: "
            + ChatColor.GREEN + ChatColor.BOLD + "Yes "
            + ChatColor.RESET + "- " + yes
            + ChatColor.DARK_RED + ChatColor.BOLD +  " No "
            + ChatColor.RESET + "- " + no, BarColor.PURPLE, BarStyle.SOLID);

    voters = updateAll(voters, messageArray, player);

    timer = Timer.OPERATION;
    plugin.getServer().getScheduler().runTaskLater(plugin, this, 20);
}
 
Example 3
Project: VoxelGamesLibv2   File: TimedPhase.java   View Source Code Vote up 5 votes
@Override
public void start() {
    super.start();

    originalTicks = ticks;

    log.finer("start timed phase with name " + getName());
    bossBar = Bukkit.createBossBar(getName(), BarColor.BLUE, BarStyle.SEGMENTED_20);

    getGame().getPlayers().forEach(u -> bossBar.addPlayer(u.getPlayer()));
    getGame().getSpectators().forEach(u -> bossBar.addPlayer(u.getPlayer()));

    started = true;
}
 
Example 4
Project: Warzone   File: CycleCountdown.java   View Source Code Vote up 4 votes
@Override
public BossBar initBossBar() {
    BossBar bossBar = Bukkit.createBossBar("", BarColor.BLUE, BarStyle.SOLID);
    bossBar.setVisible(false);
    return bossBar;
}
 
Example 5
Project: Warzone   File: StartCountdown.java   View Source Code Vote up 4 votes
@Override
public BossBar initBossBar() {
    BossBar bossBar = Bukkit.createBossBar("", BarColor.GREEN, BarStyle.SOLID);
    bossBar.setVisible(false);
    return bossBar;
}
 
Example 6
Project: VoxelGamesLibv2   File: BossBarFeature.java   View Source Code Vote up 4 votes
@Override
public void start() {
    bossBar = Bukkit.createBossBar(message, color, style);

    getPhase().getGame().getPlayers().forEach(user -> bossBar.addPlayer(user.getPlayer()));
}
 
Example 7
Project: OMGPI   File: Game.java   View Source Code Vote up 4 votes
/**
 * Basic game enabling and loading method.<br>
 * <br>
 * For proper runs use:<br>
 * name = "GameName";<br>
 * super.onEnable();<br>
 * <br>
 * If you create teams add:<br>
 * team = new OMGTeam(...);<br>
 * Inventories.update();
 */
public void onEnable() {
    Bukkit.getPluginManager().registerEvents(this, this);
    Bukkit.getPluginManager().registerEvents(new BukkitEventHandler(), OMGPI.instance);

    gamefig = new Gamefig();
    state = GameState.PRELOBBY;
    gamePreparer = new ClijmartTeamAsserter();
    shootSources = new HashMap<>();

    mapsDirectory = new File(getDataFolder() + File.separator + "maps");

    defaultTeam = new OMGTeam("default", ChatColor.YELLOW + "Default", ChatColor.YELLOW + "", true, GameMode.ADVENTURE);
    spectatorTeam = new OMGTeam("spectator", ChatColor.GRAY + "Spectator", ChatColor.GRAY + "", false, GameMode.SPECTATOR);

    OMGKit.dir = new File(getDataFolder() + File.separator + "kits");
    OMGKit def = new OMGKit("Default");
    def.setUnpresent("displayItem", "{id:stone,Count:1,tag:{display:{Name:\"Default\"}}}");
    def.save();
    String[] kitarr = OMGKit.dir.list();
    List<String> kits = kitarr == null ? new ArrayList<>() : Arrays.asList(kitarr);
    kits.stream().filter(k -> k.endsWith(".kit") && OMGKit.kits.stream().noneMatch(k1 -> (k1 + ".kit").equalsIgnoreCase(k))).forEach(k -> new OMGKit(k.replaceAll("\\.kit", "")));

    OMGLoot.dir = new File(getDataFolder() + File.separator + "loots");
    String[] lootarr = OMGLoot.dir.list();
    List<String> loots = lootarr == null ? new ArrayList<>() : Arrays.asList(lootarr);
    loots.stream().filter(l -> l.endsWith(".loot") && OMGLoot.loots.stream().noneMatch(l1 -> (l1 + ".loot").equalsIgnoreCase(l))).forEach(l -> new OMGLoot(l.replaceAll("\\.loot", "")));

    settings = new GameSettings(this);

    infoBar = Bukkit.createBossBar(ChatColor.AQUA + "", BarColor.WHITE, BarStyle.SOLID);
    infoBar.setVisible(false);

    voteSystem = new VoteSystem();

    countdown = new Countdown();
    updator = new BukkitRunnable() {
        public void run() {
            update();
        }
    };
    updator.runTaskTimer(this, 0, 1);

    Inventories.update();

    Bukkit.getOnlinePlayers().forEach(p -> {
        while (OMGPlayer.get(p) == null) event_player_join(new OMGPlayer(p));
    });
    OMGPI.iLog(name + " initialized, can be played.");
}