Java Code Examples for org.bukkit.boss.BossBar

The following are top voted examples for showing how to use org.bukkit.boss.BossBar. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: SamaGamesAPI   File: BossBarAPI.java   Source Code and License 7 votes vote down vote up
/**
 * 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: Arcade2   File: PointBossBarRender.java   Source Code and License 6 votes vote down vote up
@Handler(priority = Priority.LAST)
public void gameOver(GameStopEvent event) {
    // There might be issues with this event. GameStopEvent is called AFTER
    // a new game actually starts and calls GameStartEvent. The Minecraft
    // client might have limit of displayed boss bars and boss bars rendered
    // in a new game (which would be called in GameStartEvent) might not be
    // displayed.
    // NOTE: We won't use ServerCycleEvent since this event is not
    //       representing the stopping game.

    for (BossBar bossBar : this.bossBars.values()) {
        // We need need to send the "REMOVE" packet to all members
        // of this boss bar to remove it from their views.
        bossBar.removeAll();
    }

    this.bossBars.clear();
}
 
Example 3
Project: SamaGamesAPI   File: BossBarAPI.java   Source Code and License 5 votes vote down vote up
/**
 * Remove a boss bar from a given player
 *
 * @param player Player
 */
public static void removeBar(Player player)
{
    Map<UUID, BossBar> list = new HashMap<>(bossBars);
    list.forEach((uuid, bossBar) ->
    {
        bossBar.removePlayer(player);
        if (bossBar.getPlayers().isEmpty())
            bossBars.remove(uuid);
    });
}
 
Example 4
Project: ProjectAres   File: PlayerListener.java   Source Code and License 5 votes vote down vote up
@EventHandler(priority = EventPriority.HIGHEST)
public void join(final PlayerJoinEvent event) {
    Player player = event.getPlayer();

    resetPlayer(player);

    event.getPlayer().addAttachment(lobby, Permissions.OBSERVER, true);

    if (player.hasPermission("lobby.overhead-news")) {
        final String datacenter = minecraftService.getLocalServer().datacenter();
        final Component news = new Component(ChatColor.GREEN)
            .extra(new TranslatableComponent(
                "lobby.news",
                new Component(ChatColor.GOLD, ChatColor.BOLD).extra(generalFormatter.publicHostname())
            ));

        final BossBar bar = bossBarFactory.createBossBar(renderer.render(news, player), BarColor.BLUE, BarStyle.SOLID);
        bar.setProgress(1);
        bar.addPlayer(player);
        bar.show();
    }

    if(!player.hasPermission("lobby.disabled-permissions-exempt")) {
        for(PermissionAttachmentInfo attachment : player.getEffectivePermissions()) {
            if(config.getDisabledPermissions().contains(attachment.getPermission())) {
                attachment.getAttachment().setPermission(attachment.getPermission(), false);
            }
        }
    }

    int count = lobby.getServer().getOnlinePlayers().size();
    if(!lobby.getServer().getOnlinePlayers().contains(event.getPlayer())) count++;
    minecraftService.updateLocalServer(new SignUpdate(count));
}
 
Example 5
Project: ProjectAres   File: RenderedBossBar.java   Source Code and License 5 votes vote down vote up
@Override
public void addPlayer(Player player) {
    if(!views.containsKey(player)) {
        final BossBar view = bossBarFactory.createBossBar(renderer.render(title, player), color, style, flags.toArray(new BarFlag[flags.size()]));
        view.setVisible(visibile);
        view.addPlayer(player);
        views.put(player, view);
    }
}
 
Example 6
Project: NationZ   File: NZPlayer.java   Source Code and License 5 votes vote down vote up
public void updateBossBar() {
	BossBar b = Bukkit.createBossBar("error", BarColor.GREEN, BarStyle.SOLID);
	b.addPlayer(getPlayer());
	int begin = getJobExp().getXPLVL().begin;
	int current = getJobExp().getEXP();
	int end = getJobExp().getXPLVL().end;
	b.setTitle(getJob().getDisplayname() + ChatColor.DARK_GRAY + " - " + Job.getColor() + current + ChatColor.DARK_GRAY + "/" + Job.getColor() + end);
	b.setProgress(100 / (end - begin) * (current - begin));
	
}
 
Example 7
Project: GamePlate   File: Countdown.java   Source Code and License 5 votes vote down vote up
@EventHandler(priority = EventPriority.HIGH)
public void onCountdownCycleComplete(CycleCompleteEvent event) {
    for (Player player : Bukkit.getOnlinePlayers()) {
        if (getBossBar(player) == null) {
            BossBar bossBar = createBossBar(player);
            bossBar.addPlayer(player);
            bossBars.add(bossBar);

            if (time <= 0) {
                bossBar.setVisible(false);
            }
        }
    }
}
 
Example 8
Project: GamePlate   File: Countdown.java   Source Code and License 5 votes vote down vote up
@EventHandler
public void onCountdownJoin(PlayerJoinEvent event) {
    BossBar bossBar = createBossBar(event.getPlayer());
    this.bossBars.add(bossBar);
    bossBar.addPlayer(event.getPlayer());

    if (time <= 0) {
        bossBar.setVisible(false);
    }
}
 
Example 9
Project: GamePlate   File: Countdown.java   Source Code and License 5 votes vote down vote up
@Override
public void disable() {
    for (BossBar bossBar : this.bossBars) {
        bossBar.removeAll();
    }

    HandlerList.unregisterAll(this);
}
 
Example 10
Project: GamePlate   File: Countdown.java   Source Code and License 5 votes vote down vote up
private boolean endCountdown() {
    if (canEnd()) {
        if (destroyOnEnd) {
            canRun = false;
            for (BossBar bossBar : this.bossBars) {
                bossBar.setVisible(false);
            }
        }
        onCountdownEnd();
        return true;
    } return false;
}
 
Example 11
Project: GamePlate   File: Countdown.java   Source Code and License 5 votes vote down vote up
public BossBar getBossBar(Player player) {
    for (BossBar bossBar : this.bossBars) {
        if (bossBar.getPlayers().contains(player)) {
            return bossBar;
        }
    }
    return null;
}
 
Example 12
Project: Karus-Commons   File: SharedProgressBar.java   Source Code and License 5 votes vote down vote up
@Override
protected @Nonnull ScheduledResultTask<Void> newTask(Collection<Player> players) {
    BossBar bar = supplier.get();
    for (Player player : players) {
        bar.addPlayer(player);
    }
    
    return new ScheduledTask(bar, consumer.get(), translation, iterations);
}
 
Example 13
Project: Karus-Commons   File: ProgressBar.java   Source Code and License 5 votes vote down vote up
@Override
protected @Nonnull ScheduledResultTask<Void> newTask(Collection<Player> players) {
    List<BossBar> bars = players.stream().map(player -> {
        BossBar bar = supplier.get();
        bar.addPlayer(player);
        return bar;
    }).collect(toList());
    
    return new ScheduledTask(bars, consumer.get(), translation, iterations);
}
 
Example 14
Project: Arcade2   File: PointBossBarRender.java   Source Code and License 5 votes vote down vote up
public BossBar renderBossBar(Point point, Color pointColor, double progress, Color progressColor) {
    BossBar bossBar = this.bossBars.get(point);
    if (bossBar == null) {
        this.bossBars.put(point, bossBar = this.createBossBar());
    }

    bossBar.setColor(this.getBarColor(pointColor));
    bossBar.setProgress(progress);
    bossBar.setTitle(this.getBarTitle(point.getName(), pointColor, progress, progressColor));
    bossBar.setVisible(true);
    return bossBar;
}
 
Example 15
Project: Arcade2   File: PointBossBarRender.java   Source Code and License 5 votes vote down vote up
public BossBar renderBossBar(Point point, Color pointColor, double progress, Color progressColor, Player bukkit) {
    if (bukkit != null) {
        BossBar bossBar = this.renderBossBar(point, pointColor, progress, progressColor);
        if (bossBar != null) {
            bossBar.addPlayer(bukkit);
        }

        return bossBar;
    }

    return null;
}
 
Example 16
Project: Arcade2   File: PointBossBarRender.java   Source Code and License 5 votes vote down vote up
public void removeBossBar(Point point, Player bukkit) {
    BossBar bossBar = this.bossBars.get(point);
    if (bossBar != null) {
        try {
            bossBar.removePlayer(bukkit);
        } catch (NullPointerException ignored) {
            // Strange Bukkit bug in CraftBossBar.removePlayer(CraftBossBar.java:190)
        }
    }
}
 
Example 17
Project: Skellett   File: EffBarHideAndShow.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public boolean init(Expression<?>[] e, int matchedPattern, Kleenean isDelayed, ParseResult parser) {
	bar = (Expression<BossBar>) e[0];
	if (parser.mark == 2) {toggle = false;}
	return true;
}
 
Example 18
Project: Skellett   File: ExprNewBossBar.java   Source Code and License 5 votes vote down vote up
@Override
@Nullable
protected BossBar[] get(Event e) {
	BossBar bar = Bukkit.createBossBar(Skellett.cc("&a&lSkellett bossbar"), BarColor.GREEN, BarStyle.SOLID, new BarFlag[0]);
	if (flag != null) {
		bar = Bukkit.createBossBar(Skellett.cc("&a&lSkellett bossbar"), BarColor.GREEN, BarStyle.SOLID, flag.getSingle(e));
	}
	return new BossBar[]{bar};
}
 
Example 19
Project: Skellett   File: EffBarAddFlag.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public boolean init(Expression<?>[] e, int arg1, Kleenean arg2, ParseResult arg3) {
	flag = (Expression<BarFlag>) e[0];
	bar = (Expression<BossBar>) e[1];
	return true;
}
 
Example 20
Project: Skellett   File: EffBarAddPlayer.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public boolean init(Expression<?>[] e, int arg1, Kleenean arg2, ParseResult arg3) {
	player = (Expression<Player>) e[0];
	bar = (Expression<BossBar>) e[1];
	return true;
}
 
Example 21
Project: Skellett   File: EffBarRemoveFlag.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public boolean init(Expression<?>[] e, int arg1, Kleenean arg2, ParseResult arg3) {
	flag = (Expression<BarFlag>) e[0];
	bar = (Expression<BossBar>) e[1];
	return true;
}
 
Example 22
Project: Skellett   File: CondBarHasFlag.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("unchecked")
public boolean init(Expression<?>[] e, int matchedPattern, Kleenean isDelayed, ParseResult parser) {
	bar = (Expression<BossBar>) e[0];
	flag = (Expression<BarFlag>) e[1];
	if (parser.mark == 2) {boo = false;}
	return true;
}
 
Example 23
Project: Skellett   File: EffBarRemovePlayer.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public boolean init(Expression<?>[] e, int arg1, Kleenean arg2, ParseResult arg3) {
	player = (Expression<Player>) e[0];
	bar = (Expression<BossBar>) e[1];
	return true;
}
 
Example 24
Project: RedProtect   File: RPMine111.java   Source Code and License 5 votes vote down vote up
private static void removeBar(final BossBar bar, final Player p){
	final int task = Bukkit.getScheduler().scheduleSyncRepeatingTask(RedProtect.get(), () -> {
        double d = bar.getProgress();
        if (d >= 0.2){
            bar.setProgress(d - 0.2);
        }
    }, 20, 20);
	Bukkit.getScheduler().runTaskLater(RedProtect.get(), () -> {
        bar.removePlayer(p);
        Bukkit.getScheduler().cancelTask(task);
    }, 120);
}
 
Example 25
Project: mcMMOExtras   File: SpigotBarApi.java   Source Code and License 5 votes vote down vote up
@Override
public void removeBar(Player player, SkillType skill) {
    EnumMap<SkillType, BossBar> skillBars = bossBars.get(player.getUniqueId());
    if (skillBars != null) {
        BossBar bar = skillBars.get(skill);
        if (bar != null) {
            bar.setVisible(false);
        }
    }
}
 
Example 26
Project: mcMMOExtras   File: SpigotBarApi.java   Source Code and License 5 votes vote down vote up
@Override
public void removeAllBars(Player player) {
    EnumMap<SkillType, BossBar> skillBars = bossBars.remove(player.getUniqueId());
    if (skillBars != null) {
        skillBars.values().forEach(bar -> bar.setVisible(false));
    }
}
 
Example 27
Project: mcMMOExtras   File: SpigotBarApi.java   Source Code and License 5 votes vote down vote up
@Override
public void setMessage(Player player, SkillType skill, String newMessage, float percent) {
    UUID uniqueId = player.getUniqueId();

    EnumMap<SkillType, BossBar> skillBars = bossBars
            .computeIfAbsent(uniqueId, k -> Maps.newEnumMap(SkillType.class));

    BossBar bar = skillBars.computeIfAbsent(skill, skillType -> {
        BarStyle style = specificStyle.get(skillType);
        BarColor color = specificColor.get(skillType);
        if (style == null || color == null) {
            return null;
        }

        BossBar tempBar = Bukkit.createBossBar(newMessage, color, style);
        tempBar.addPlayer(player);
        return tempBar;
    });

    bar.setTitle(newMessage);
    bar.setVisible(true);

    bar.setProgress(percent / 100);
    oldBars.remove(bar);
    oldBars.addLast(bar);
    if (oldBars.size() > concurrentBars) {
        oldBars.removeFirst().setVisible(false);
    }
}
 
Example 28
Project: NovaGuilds   File: BossBarUtilsBukkitImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Creates a boss bar if doesn't exist
 *
 * @param player the player
 * @return the boss bar
 */
private BossBar createIfNotExists(Player player) {
	if(bossBars.containsKey(player.getUniqueId())) {
		return getBossBar(player);
	}

	BossBar bossBar = Bukkit.getServer().createBossBar("", Config.BOSSBAR_RAIDBAR_COLOR.toEnum(BarColor.class), Config.BOSSBAR_RAIDBAR_STYLE.toEnum(BarStyle.class));
	bossBar.addPlayer(player);
	bossBars.put(player.getUniqueId(), bossBar);
	return bossBar;
}
 
Example 29
Project: skRayFall   File: BossBarManager.java   Source Code and License 5 votes vote down vote up
/**
 * Saves a bossbar in the BossBarManager for future use.
 * 
 * @param id The ID text for the bossbar, duplicate ID's will be over written.
 * @param bossbar The bossbar object to be stored.
 */
public void createBossBar(String id, BossBar bossbar) {
  if (barMap.containsKey(id)) {
    barMap.get(id).removeAll();
    barMap.remove(id);
  }
  barMap.put(id, bossbar);
}
 
Example 30
Project: skRayFall   File: BossBarManager.java   Source Code and License 5 votes vote down vote up
/**
 * Add a flag to a bossbar in the BossBarManager through the stored ID.
 * 
 * @param id The ID text for the bossbar.
 * @param flag The BarFlag to be added.
 */
public void addFlag(String id, BarFlag flag) {
  BossBar bar = barMap.get(id);
  if (bar != null) {
    bar.addFlag(flag);
    barMap.put(id, bar);
  }
}
 
Example 31
Project: skRayFall   File: BossBarManager.java   Source Code and License 5 votes vote down vote up
/**
 * Remove a flag from a bossbar in the BossBarManager through the stored ID.
 * 
 * @param id The ID text for the bossbar.
 * @param flag The BarFlag to be added.
 */
public void removeFlag(String id, BarFlag flag) {
  BossBar bar = barMap.get(id);
  if (bar != null) {
    bar.removeFlag(flag);
    barMap.put(id, bar);
  }
}
 
Example 32
Project: skRayFall   File: BossBarManager.java   Source Code and License 5 votes vote down vote up
/**
 * Add an array of players to a bossbar in the BossBarManager through the stored ID.
 * 
 * @param id The ID text for the bossbar.
 * @param players Array of players to be added to the bossbar
 */
public void addPlayers(String id, Player[] players) {
  BossBar bar = barMap.get(id);
  if (bar != null) {
    for (Player p : players) {
      bar.addPlayer(p);
    }
    barMap.put(id, bar);
  }
}
 
Example 33
Project: skRayFall   File: BossBarManager.java   Source Code and License 5 votes vote down vote up
/**
 * Remove an array of players from a bossbar in the BossBarManager through the stored ID.
 * 
 * @param id The ID text for the bossbar.
 * @param players Array of players to be removed from the bossbar
 */
public void removePlayers(String id, Player[] players) {
  BossBar bar = barMap.get(id);
  if (bar != null) {
    for (Player p : players) {
      bar.removePlayer(p);
    }
    barMap.put(id, bar);
  }
}
 
Example 34
Project: skRayFall   File: BossBarManager.java   Source Code and License 5 votes vote down vote up
/**
 * Remove a bossbar from the BossBarManager and remove it from all players who were assigned it.
 * 
 * @param id The ID text for the bossbar.
 */
public void removeBar(String id) {
  BossBar bar = barMap.get(id);
  if (bar != null) {
    bar.removeAll();
    barMap.remove(id);
  }
}
 
Example 35
Project: skRayFall   File: BossBarManager.java   Source Code and License 5 votes vote down vote up
/**
 * Changed the title of a bossbar from the BossBarManager through the stored ID.
 * 
 * @param id The ID text for the bossbar.
 * @param title The new title for the bossbar with color codes.
 */
public void changeTitle(String id, String title) {
  BossBar bar = barMap.get(id);
  if (bar != null) {
    bar.setTitle(title);
    barMap.put(id, bar);
  }
}
 
Example 36
Project: skRayFall   File: BossBarManager.java   Source Code and License 5 votes vote down vote up
/**
 * Changed the progress or fill of a bossbar from the BossBarManager through the stored ID.
 * 
 * @param id The ID text for the bossbar.
 * @param progress The progress or fill to be set from 0 - 100.
 */
public void changeValue(String id, double progress) {
  BossBar bar = barMap.get(id);
  if (bar != null) {
    if (progress > 100) {
      progress = 100;
    } else if (progress < 0) {
      progress = 0;
    }
    bar.setProgress(progress / 100);
    barMap.put(id, bar);
  }
}
 
Example 37
Project: skRayFall   File: BossBarManager.java   Source Code and License 5 votes vote down vote up
/**
 * Changed the color of a bossbar from the BossBarManager through the stored ID.
 * 
 * @param id The ID text for the bossbar.
 * @param color The BarColor to be used.
 */
public void changeColor(String id, BarColor color) {
  BossBar bar = barMap.get(id);
  if (bar != null) {
    bar.setColor(color);
    barMap.put(id, bar);
  }
}
 
Example 38
Project: skRayFall   File: BossBarManager.java   Source Code and License 5 votes vote down vote up
/**
 * Changed the style of a bossbar from the BossBarManager through the stored ID.
 * 
 * @param id The ID text for the bossbar.
 * @param style The BarStyle to be used.
 */
public void changeStyle(String id, BarStyle style) {
  BossBar bar = barMap.get(id);
  if (bar != null) {
    bar.setStyle(style);
    barMap.put(id, bar);
  }
}
 
Example 39
Project: skRayFall   File: BossBarManager.java   Source Code and License 5 votes vote down vote up
/**
 * Hide a bossbar from the BossBarManager through the stored ID for all players 
 * who were assigned it.
 * 
 * @param id The ID text for the bossbar.
 */
public void hideBar(String id) {
  BossBar bar = barMap.get(id);
  if (bar != null) {
    bar.setVisible(false);
    barMap.put(id, bar);
  }
}
 
Example 40
Project: skRayFall   File: BossBarManager.java   Source Code and License 5 votes vote down vote up
/**
 * Show a bossbar from the BossBarManager through the stored ID for all players 
 * who were assigned it.
 * 
 * @param id The ID text for the bossbar.
 */
public void showBar(String id) {
  BossBar bar = barMap.get(id);
  if (bar != null) {
    bar.setVisible(true);
    barMap.put(id, bar);
  }
}
 
Example 41
Project: skRayFall   File: BossBarManager.java   Source Code and License 5 votes vote down vote up
/**
 * Get the title of a stored bossbar from the BossBarManager through the ID.
 * 
 * @param id The ID text for the bossbar.
 * 
 * @return Title of the bossbar
 */
public String getBarTitle(String id) {
  BossBar bar = barMap.get(id);
  if (bar != null) {
    return bar.getTitle();
  }
  return null;
}
 
Example 42
Project: skRayFall   File: BossBarManager.java   Source Code and License 5 votes vote down vote up
/**
 * Get the progress or fill of a stored bossbar from the BossBarManager through the ID.
 * 
 * @param id The ID text for the bossbar.
 * 
 * @return The progress or fill of the bossbar from 0 - 100.
 */
public Number getBarProgres(String id) {
  BossBar bar = barMap.get(id);
  if (bar != null) {
    return bar.getProgress();
  }
  return null;
}
 
Example 43
Project: skRayFall   File: EffCreateModernBossBar.java   Source Code and License 5 votes vote down vote up
@Override
protected void execute(Event evt) {
  BarStyle barStyle = BarStyle.SOLID;
  BarColor barColor = BarColor.PURPLE;
  if (style != null) {
    barStyle = style.getSingle(evt).getKey();
  }
  if (color != null) {
    barColor = color.getSingle(evt).getKey();
  }
  BossBar bar = null;
  if (flag != null) {
    bar = Bukkit.createBossBar(title.getSingle(evt).replace("\"", ""), barColor, barStyle,
        flag.getSingle(evt).getKey());
  } else {
    bar = Bukkit.createBossBar(title.getSingle(evt).replace("\"", ""), barColor, barStyle);
  }
  if (value != null) {
    double vol = value.getSingle(evt).doubleValue();
    if (vol > 100) {
      vol = 100;
    } else if (vol < 0) {
      vol = 0;
    }
    bar.setProgress(vol / 100);
  }
  for (Player p : players.getAll(evt)) {
    bar.addPlayer(p);
  }
  Core.bossbarManager.createBossBar(id.getSingle(evt).replace("\"", ""), bar);
}
 
Example 44
Project: CardinalPGM   File: LocalizedBossBar.java   Source Code and License 5 votes vote down vote up
public void setColor(BarColor color) {
    if (color != this.color) {
        this.color = color;
        for (BossBar bossbar : playerBossBars.values()) {
            bossbar.setColor(color);
        }
    }
}
 
Example 45
Project: CardinalPGM   File: LocalizedBossBar.java   Source Code and License 5 votes vote down vote up
public void removeFlag(BarFlag flag) {
    if (this.flags.contains(flag)) {
        this.flags.remove(flag);
        for (BossBar bossbar : playerBossBars.values()) {
            bossbar.setFlags(this.flags);
        }
    }
}
 
Example 46
Project: CardinalPGM   File: LocalizedBossBar.java   Source Code and License 5 votes vote down vote up
public void addFlag(BarFlag flag) {
    if (!this.flags.contains(flag)) {
        this.flags.remove(flag);
        for (BossBar bossbar : playerBossBars.values()) {
            bossbar.setFlags(this.flags);
        }
    }
}
 
Example 47
Project: CardinalPGM   File: LocalizedBossBar.java   Source Code and License 5 votes vote down vote up
public void setProgress(double progress) {
    if (progress == 0D || progress == 1D || Math.abs(this.progress - progress) > 0.0049D) {
        this.progress = progress;
        for (BossBar bossbar : playerBossBars.values()) {
            bossbar.setProgress(this.progress);
        }
    }
}
 
Example 48
Project: CardinalPGM   File: LocalizedBossBar.java   Source Code and License 5 votes vote down vote up
public void addPlayer(Player player) {
    if (!playerBossBars.containsKey(player)) {
        BossBar bossBar = Bukkit.createBossBar(getTitle(player.getLocale()), this.color, this.style, this.flags.toArray(new BarFlag[flags.size()]));
        bossBar.setVisible(this.shown);
        bossBar.addPlayer(player);
        playerBossBars.put(player, bossBar);
    }
}
 
Example 49
Project: CardinalPGM   File: LocalizedBossBar.java   Source Code and License 5 votes vote down vote up
public void setVisible(Boolean visible) {
    if (visible != this.shown) {
        this.shown = visible;
        for (BossBar bossbar : playerBossBars.values()) {
            bossbar.setVisible(visible);
        }
    }
}
 
Example 50
Project: Warzone   File: CycleCountdown.java   Source Code and License 4 votes vote down vote up
@Override
public BossBar initBossBar() {
    BossBar bossBar = Bukkit.createBossBar("", BarColor.BLUE, BarStyle.SOLID);
    bossBar.setVisible(false);
    return bossBar;
}
 
Example 51
Project: Warzone   File: StartCountdown.java   Source Code and License 4 votes vote down vote up
@Override
public BossBar initBossBar() {
    BossBar bossBar = Bukkit.createBossBar("", BarColor.GREEN, BarStyle.SOLID);
    bossBar.setVisible(false);
    return bossBar;
}
 
Example 52
Project: SamaGamesAPI   File: BossBarAPI.java   Source Code and License 4 votes vote down vote up
/**
 * Remove the boss bar of all the players
 */
public static void flushBars()
{
    bossBars.values().forEach(BossBar::removeAll);
    bossBars.clear();
}
 
Example 53
Project: WC   File: BossBarUtils.java   Source Code and License 4 votes vote down vote up
public static BossBar bossBar(String title){
    return bossBar(title, BarColor.PINK, BarStyle.SOLID);
}
 
Example 54
Project: WC   File: BossBarUtils.java   Source Code and License 4 votes vote down vote up
public static BossBar bossBar(String title, BarColor color){
    return bossBar(title, color, BarStyle.SOLID);
}
 
Example 55
Project: WC   File: BossBarUtils.java   Source Code and License 4 votes vote down vote up
public static BossBar bossBar(String title, BarColor color, BarStyle style, BarFlag... flags){
    BossBar bb = WCCore.getInstance().getServer().createBossBar(title, color, style, flags);
    bb.setTitle(title);
    return bb;
}
 
Example 56
Project: ProjectAres   File: BossBarFactoryImpl.java   Source Code and License 4 votes vote down vote up
@Override
public BossBar createBossBar(BaseComponent title, BarColor color, BarStyle style, BarFlag... flags) {
    return server.createBossBar(title, color, style, flags);
}
 
Example 57
Project: ProjectAres   File: BossBarFactoryImpl.java   Source Code and License 4 votes vote down vote up
@Override
public BossBar createBossBar() {
    return createBossBar(Components.blank(), DEFAULT_COLOR, BarStyle.SOLID);
}
 
Example 58
Project: ProjectAres   File: BossBarFactoryImpl.java   Source Code and License 4 votes vote down vote up
@Override
public BossBar createRenderedBossBar() {
    return renderedBossBarProvider.get();
}
 
Example 59
Project: ProjectAres   File: RenderedBossBar.java   Source Code and License 4 votes vote down vote up
@Override
public void removePlayer(Player player) {
    final BossBar view = views.remove(player);
    if(view != null) view.removePlayer(player);
}
 
Example 60
Project: ProjectAres   File: RenderedBossBar.java   Source Code and License 4 votes vote down vote up
@Override
public void removeAll() {
    views.values().forEach(BossBar::removeAll);
    views.clear();
}