本文整理匯總了Java中org.bukkit.Bukkit.createBossBar方法的典型用法代碼示例。如果您正苦於以下問題:Java Bukkit.createBossBar方法的具體用法?Java Bukkit.createBossBar怎麽用?Java Bukkit.createBossBar使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.Bukkit
的用法示例。
在下文中一共展示了Bukkit.createBossBar方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getBar
import org.bukkit.Bukkit; //導入方法依賴的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: doInit
import org.bukkit.Bukkit; //導入方法依賴的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);
}
示例3: start
import org.bukkit.Bukkit; //導入方法依賴的package包/類
@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;
}
示例4: initBossBar
import org.bukkit.Bukkit; //導入方法依賴的package包/類
@Override
public BossBar initBossBar() {
BossBar bossBar = Bukkit.createBossBar("", BarColor.BLUE, BarStyle.SOLID);
bossBar.setVisible(false);
return bossBar;
}
示例5: initBossBar
import org.bukkit.Bukkit; //導入方法依賴的package包/類
@Override
public BossBar initBossBar() {
BossBar bossBar = Bukkit.createBossBar("", BarColor.GREEN, BarStyle.SOLID);
bossBar.setVisible(false);
return bossBar;
}
示例6: start
import org.bukkit.Bukkit; //導入方法依賴的package包/類
@Override
public void start() {
bossBar = Bukkit.createBossBar(message, color, style);
getPhase().getGame().getPlayers().forEach(user -> bossBar.addPlayer(user.getPlayer()));
}
示例7: onEnable
import org.bukkit.Bukkit; //導入方法依賴的package包/類
/**
* 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.");
}