當前位置: 首頁>>代碼示例>>Java>>正文


Java BarColor類代碼示例

本文整理匯總了Java中org.bukkit.boss.BarColor的典型用法代碼示例。如果您正苦於以下問題:Java BarColor類的具體用法?Java BarColor怎麽用?Java BarColor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BarColor類屬於org.bukkit.boss包,在下文中一共展示了BarColor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getBar

import org.bukkit.boss.BarColor; //導入依賴的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);
}
 
開發者ID:SamaGames,項目名稱:SamaGamesAPI,代碼行數:33,代碼來源:BossBarAPI.java

示例2: updateArena

import org.bukkit.boss.BarColor; //導入依賴的package包/類
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());
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:18,代碼來源:TicketDisplay.java

示例3: doInit

import org.bukkit.boss.BarColor; //導入依賴的package包/類
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);
}
 
開發者ID:mattboy9921,項目名稱:SkipNight,代碼行數:23,代碼來源:Vote.java

示例4: doFinal

import org.bukkit.boss.BarColor; //導入依賴的package包/類
private void doFinal() {
    countDown--;
    bar.setProgress((double) countDown / 30.0);
    bar.setTitle("Current Vote: "
            + ChatColor.GREEN + ChatColor.BOLD + "Yes "
            + ChatColor.RESET + "- " + yes
            + ChatColor.DARK_RED + ChatColor.BOLD +  " No "
            + ChatColor.RESET + "- " + no);
    if (countDown == 9) voters = updateAll(voters, Messages.tenSecondsLeft());
    else voters = updateAll(voters);

    if (countDown % 2 == 1) bar.setColor(BarColor.WHITE);
    else bar.setColor(BarColor.PURPLE);

    if (countDown == 0) timer = Timer.COMPLETE;
    plugin.getServer().getScheduler().runTaskLater(plugin, this, 20);
}
 
開發者ID:mattboy9921,項目名稱:SkipNight,代碼行數:18,代碼來源:Vote.java

示例5: doBar

import org.bukkit.boss.BarColor; //導入依賴的package包/類
/**
 * 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);
    }
}
 
開發者ID:redwallhp,項目名稱:AthenaGM,代碼行數:21,代碼來源:Vote.java

示例6: start

import org.bukkit.boss.BarColor; //導入依賴的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);
}
 
開發者ID:Dove-Bren,項目名稱:QuestManager,代碼行數:18,代碼來源:ForgeSequence.java

示例7: update

import org.bukkit.boss.BarColor; //導入依賴的package包/類
private void update() {
	if (this.state != State.RUNNING) {
		return;
	}
	
	if (isCooling) {
		displayBar.setColor(BarColor.BLUE);
		displayBar.setProgress(1.0 - (timeLeft / coolTime));
		
		if (timeLeft <= 0) {
			finishGame();
			return;
		}
	} else {
		displayBar.setColor(BarColor.RED);
		displayBar.setProgress(timeLeft / heatTime);
	}
}
 
開發者ID:Dove-Bren,項目名稱:QuestManager,代碼行數:19,代碼來源:ForgeSequence.java

示例8: start

import org.bukkit.boss.BarColor; //導入依賴的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)));
	}
 
開發者ID:Dove-Bren,項目名稱:QuestManager,代碼行數:25,代碼來源:FishingGui.java

示例9: update

import org.bukkit.boss.BarColor; //導入依賴的package包/類
private void update() {
	displayBar.setProgress(Math.max(0, cookTime / maxCookTime));
	failBar.setProgress(Math.min(1, missIndex));
	
	if (missIndex < .20)
		failBar.setColor(BarColor.RED);
	
	if (furnace.getBurnTime() > 200) {
		loseGame();
		player.getWorld().playSound(player.getLocation(), BURN_SOUND, 1, 1);
	}
	if (furnace.getBurnTime() < 0)
		loseGame();
	
	if (missIndex > 1.0) 
		loseGame();
	
	if (cookTime <= 0)
		winGame();
	
}
 
開發者ID:Dove-Bren,項目名稱:QuestManager,代碼行數:22,代碼來源:CookingGui.java

示例10: PlayerState

import org.bukkit.boss.BarColor; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:NerdNu,項目名稱:WingCommander,代碼行數:27,代碼來源:PlayerState.java

示例11: Arena

import org.bukkit.boss.BarColor; //導入依賴的package包/類
/**
    * 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.");
	}
}
 
開發者ID:stefvanschie,項目名稱:buildinggame,代碼行數:22,代碼來源:Arena.java

示例12: setupBossBar

import org.bukkit.boss.BarColor; //導入依賴的package包/類
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();
}
 
開發者ID:fof1092,項目名稱:TimeVote,代碼行數:18,代碼來源:TimeVote.java

示例13: run

import org.bukkit.boss.BarColor; //導入依賴的package包/類
@Override
public void run() {
    if (GameHandler.getGameHandler().getMatch().isRunning()) {
        int timeLimit = TimeLimit.getMatchTimeLimit();
        double time = MatchTimer.getTimeInSeconds();
        if (timeLimit > 0) {
            double timeRemaining = timeLimit - time;
            BossBars.setProgress(bossBar, timeRemaining / timeLimit);
            if (lastSecond != (int) time) {
                lastSecond = (int) time;
                BossBars.setTitle(bossBar, new UnlocalizedChatMessage(ChatColor.AQUA + "{0} " + ChatUtil.getTimerColor(timeRemaining) + "{1}", new LocalizedChatMessage(ChatConstant.UI_TIMER), new UnlocalizedChatMessage(Strings.formatTime(timeRemaining + 1))));
                if (timeRemaining < 30) {
                    BossBars.broadcastedBossBars.get(bossBar).setColor(BarColor.RED);
                } else if (timeRemaining < 60) {
                    BossBars.broadcastedBossBars.get(bossBar).setColor(BarColor.YELLOW);
                } else {
                    BossBars.broadcastedBossBars.get(bossBar).setColor(BarColor.GREEN);
                }
            }
        } else if (lastSecond != (int) time) {
            lastSecond = (int) time;
            if ((int)time % 300 == 0) sendTimeElapsedMessage(time);
        }
    }
}
 
開發者ID:twizmwazin,項目名稱:CardinalPGM,代碼行數:26,代碼來源:TimeNotifications.java

示例14: onTick

import org.bukkit.boss.BarColor; //導入依賴的package包/類
@Override
protected void onTick() {
    if(isCancelled()) return;

    int amountParticipating = teamManagerModule.getAmountParticipating();
    if (amountParticipating < REQUIRED_PLAYERS) {
        int needed = REQUIRED_PLAYERS - amountParticipating;
        getBossBar().setProgress(1);
        getBossBar().setTitle(ChatColor.RED + "Waiting for " + ChatColor.AQUA + needed +
                ChatColor.RED + " more player" + (needed == 1 ? "" : "s") + " to join");
        getBossBar().setColor(BarColor.RED);

        setTimeLeft(getTimeMax());
        return;
    }

    getBossBar().setProgress((getTimeMax() - getTimeLeft()) / getTimeMax());

    if (getTimeLeft() % 20 == 0) {
        getBossBar().setColor(BarColor.GREEN);
        getBossBar().setTitle(ChatColor.GREEN + "Match starting in " + ChatColor.DARK_RED + getTimeLeftSeconds() +
                ChatColor.GREEN + " second" + (getTimeLeftSeconds() > 1 ? "s" : ""));

        if (getTimeLeftSeconds() <= 3) {
            for (Player player : Bukkit.getOnlinePlayers()) {
                player.playSound(player.getLocation(), Sound.BLOCK_NOTE_PLING, 1, 1);
                if (!TGM.get().getModule(TeamManagerModule.class).getSpectators().containsPlayer(player)) {
                    player.sendTitle(ChatColor.YELLOW.toString() + getTimeLeftSeconds(), "", 0, 5, 15);
                }
            }
        }
    }
}
 
開發者ID:WarzoneMC,項目名稱:Warzone,代碼行數:34,代碼來源:StartCountdown.java

示例15: GameVotingRunnable

import org.bukkit.boss.BarColor; //導入依賴的package包/類
public GameVotingRunnable() {
    this.api = Arcadia.getPlugin(Arcadia.class).getAPI();
    api.getGameManager().getMainBossBar().setColor(BarColor.YELLOW);
    List<Class<? extends BaseGame>> temp = api.getGameRegistry().getRegisteredGames();
    List<String> allowedGames = api.getPlugin().mainConfiguration.fetch().getStringList("games-in-voting");
    Iterator<Class<? extends BaseGame>> iterator = temp.iterator();
    while(iterator.hasNext()) {
        Class<? extends BaseGame> next = iterator.next();
        if(!allowedGames.contains(next.getName())) iterator.remove();
    }
    Collections.shuffle(temp);
    int slot = 2;
    for(int i=0; i<5; i++) {
        if(i < temp.size()) {
            slots.put(slot, temp.get(i));
            slot++;
        }
    }
    Bukkit.getOnlinePlayers().forEach(player -> {
        for(int i=0; i<9; i++) {
            Utils.setSpacer(player, i);
        }
        int s = 2;
        for(Class<? extends BaseGame> key : slots.values()) {
            final VotingData votingData = api.getGameRegistry().getVotingData(key);
            ItemStack itemStack = new ItemStack(votingData.getMaterialData().getItemType(), 1,
                votingData.getMaterialData().getData());
            ItemMeta itemMeta = itemStack.getItemMeta();
            itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&b&l" + votingData.getGameName()));
            itemStack.setItemMeta(itemMeta);
            player.getInventory().setItem(s, itemStack);
            s++;
        }
    });
    api.getPlugin().getServer().getPluginManager().registerEvents(this, api.getPlugin());
    this.runTaskTimer(Arcadia.getPlugin(Arcadia.class), 0, 20L);
}
 
開發者ID:ArcadiaPlugins,項目名稱:Arcadia-Spigot,代碼行數:38,代碼來源:GameVotingRunnable.java


注:本文中的org.bukkit.boss.BarColor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。