本文整理汇总了Java中org.bukkit.boss.BarFlag类的典型用法代码示例。如果您正苦于以下问题:Java BarFlag类的具体用法?Java BarFlag怎么用?Java BarFlag使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BarFlag类属于org.bukkit.boss包,在下文中一共展示了BarFlag类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBar
import org.bukkit.boss.BarFlag; //导入依赖的package包/类
/**
* 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);
}
示例2: start
import org.bukkit.boss.BarFlag; //导入依赖的package包/类
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);
}
示例3: start
import org.bukkit.boss.BarFlag; //导入依赖的package包/类
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)));
}
示例4: addPlayer
import org.bukkit.boss.BarFlag; //导入依赖的package包/类
@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);
}
}
示例5: update
import org.bukkit.boss.BarFlag; //导入依赖的package包/类
@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));
}
示例6: tick
import org.bukkit.boss.BarFlag; //导入依赖的package包/类
@Override
public void tick() {
super.tick();
if (ticks == 0) {
updatePlayerStates(GameState.ASSIGN, null);
}
if (ticks == 1) {//Assign
List<UUID> toAssign = new ArrayList<>(game.players);
//Pick a murderer
updateRole(toAssign.remove(random.nextInt(toAssign.size())), Role.MURDERER);
//Pick a weapon bystander
updateRole(toAssign.remove(random.nextInt(toAssign.size())), Role.WEAPON);
//Make all other players bystanders
while (!toAssign.isEmpty()) {
updateRole(toAssign.remove(0), Role.DEFAULT);
}
}
if (ticks == 2) {//Send role messages
for (UUID uuid : game.players) {
PlayerData data = Murder.instance.playerManager.getData(uuid);
//Titles
TitleAPI.reset(data.getPlayer());
TitleAPI.sendTimings(data.getPlayer(), 10, (Murder.instance.startTime * 20) - 5, 10);
TitleAPI.sendSubTitle(data.getPlayer(), new TextComponent(data.role.getSubTitle()));
TitleAPI.sendTitle(data.getPlayer(), new TextComponent(data.role.getTitle()));
//BossBar
TextComponent textComponent = new TextComponent(String.format(data.role.getBarText(), data.nameTag));
data.bossBar = Bukkit.createBossBar(textComponent.getText(), data.role.getBarColor(), data.role.getBarStyle(), BarFlag.DARKEN_SKY);
data.bossBar.addPlayer(data.getPlayer());
}
}
ticks++;
}
示例7: start
import org.bukkit.boss.BarFlag; //导入依赖的package包/类
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);
}
示例8: alarm
import org.bukkit.boss.BarFlag; //导入依赖的package包/类
@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);
}
}
示例9: start
import org.bukkit.boss.BarFlag; //导入依赖的package包/类
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;
}
示例10: get
import org.bukkit.boss.BarFlag; //导入依赖的package包/类
@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};
}
示例11: init
import org.bukkit.boss.BarFlag; //导入依赖的package包/类
@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;
}
示例12: get
import org.bukkit.boss.BarFlag; //导入依赖的package包/类
@Override
@Nullable
protected BarFlag[] get(Event e) {
if (bar == null) {
return null;
}
ArrayList<BarFlag> flags = new ArrayList<BarFlag>();
for (BarFlag flag : BarFlag.values()) {
if (bar.getSingle(e).hasFlag(flag)) {
flags.add(flag);
}
}
return flags.toArray(new BarFlag[flags.size()]);
}
示例13: init
import org.bukkit.boss.BarFlag; //导入依赖的package包/类
@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;
}
示例14: addFlag
import org.bukkit.boss.BarFlag; //导入依赖的package包/类
/**
* 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);
}
}
示例15: removeFlag
import org.bukkit.boss.BarFlag; //导入依赖的package包/类
/**
* 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);
}
}