org.bukkit.Bukkit.createBossBar()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(1.6k)|赞(0)|评价(0)|浏览(152)

本文整理了Java中org.bukkit.Bukkit.createBossBar()方法的一些代码示例,展示了Bukkit.createBossBar()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bukkit.createBossBar()方法的具体详情如下:
包路径:org.bukkit.Bukkit
类名称:Bukkit
方法名:createBossBar

Bukkit.createBossBar介绍

暂无

代码示例

代码示例来源:origin: confuser/BarAPI

public v1_9(String name, Location loc) {
 super(name, loc);
 bar = Bukkit.createBossBar(name, BarColor.PINK, BarStyle.SOLID);
}

代码示例来源:origin: garbagemule/MobArena

BossHealthBar(String title) {
  bar = Bukkit.createBossBar(
    title.isEmpty() ? "Boss" : title,
    BarColor.GREEN,
    BarStyle.SOLID,
    BarFlag.PLAY_BOSS_MUSIC,
    BarFlag.DARKEN_SKY
  );
}

代码示例来源:origin: nsporillo/GlobalWarming

World world = Bukkit.getWorld(worldId);
if (world != null) {
  BossBar bossBar = Bukkit.createBossBar(
     getNotificationMessage(worldId),
     BarColor.WHITE,

代码示例来源:origin: eccentricdevotion/TARDIS

void showTravelRemaining(Player player, long duration, boolean takeoff) {

    String title = (takeoff) ? plugin.getLanguage().getString("TRAVEL_BAR_TAKEOFF") : plugin.getLanguage().getString("TRAVEL_BAR_LAND");
    BossBar bb = Bukkit.createBossBar(title, BarColor.WHITE, BarStyle.SOLID, EMPTY_ARRAY);
    bb.setProgress(0);
    bb.addPlayer(player);
    bb.setVisible(true);
    double millis = duration * 50.0d;
    long start = System.currentTimeMillis();
    double end = start + millis;
    taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, () -> {
      long now = System.currentTimeMillis();
      if (now < end) {
        double progress = 1 - (end - now) / millis;
        bb.setProgress(progress);
      } else {
        bb.setProgress(1);
        bb.setVisible(false);
        bb.removeAll();
        Bukkit.getScheduler().cancelTask(taskID);
        taskID = 0;
      }
    }, 1L, 1L);
  }
}

相关文章