类org.bukkit.boss.BarFlag源码实例Demo

下面列出了怎么用org.bukkit.boss.BarFlag的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: Kettle   文件: CraftBossBar.java
public CraftBossBar(String title, BarColor color, BarStyle style, BarFlag... flags) {
    this.flags = flags.length > 0 ? EnumSet.of(flags[0], flags) : EnumSet.noneOf(BarFlag.class);
    this.color = color;
    this.style = style;

    handle = new BossInfoServer(
            CraftChatMessage.fromString(title, true)[0],
            convertColor(color),
            convertStyle(style)
    );

    updateFlags();
}
 
源代码2 项目: ProjectAres   文件: RenderedBossBar.java
@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);
    }
}
 
源代码3 项目: 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));
}
 
源代码4 项目: skRayFall   文件: BossBarManager.java
/**
 * 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.
 */
void addFlag(String id, BarFlag flag) {
    BossBar bar = barMap.get(id);
    if (bar != null) {
        bar.addFlag(flag);
        barMap.put(id, bar);
    }
}
 
源代码5 项目: skRayFall   文件: BossBarManager.java
/**
 * 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.
 */
void removeFlag(String id, BarFlag flag) {
    BossBar bar = barMap.get(id);
    if (bar != null) {
        bar.removeFlag(flag);
        barMap.put(id, bar);
    }
}
 
源代码6 项目: FunnyGuilds   文件: BossBarOptions.java
public Builder flags(Collection<? extends String> barFlags) {
    for (String flag : barFlags) {
        for (BarFlag barFlag : BarFlag.values()) {
            if (barFlag.name().equalsIgnoreCase(flag)) {
                this.barFlags.add(barFlag);
            }
        }
    }

    return this;
}
 
源代码7 项目: CardinalPGM   文件: LocalizedBossBar.java
public LocalizedBossBar(ChatMessage bossBarTitle, BarColor color, BarStyle style, BarFlag... flags) {
    this.bossBarTitle = bossBarTitle;
    this.color = color;
    this.style = style;
    this.shown = true;
    this.flags = flags.length > 0 ? EnumSet.of(flags[0], flags):EnumSet.noneOf(BarFlag.class);
}
 
源代码8 项目: CardinalPGM   文件: LocalizedBossBar.java
public void removeFlag(BarFlag flag) {
    if (this.flags.contains(flag)) {
        this.flags.remove(flag);
        for (BossBar bossbar : playerBossBars.values()) {
            bossbar.setFlags(this.flags);
        }
    }
}
 
源代码9 项目: CardinalPGM   文件: LocalizedBossBar.java
public void addFlag(BarFlag flag) {
    if (!this.flags.contains(flag)) {
        this.flags.remove(flag);
        for (BossBar bossbar : playerBossBars.values()) {
            bossbar.setFlags(this.flags);
        }
    }
}
 
源代码10 项目: CardinalPGM   文件: LocalizedBossBar.java
public void addPlayer(Player player) {
    if (!playerBossBars.containsKey(player)) {
        BossBar bossBar = Bukkit.createBossBar(getTitle(player.getLocale()), this.color, this.style, this.flags.toArray(new BarFlag[flags.size()]));
        bossBar.setVisible(this.shown);
        bossBar.addPlayer(player);
        playerBossBars.put(player, bossBar);
    }
}
 
源代码11 项目: CardinalPGM   文件: BossBars.java
public static UUID addBroadcastedBossBar(ChatMessage bossBarTitle, BarColor color, BarStyle style, Boolean shown, BarFlag... flags) {
    UUID id = UUID.randomUUID();
    LocalizedBossBar bossBar = new LocalizedBossBar(bossBarTitle, color, style, flags);
    bossBar.setVisible(shown);
    for (Player player : Bukkit.getOnlinePlayers()) {
        bossBar.addPlayer(player);
    }
    broadcastedBossBars.put(id, bossBar);
    return id;
}
 
源代码12 项目: CraftserveRadiation   文件: BarConfig.java
public BarConfig(String title, BarColor color, BarStyle style, BarFlag[] flags) {
    this.title = Objects.requireNonNull(title, "title");
    this.color = Objects.requireNonNull(color, "color");
    this.style = Objects.requireNonNull(style, "style");
    this.flags = Objects.requireNonNull(flags, "flags");
}
 
源代码13 项目: CraftserveRadiation   文件: BarConfig.java
public BarFlag[] flags() {
    return this.flags;
}
 
源代码14 项目: CraftserveRadiation   文件: RadiationPlugin.java
private boolean migrate(ConfigurationSection section, int protocol) {
    Objects.requireNonNull(section, "section");
    Logger logger = this.getLogger();

    if (protocol > CURRENT_PROTOCOL_VERSION) {
        logger.severe("Your configuration file's protocol version \"" + protocol +
                "\" is invalid. Are you trying to load it using a newer version of the plugin?");
        return false;
    }

    if (protocol < 0) {
        section.set("lugols-iodine-bar.title", "Działanie Płynu Lugola");
        section.set("lugols-iodine-bar.color", BarColor.GREEN.name());
        section.set("lugols-iodine-bar.style", BarStyle.SEGMENTED_20.name());
        section.set("lugols-iodine-bar.flags", Collections.emptyList());

        section.set("lugols-iodine-potion.name", "Płyn Lugola");
        section.set("lugols-iodine-potion.description", "Odporność na promieniowanie ({0})");
        section.set("lugols-iodine-potion.duration", TimeUnit.MINUTES.toSeconds(section.getInt("potion-duration", 10)));
        section.set("lugols-iodine-potion.drink-message", "{0}" + ChatColor.RED + " wypił/a {1}.");

        section.set("radiation.bar.title", "Strefa radiacji");
        section.set("radiation.bar.color", BarColor.RED.name());
        section.set("radiation.bar.style", BarStyle.SOLID.name());
        section.set("radiation.bar.flags", Collections.singletonList(BarFlag.DARKEN_SKY.name()));

        section.set("radiation.effects.wither.level", 5);
        section.set("radiation.effects.wither.ambient", false);
        section.set("radiation.effects.wither.has-particles", false);
        section.set("radiation.effects.wither.has-icon", false);

        section.set("radiation.effects.hunger.level", 1);
        section.set("radiation.effects.hunger.ambient", false);
        section.set("radiation.effects.hunger.has-particles", false);
        section.set("radiation.effects.hunger.has-icon", false);

        section.set("radiation.escape-message", "{0}" + ChatColor.RED + " uciekł/a do strefy radiacji.");

        // Migrate from the old region-ID based system.
        String legacyRegionId = section.getString("region-name", "km_safe_from_radiation");
        AtomicBoolean logged = new AtomicBoolean();
        section.getStringList("world-names").forEach(worldName -> {
            if (logged.compareAndSet(false, true)) {
                logger.warning(
                        "Enabling in legacy region-name mode! The plugin will try to automatically migrate to the new flag-based system.\n" +
                        "If everything went fine please completely remove your config.yml file.");
            }

            this.migrateFromRegionId(worldName, legacyRegionId);
        });
    }

    if (protocol < 1) {
        section.set("lugols-iodine-potion.recipe.enabled", true);
        section.set("lugols-iodine-potion.recipe.base-potion", LugolsIodinePotion.Config.Recipe.DEFAULT_BASE_POTION.name());
        section.set("lugols-iodine-potion.recipe.ingredient", LugolsIodinePotion.Config.Recipe.DEFAULT_INGREDIENT.getKey().getKey());

        section.set("lugols-iodine-potion.color", null);
    }

    return true;
}
 
源代码15 项目: Kettle   文件: CraftServer.java
@Override
public BossBar createBossBar(String title, BarColor color, BarStyle style, BarFlag... flags) {
    return new CraftBossBar(title, color, style, flags);
}
 
源代码16 项目: Kettle   文件: CraftBossBar.java
private void updateFlags() {
    handle.setDarkenSky(hasFlag(BarFlag.DARKEN_SKY));
    handle.setPlayEndBossMusic(hasFlag(BarFlag.PLAY_BOSS_MUSIC));
    handle.setCreateFog(hasFlag(BarFlag.CREATE_FOG));
}
 
源代码17 项目: Kettle   文件: CraftBossBar.java
@Override
public void addFlag(BarFlag flag) {
    flags.add(flag);
    updateFlags();
}
 
源代码18 项目: Kettle   文件: CraftBossBar.java
@Override
public void removeFlag(BarFlag flag) {
    flags.remove(flag);
    updateFlags();
}
 
源代码19 项目: Kettle   文件: CraftBossBar.java
@Override
public boolean hasFlag(BarFlag flag) {
    return flags.contains(flag);
}
 
源代码20 项目: ProjectAres   文件: BossBarSource.java
default Set<BarFlag> barFlags(Player viewer) {
    return Collections.emptySet();
}
 
源代码21 项目: ProjectAres   文件: BossBarFactoryImpl.java
@Override
public BossBar createBossBar(BaseComponent title, BarColor color, BarStyle style, BarFlag... flags) {
    return server.createBossBar(title, color, style, flags);
}
 
源代码22 项目: ProjectAres   文件: RenderedBossBar.java
@Override
public boolean hasFlag(BarFlag flag) {
    return this.flags.contains(flag);
}
 
源代码23 项目: ProjectAres   文件: RenderedBossBar.java
@Override
public void setFlags(Set<BarFlag> flags) {
    this.flags.clear();
    this.flags.addAll(flags);
    views.values().forEach(view -> view.setFlags(flags));
}
 
源代码24 项目: ProjectAres   文件: RenderedBossBar.java
@Override
public void removeFlag(BarFlag flag) {
    this.flags.remove(flag);
    views.values().forEach(view -> view.removeFlag(flag));
}
 
源代码25 项目: ProjectAres   文件: RenderedBossBar.java
@Override
public void addFlag(BarFlag flag) {
    this.flags.add(flag);
    views.values().forEach(view -> view.addFlag(flag));
}
 
源代码26 项目: BetonQuest   文件: BossBarNotifyIO.java
@Override
public void sendNotify(String message, Collection<? extends Player> players) {
    BossBar bossBar = Bukkit.createBossBar(Utils.format(message), barColor, style);
    if (barFlags != null) {
        for (BarFlag flag : barFlags) {
            bossBar.addFlag(flag);
        }
    }
    bossBar.setProgress(progress);

    // Show bar
    for (Player player : players) {
        bossBar.addPlayer(player);
    }

    bossBar.setVisible(true);

    // Remove after stay ticks
    new BukkitRunnable() {

        @Override
        public void run() {
            bossBar.removeAll();
        }
    }.runTaskLater(BetonQuest.getInstance(), stay);

    // If Countdown, then divide stay by countdown and reduce progress to 0 by those intevals
    if (countdown > 0) {
        int interval = stay / countdown;
        double amount = progress / ((double) countdown);
        new BukkitRunnable() {

            @Override
            public void run() {
                if (countdown == 0) {
                    cancel();
                    return;
                }
                countdown -= 1;
                progress -= amount;
                bossBar.setProgress(Math.max(0.0, progress));
            }
        }.runTaskTimer(BetonQuest.getInstance(), interval, interval);
    }

    super.sendNotify(message, players);
}
 
源代码27 项目: FunnyGuilds   文件: BossBarOptions.java
private BossBarOptions(BarColor barColor, BarStyle barStyle, Set<BarFlag> barFlags) {
    this.barColor = barColor;
    this.barStyle = barStyle;
    this.barFlags = barFlags;
}
 
源代码28 项目: FunnyGuilds   文件: BossBarOptions.java
Set<BarFlag> getFlags() {
    return this.barFlags;
}
 
源代码29 项目: CardinalPGM   文件: LocalizedBossBar.java
public void setFlags(Set<BarFlag> flags) {
    this.flags = flags;
    for (BossBar bossbar : playerBossBars.values()) {
        bossbar.setFlags(this.flags);
    }
}
 
源代码30 项目: CardinalPGM   文件: LocalizedBossBar.java
public boolean hasFlag(BarFlag flag) {
    return this.flags.contains(flag);
}
 
 类所在包
 类方法
 同包方法