Java 类org.bukkit.boss.BarStyle 实例源码
项目:SamaGamesAPI
文件:BossBarAPI.java
/**
* 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);
}
项目:ProjectAres
文件:TicketDisplay.java
private void updateArena(Arena arena) {
final Game game = games.byId(arena.game_id());
int minPlayers = 0;
if(arena.next_server_id() != null) {
minPlayers = servers.byId(arena.next_server_id()).min_players();
}
final BaseComponent text;
final double progress;
if(minPlayers > 0 && arena.num_queued() < minPlayers) {
text = gameFormatter.queued(game, minPlayers - arena.num_queued());
progress = (double) arena.num_queued() / (double) minPlayers;
} else {
text = gameFormatter.joining(game);
progress = 1;
}
bars.getUnchecked(arena).update(text, progress, BarColor.YELLOW, BarStyle.SOLID, Collections.emptySet());
}
项目:SkipNight
文件:Vote.java
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);
}
项目:AthenaGM
文件:Vote.java
/**
* Manage the creation, updating and removal of a BossBar to show remaining vote time.
*/
private void doBar() {
long elapsed = (System.currentTimeMillis() - timeCreated) / 1000;
int seconds = 60 - (int) elapsed;
String title = String.format("%d seconds left to vote", seconds);
if (bar == null) {
// create bar
bar = arena.getPlugin().getServer().createBossBar(title, BarColor.WHITE, BarStyle.SEGMENTED_10);
arena.getMatch().getAllPlayers().forEach(bar::addPlayer);
} else if (seconds < 1) {
// remove bar
removeBar();
} else {
// update bar
bar.setProgress(calculatePercentage(seconds, 60));
bar.setTitle(title);
}
}
项目:QuestManager
文件:ForgeSequence.java
public void start() {
if (!player.getPlayer().isOnline())
return;
state = State.STARTING;
Alarm.getScheduler().schedule(this, 0, 1);
player.getPlayer().getPlayer().sendMessage(ChatColor.GREEN + "Get Ready...");
this.displayBar = Bukkit.createBossBar(displayName, BarColor.BLUE, BarStyle.SEGMENTED_20, new BarFlag[0]);
displayBar.setProgress(1f);
displayBar.addPlayer(player.getPlayer().getPlayer());
this.timeLeft = coolTime;
isCooling = true;
Bukkit.getPluginManager().registerEvents(this, QuestManagerPlugin.questManagerPlugin);
}
项目:QuestManager
文件:FishingGui.java
public void start() {
//Set up top bar
inv.setItem(0, this.reelOffIcon);
// for (int i = 1; i < 4; i++) {
// inv.setItem(i, this.meterOnIcon);
// }
// for (int i = 4; i < 8; i++) {
// inv.setItem(i, this.meterOffIcon);
// }
inv.setItem(8, this.reelOnIcon);
displayBar = Bukkit.createBossBar("Fishing Progress", BarColor.BLUE, BarStyle.SEGMENTED_20, new BarFlag[0]);
displayBar.setProgress(1f);
displayBar.addPlayer(player);
stressBar = Bukkit.createBossBar("Line Stress", BarColor.GREEN, BarStyle.SEGMENTED_10, new BarFlag[0]);
stressBar.setProgress(lineStress);
stressBar.addPlayer(player);
//start filling the 'sea'
//time is time to fill all in 5 seconds, or .2 if less than that (it would be too fast!)
Alarm.getScheduler().schedule(this, 0, Math.max(.2, 5 / (9 * this.waterRows)));
}
项目:WingCommander
文件:PlayerState.java
/**
* Constructor.
*
* @param player the player.
* @param config the configuration from which player preferences are loaded.
*/
public PlayerState(Player player, YamlConfiguration config) {
_player = player;
_altitudeBossBar = Bukkit.getServer().createBossBar("Altitude", BarColor.BLUE, BarStyle.SEGMENTED_20);
_altitudeBossBar.addPlayer(_player);
_altitudeBossBar.setProgress(0);
_altitudeBossBar.setVisible(false);
_speedBossBar = Bukkit.getServer().createBossBar("Speed", WingCommander.CONFIG.SPEEDOMETER_COLOUR, BarStyle.SEGMENTED_20);
_speedBossBar.addPlayer(_player);
_speedBossBar.setProgress(0);
_speedBossBar.setVisible(false);
_wingsBossBar = Bukkit.getServer().createBossBar("Wings", BarColor.GREEN, BarStyle.SEGMENTED_20);
_wingsBossBar.addPlayer(_player);
_wingsBossBar.setProgress(1.0);
_wingsBossBar.setVisible(false);
_pitchBossBar = Bukkit.getServer().createBossBar("Pitch", BarColor.GREEN, BarStyle.SEGMENTED_20);
_pitchBossBar.addPlayer(_player);
_pitchBossBar.setProgress(0.5);
_pitchBossBar.setVisible(false);
load(config);
}
项目:buildinggame
文件:Arena.java
/**
* Constructs a new arena with the given name as identifier
*
* @param name the name of the arena
*/
public Arena(String name) {
YamlConfiguration config = SettingsManager.getInstance().getConfig();
this.name = name;
try {
this.bossbar = Bukkit.createBossBar(MessageManager.translate(SettingsManager.getInstance().getMessages()
.getString("global.bossbar-header").replace("%subject%", "?")),
BarColor.valueOf(config.getString("bossbar.color").toUpperCase(Locale.getDefault())),
BarStyle.valueOf(config.getString("bossbar.style").toUpperCase(Locale.getDefault())));
getBossBar().setVisible(false);
} catch (IllegalArgumentException e) {
Main.getInstance().getLogger().warning("Bossbar couldn't be loaded, check the data and try again.");
}
}
项目:TimeVote
文件:TimeVote.java
protected void setupBossBar() {
String timeString = Options.msg.get("bossBarMessage");
if (getTime() == Time.DAY) {
timeString = timeString.replace("[TIME]", Options.msg.get("text.1"));
} else {
timeString = timeString.replace("[TIME]", Options.msg.get("text.2"));
}
this.bossbar = Bukkit.createBossBar(timeString, BarColor.YELLOW, BarStyle.SEGMENTED_20);
for (Player p : getAllPlayersAtWorld()) {
setupBossBar(p);
}
bossBarTimer();
}
项目:PlayerStevesBattleGrounds
文件:BattlesTimerTask.java
@Override
public void start() {
seconds = plugin.getConfig().getInt("battles.time");
bar1 = plugin.getServer().createBossBar("", BarColor.WHITE, BarStyle.SOLID);
bar2 = plugin.getServer().createBossBar("", BarColor.GREEN, BarStyle.SOLID);
bar1.setVisible(true);
bar2.setVisible(true);
plugin.getServer().getOnlinePlayers().forEach(p -> {
bar1.addPlayer(p);
bar2.addPlayer(p);
});
setTask(plugin.getServer().getScheduler().runTaskTimer(plugin, this, 0L, 20L));
}
项目:ProjectAres
文件:BossBarMatchModule.java
View(BossBarSource source, Player viewer) {
this.source = source;
this.viewer = viewer;
this.bar = bossBarFactory.createBossBar(Components.blank(), BarColor.WHITE, BarStyle.SOLID);
render();
bar.addPlayer(viewer);
}
项目:ProjectAres
文件:PlayerListener.java
@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));
}
项目:ProjectAres
文件:RenderedBossBar.java
@Override
public void update(BaseComponent title, double progress, BarColor color, BarStyle style, Set<BarFlag> flags) {
this.title = title;
this.progress = progress;
this.color = color;
this.style = style;
this.flags.clear();
this.flags.addAll(flags);
views.entrySet().forEach(entry -> entry.getValue().update(renderer.render(title, entry.getKey()), progress, color, style, flags));
}
项目:VoxelGamesLibv2
文件:TimedPhase.java
@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;
}
项目:DragonEggDrop
文件:DragonBattle1_10_R1.java
@Override
public boolean setBossBarStyle(BarStyle style, BarColor colour) {
try {
Field fieldBossBattleServer = EnderDragonBattle.class.getDeclaredField("c");
fieldBossBattleServer.setAccessible(true);
BossBattleServer battleServer = (BossBattleServer) fieldBossBattleServer.get(battle);
if (battleServer == null) return false;
if (style != null) {
String nmsStyle = style.name().contains("SEGMENTED") ? style.name().replace("SEGMENTED", "NOTCHED") : "PROGRESS";
if (EnumUtils.isValidEnum(BossBattle.BarStyle.class, nmsStyle)) {
battleServer.style = BossBattle.BarStyle.valueOf(nmsStyle);
}
}
if (colour != null) {
battleServer.color = BossBattle.BarColor.valueOf(colour.name());
}
battleServer.sendUpdate(PacketPlayOutBoss.Action.UPDATE_STYLE);
fieldBossBattleServer.setAccessible(false);
} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
e.printStackTrace();
return false;
}
return true;
}
项目:DragonEggDrop
文件:DragonBattle1_12_R1.java
@Override
public boolean setBossBarStyle(BarStyle style, BarColor colour) {
try {
Field fieldBossBattleServer = EnderDragonBattle.class.getDeclaredField("c");
fieldBossBattleServer.setAccessible(true);
BossBattleServer battleServer = (BossBattleServer) fieldBossBattleServer.get(battle);
if (battleServer == null) return false;
if (style != null) {
String nmsStyle = style.name().contains("SEGMENTED") ? style.name().replace("SEGMENTED", "NOTCHED") : "PROGRESS";
if (EnumUtils.isValidEnum(BossBattle.BarStyle.class, nmsStyle)) {
battleServer.style = BossBattle.BarStyle.valueOf(nmsStyle);
}
}
if (colour != null) {
battleServer.color = BossBattle.BarColor.valueOf(colour.name());
}
battleServer.sendUpdate(PacketPlayOutBoss.Action.UPDATE_STYLE);
fieldBossBattleServer.setAccessible(false);
} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
e.printStackTrace();
return false;
}
return true;
}
项目:DragonEggDrop
文件:DragonBattle1_9_R1.java
@Override
public boolean setBossBarStyle(BarStyle style, BarColor colour) {
try {
Field fieldBossBattleServer = EnderDragonBattle.class.getDeclaredField("c");
fieldBossBattleServer.setAccessible(true);
BossBattleServer battleServer = (BossBattleServer) fieldBossBattleServer.get(battle);
if (battleServer == null) return false;
if (style != null) {
String nmsStyle = style.name().contains("SEGMENTED") ? style.name().replace("SEGMENTED", "NOTCHED") : "PROGRESS";
if (EnumUtils.isValidEnum(BossBattle.BarStyle.class, nmsStyle)) {
battleServer.style = BossBattle.BarStyle.valueOf(nmsStyle);
}
}
if (colour != null) {
battleServer.color = BossBattle.BarColor.valueOf(colour.name());
}
battleServer.sendUpdate(PacketPlayOutBoss.Action.UPDATE_STYLE);
fieldBossBattleServer.setAccessible(false);
} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
e.printStackTrace();
return false;
}
return true;
}
项目:DragonEggDrop
文件:DragonBattle1_9_R2.java
@Override
public boolean setBossBarStyle(BarStyle style, BarColor colour) {
try {
Field fieldBossBattleServer = EnderDragonBattle.class.getDeclaredField("c");
fieldBossBattleServer.setAccessible(true);
BossBattleServer battleServer = (BossBattleServer) fieldBossBattleServer.get(battle);
if (battleServer == null) return false;
if (style != null) {
String nmsStyle = style.name().contains("SEGMENTED") ? style.name().replace("SEGMENTED", "NOTCHED") : "PROGRESS";
if (EnumUtils.isValidEnum(BossBattle.BarStyle.class, nmsStyle)) {
battleServer.style = BossBattle.BarStyle.valueOf(nmsStyle);
}
}
if (colour != null) {
battleServer.color = BossBattle.BarColor.valueOf(colour.name());
}
battleServer.sendUpdate(PacketPlayOutBoss.Action.UPDATE_STYLE);
fieldBossBattleServer.setAccessible(false);
} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
e.printStackTrace();
return false;
}
return true;
}
项目:DragonEggDrop
文件:DragonBattle1_11_R1.java
@Override
public boolean setBossBarStyle(BarStyle style, BarColor colour) {
try {
Field fieldBossBattleServer = EnderDragonBattle.class.getDeclaredField("c");
fieldBossBattleServer.setAccessible(true);
BossBattleServer battleServer = (BossBattleServer) fieldBossBattleServer.get(battle);
if (battleServer == null) return false;
if (style != null) {
String nmsStyle = style.name().contains("SEGMENTED") ? style.name().replace("SEGMENTED", "NOTCHED") : "PROGRESS";
if (EnumUtils.isValidEnum(BossBattle.BarStyle.class, nmsStyle)) {
battleServer.style = BossBattle.BarStyle.valueOf(nmsStyle);
}
}
if (colour != null) {
battleServer.color = BossBattle.BarColor.valueOf(colour.name());
}
battleServer.sendUpdate(PacketPlayOutBoss.Action.UPDATE_STYLE);
fieldBossBattleServer.setAccessible(false);
} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
e.printStackTrace();
return false;
}
return true;
}
项目:DragonEggDrop
文件:DragonTemplate.java
/**
* Construct a new DragonTemplate object
*
* @param file the file holding this template data
* @param name the name of the dragon. Can be null
* @param barStyle the style of the bar. Can be null
* @param barColour the colour of the bar. Can be null
*/
public DragonTemplate(File file, String name, BarStyle barStyle, BarColor barColour) {
Validate.notNull(file, "File cannot be null. See DragonTemplate(String, String, BarStyle, BarColor) for null files");
this.file = file;
this.configFile = YamlConfiguration.loadConfiguration(file);
this.identifier = file.getName().substring(0, file.getName().lastIndexOf('.'));
this.name = (name != null ? ChatColor.translateAlternateColorCodes('&', name) : null);
this.barStyle = (barStyle != null ? barStyle : BarStyle.SOLID);
this.barColour = (barColour != null ? barColour : BarColor.PINK);
this.loot = new DragonLoot(this);
}
项目:DragonEggDrop
文件:DragonTemplate.java
/**
* Construct a new DragonTemplate object
*
* @param identifier the name to identify this template
* @param name the name of the dragon. Can be null
* @param barStyle the style of the bar. Can be null
* @param barColour the colour of the bar. Can be null
*/
public DragonTemplate(String identifier, String name, BarStyle barStyle, BarColor barColour) {
Validate.notEmpty(identifier, "Idenfitier must not be empty or null");
this.file = null;
this.configFile = null;
this.identifier = identifier;
this.name = (name != null ? ChatColor.translateAlternateColorCodes('&', name) : null);
this.barStyle = (barStyle != null ? barStyle : BarStyle.SOLID);
this.barColour = (barColour != null ? barColour : BarColor.PINK);
this.loot = new DragonLoot(this);
}
项目:DragonEggDrop
文件:DragonTemplate.java
/**
* Set the style of the boss bar
*
* @param barStyle the new boss bar style
* @param updateFile whether to update the dragon file or not
*/
public void setBarStyle(BarStyle barStyle, boolean updateFile) {
this.barStyle = barStyle;
if (updateFile) {
this.updateConfig("bar-style", barStyle);
}
}
项目:RealisticSwimming
文件:StaminaBar_Native.java
StaminaBar_Native(Player player){
super(player);
//****************************** Changes by DrkMatr1984 START ******************************
if(ChatColor.translateAlternateColorCodes('&', Language.stamina).length()>64)
staminaBar = Bukkit.createBossBar(ChatColor.translateAlternateColorCodes('&', Language.stamina).substring(0, 63), BarColor.GREEN, BarStyle.SOLID);
else
staminaBar = Bukkit.createBossBar(ChatColor.translateAlternateColorCodes('&', Language.stamina), BarColor.GREEN, BarStyle.SOLID);
//****************************** Changes by DrkMatr1984 END ******************************
staminaBar.addPlayer(p);
}
项目:Thirst
文件:ThirstManager.java
private BarStyle validateStyle(String name)
{
try
{
return Enum.valueOf(BarStyle.class, name.toUpperCase());
}
catch (IllegalArgumentException iae)
{
return null;
}
}
项目:NationZ
文件:NZPlayer.java
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));
}
项目:GameBoxx
文件:BarStyles.java
@Override
public void onLoad() {
add(BarStyle.SOLID, "Solid", "0", "None", "Blank", "Default", "Def", "D", "S");
add(BarStyle.SEGMENTED_6, "6 Segments", "6", "6S", "S6", "1", "S1");
add(BarStyle.SEGMENTED_10, "10 Segments", "10", "10S", "S10", "2", "S2");
add(BarStyle.SEGMENTED_12, "12 Segments", "12", "12S", "S12", "3", "S3");
add(BarStyle.SEGMENTED_20, "20 Segments", "20", "20S", "S20", "4", "S4");
}
项目:Arcade2
文件:MatchStartCountdown.java
public MatchStartCountdown(ArcadePlugin plugin, Match match) {
super(plugin.getTasks(), null);
this.plugin = plugin;
this.match = match;
this.setBossBar(plugin.getServer().createBossBar(new TextComponent(), BarColor.GREEN, BarStyle.SOLID));
}
项目:MoreFish
文件:BossBarManager.java
public void createTimerBar(long sec) {
String title = plugin.getLocale().getString("timer-boss-bar")
.replaceAll("%time%", plugin.getTimeString(sec));
BarColor color = BarColor.valueOf(plugin.getConfig().getString("messages.contest-bar-color").toUpperCase());
timerBar = plugin.getServer().createBossBar(title, color, BarStyle.SEGMENTED_10);
for (Player player : plugin.getServer().getOnlinePlayers()) {
timerBar.addPlayer(player);
}
}
项目:QuestManager
文件:LumberjackSequence.java
public void start() {
if (!player.getPlayer().isOnline())
return;
state = State.STARTING;
Alarm.getScheduler().schedule(this, 0, 1);
player.getPlayer().getPlayer().sendMessage(ChatColor.GREEN + "Get Ready...");
this.displayBar = Bukkit.createBossBar(displayName, BarColor.BLUE, BarStyle.SEGMENTED_20, new BarFlag[0]);
displayBar.setProgress(1f);
displayBar.addPlayer(player.getPlayer().getPlayer());
Bukkit.getPluginManager().registerEvents(this, QuestManagerPlugin.questManagerPlugin);
}
项目:QuestManager
文件:MiningGui.java
@Override
public void alarm(Integer key) {
if (gameState == State.STARTING) {
if (key >= startingSpots) {
if (player.isOnline())
player.sendMessage(ChatColor.GREEN + "Go!");
this.gameState = State.RUNNING;
displayBar = Bukkit.createBossBar("Ore Stability", BarColor.BLUE, BarStyle.SEGMENTED_20, new BarFlag[0]);
displayBar.setProgress(1f);
displayBar.addPlayer(player);
return;
}
//pick a spots to reveal
int cur = RANDOM.nextInt(depth * 9);
if (backend.get(cur) == BlockMaterial.ORE || backend.get(cur) == BlockMaterial.AIR) {
alarm(key);
} else {
//else reveal it
if (player.isOnline())
player.playSound(player.getLocation(), HIT_SOUND_STONE, 1, 1.5f);
for (int j = 0; j < 3; j++)
hitBlock(cur);
}
Alarm.getScheduler().schedule(this, key + 1, .5);
}
}
项目:QuestManager
文件:SmeltingGui.java
public void start() {
if (gameState != State.STOPPED) {
return;
}
//generate blocks.
//first block is the button
inv.setItem(0, SMELT_BUTTON_ICON);
ItemStack slot;
for (int i = 1; i < 9 * rows; i++) {
if (RANDOM.nextDouble() < metalRatio) {
//it's metal. pick one
slot = inputs.get(RANDOM.nextInt(inputs.size()));
generatedMetals++;
} else {
slot = SLAG_ICON;
this.slagSlots.add(i);
}
inv.setItem(i, slot);
backend.put(i, slot);
}
displayBar = Bukkit.createBossBar("Ore Temperature", BarColor.RED, BarStyle.SEGMENTED_20, new BarFlag[0]);
displayBar.setProgress(0f);
displayBar.addPlayer(player);
player.getPlayer().sendMessage(ChatColor.GREEN + "Begin");
player.playSound(player.getLocation(), START_SOUND, 1, 1);
this.gameState = State.SOLID;
currentClicks = 0;
currentHeats = 0;
discardedMetals = 0;
}
项目:Skellett
文件:ExprBarStyle.java
@Override
@Nullable
protected BarStyle[] get(Event e) {
if (bar == null) {
return null;
}
return new BarStyle[]{bar.getSingle(e).getStyle()};
}
项目:Skellett
文件:ExprBarStyle.java
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode){
if (bar == null) {
return;
}
if (mode == ChangeMode.SET) {
BarStyle style = (BarStyle)delta[0];
bar.getSingle(e).setStyle(style);
}
}
项目:Skellett
文件:ExprNewBossBar.java
@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};
}
项目:mcMMOExtras
文件:SpigotBarApi.java
@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);
}
}
项目:mcMMOExtras
文件:SpigotBarApi.java
private void parseSpecificConfig(ConfigurationSection config) {
BarStyle defaultStyle = parseStyle(config.getString("segments"), BarStyle.SOLID);
BarColor defaultBarColor = parseColor(config.getString("color"), BarColor.WHITE);
for (SkillType skillType : SkillType.values()) {
String skillName = skillType.getName().toLowerCase();
BarColor color = parseColor(config.getString("bar.barColor." + skillName), defaultBarColor);
specificColor.put(skillType, color);
BarStyle style = parseStyle(config.getString("bar.segments." + skillName), defaultStyle);
specificStyle.put(skillType, style);
}
}
项目:NovaGuilds
文件:BossBarUtilsBukkitImpl.java
/**
* 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;
}
项目:skRayFall
文件:BossBarManager.java
/**
* 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);
}
}
项目:skRayFall
文件:EffCreateModernBossBar.java
@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);
}
项目:CardinalPGM
文件:MonumentModes.java
public MonumentModes(int after, final Pair<Material, Integer> material, final String name, int showBefore) {
this.after = after;
this.material = material;
this.name = name;
this.showBefore = showBefore;
this.ran = false;
this.bossBar = BossBars.addBroadcastedBossBar(new UnlocalizedChatMessage(""), BarColor.BLUE, BarStyle.SOLID, false);
}