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

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

源代码1 项目: helper   文件: BukkitBossBarFactory.java
private static BossBarStyle convertStyle(BarStyle style) {
    switch (style) {
        case SOLID:
            return BossBarStyle.SOLID;
        case SEGMENTED_6:
            return BossBarStyle.SEGMENTED_6;
        case SEGMENTED_10:
            return BossBarStyle.SEGMENTED_10;
        case SEGMENTED_12:
            return BossBarStyle.SEGMENTED_12;
        case SEGMENTED_20:
            return BossBarStyle.SEGMENTED_20;
        default:
            return BossBarStyle.defaultStyle();
    }
}
 
源代码2 项目: helper   文件: BukkitBossBarFactory.java
private static BarStyle convertStyle(BossBarStyle style) {
    switch (style) {
        case SOLID:
            return BarStyle.SOLID;
        case SEGMENTED_6:
            return BarStyle.SEGMENTED_6;
        case SEGMENTED_10:
            return BarStyle.SEGMENTED_10;
        case SEGMENTED_12:
            return BarStyle.SEGMENTED_12;
        case SEGMENTED_20:
            return BarStyle.SEGMENTED_20;
        default:
            return convertStyle(BossBarStyle.defaultStyle());
    }
}
 
源代码3 项目: ProjectAres   文件: TicketDisplay.java
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());
}
 
源代码4 项目: 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();
}
 
源代码5 项目: Kettle   文件: CraftBossBar.java
private BossInfo.Overlay convertStyle(BarStyle style) {
    switch (style) {
        default:
        case SOLID:
            return BossInfo.Overlay.PROGRESS;
        case SEGMENTED_6:
            return BossInfo.Overlay.NOTCHED_6;
        case SEGMENTED_10:
            return BossInfo.Overlay.NOTCHED_10;
        case SEGMENTED_12:
            return BossInfo.Overlay.NOTCHED_12;
        case SEGMENTED_20:
            return BossInfo.Overlay.NOTCHED_20;
    }
}
 
源代码6 项目: Harbor   文件: Messages.java
public static void sendBossBarMessage(final World world, final String message, final String color, final double percentage) {
    if (!Config.getBoolean("messages.bossbar.enabled") || message.length() < 1) return;
    BossBar bar = Bukkit.createBossBar(Messages.prepareMessage(world, message), getBarColor(color), BarStyle.SOLID);
    bar.setProgress(percentage);
    world.getPlayers().forEach(bar::addPlayer);
    Bukkit.getScheduler().runTaskLater(Harbor.getHarbor(), bar::removeAll, Config.getInteger("interval") * 20);
}
 
源代码7 项目: ProjectAres   文件: BossBarMatchModule.java
View(BossBarSource source, Player viewer) {
    this.source = source;
    this.viewer = viewer;
    this.bar = bossBarFactory.createBossBar(Components.blank(), BarColor.WHITE, BarStyle.SOLID);
    render();
    bar.addPlayer(viewer);
}
 
源代码8 项目: ProjectAres   文件: PlayerListener.java
@EventHandler(priority = EventPriority.HIGHEST)
public void join(final PlayerJoinEvent event) {
    Player player = event.getPlayer();

    resetPlayer(player);

    event.getPlayer().addAttachment(lobby, Permissions.OBSERVER, true);

    if (player.hasPermission("lobby.overhead-news")) {
        final String datacenter = minecraftService.getLocalServer().datacenter();
        final Component news = new Component(ChatColor.GREEN)
            .extra(new TranslatableComponent(
                "lobby.news",
                new Component(ChatColor.GOLD, ChatColor.BOLD).extra(generalFormatter.publicHostname())
            ));

        final BossBar bar = bossBarFactory.createBossBar(renderer.render(news, player), BarColor.BLUE, BarStyle.SOLID);
        bar.setProgress(1);
        bar.addPlayer(player);
        bar.show();
    }

    if(!player.hasPermission("lobby.disabled-permissions-exempt")) {
        for(PermissionAttachmentInfo attachment : player.getEffectivePermissions()) {
            if(config.getDisabledPermissions().contains(attachment.getPermission())) {
                attachment.getAttachment().setPermission(attachment.getPermission(), false);
            }
        }
    }

    int count = lobby.getServer().getOnlinePlayers().size();
    if(!lobby.getServer().getOnlinePlayers().contains(event.getPlayer())) count++;
    minecraftService.updateLocalServer(new SignUpdate(count));
}
 
源代码9 项目: 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));
}
 
源代码10 项目: VoxelGamesLibv2   文件: TimedPhase.java
@Override
public void enable() {
    super.enable();

    originalTicks = ticks;

    log.finer("enable 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;
}
 
源代码11 项目: NovaGuilds   文件: BossBarUtilsBukkitImpl.java
/**
 * Creates a boss bar if doesn't exist
 *
 * @param player the player
 * @return the boss bar
 */
private BossBar createIfNotExists(Player player) {
	if(bossBars.containsKey(player.getUniqueId())) {
		return getBossBar(player);
	}

	BossBar bossBar = Bukkit.getServer().createBossBar("", Config.BOSSBAR_RAIDBAR_COLOR.toEnum(BarColor.class), Config.BOSSBAR_RAIDBAR_STYLE.toEnum(BarStyle.class));
	bossBar.addPlayer(player);
	bossBars.put(player.getUniqueId(), bossBar);
	return bossBar;
}
 
源代码12 项目: skRayFall   文件: BossBarManager.java
/**
 * Changed the style of a bossbar from the BossBarManager through the stored ID.
 *
 * @param id    The ID text for the bossbar.
 * @param style The BarStyle to be used.
 */
void changeStyle(String id, BarStyle style) {
    BossBar bar = barMap.get(id);
    if (bar != null) {
        bar.setStyle(style);
        barMap.put(id, bar);
    }
}
 
源代码13 项目: skRayFall   文件: EffCreateModernBossBar.java
@Override
protected void execute(Event evt) {
    BarStyle barStyle = BarStyle.SOLID;
    BarColor barColor = BarColor.PURPLE;
    if (style != null) {
        barStyle = style.getSingle(evt).getKey();
    }
    if (color != null) {
        barColor = color.getSingle(evt).getKey();
    }
    BossBar bar;
    if (flag != null) {
        bar = Bukkit.createBossBar(title.getSingle(evt).replace("\"", ""), barColor, barStyle,
                flag.getSingle(evt).getKey());
    } else {
        bar = Bukkit.createBossBar(title.getSingle(evt).replace("\"", ""), barColor, barStyle);
    }
    if (value != null) {
        double vol = value.getSingle(evt).doubleValue();
        if (vol > 100) {
            vol = 100;
        } else if (vol < 0) {
            vol = 0;
        }
        bar.setProgress(vol / 100);
    }
    for (Player p : players.getAll(evt)) {
        bar.addPlayer(p);
    }
    Core.bossbarManager.createBossBar(id.getSingle(evt).replace("\"", ""), bar);
}
 
源代码14 项目: FunnyGuilds   文件: BossBarOptions.java
public Builder style(String barStyle) {
    for (BarStyle loopStyle : BarStyle.values()) {
        if (loopStyle.name().equalsIgnoreCase(barStyle)) {
            this.barStyle = loopStyle;
            break;
        }
    }

    return this;
}
 
源代码15 项目: CardinalPGM   文件: MonumentModes.java
public MonumentModes(int after, final Pair<Material, Integer> material, final String name, int showBefore) {
    this.after = after;
    this.material = material;
    this.name = name;
    this.showBefore = showBefore;

    this.ran = false;

    this.bossBar = BossBars.addBroadcastedBossBar(new UnlocalizedChatMessage(""), BarColor.BLUE, BarStyle.SOLID, false);
}
 
源代码16 项目: 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);
}
 
源代码17 项目: 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;
}
 
源代码18 项目: CardinalPGM   文件: Poll.java
protected Poll(int id, CommandSender sender, String command, int time, boolean any) {
    this.id = id;
    this.sender = sender;
    this.command = command;
    this.any = any;
    this.time = time * 20;
    this.originalTime = this.time;
    this.bossBar = BossBars.addBroadcastedBossBar(new UnlocalizedChatMessage(""), BarColor.YELLOW, BarStyle.SOLID, true);
    taskId = Bukkit.getScheduler().scheduleSyncRepeatingTask(Cardinal.getInstance(), new Runnable() {
        @Override
        public void run() {
            Poll.this.update();
        }
    }, 0L, 1L);
}
 
源代码19 项目: HeavySpleef   文件: FlagBossbar.java
@Override
public void onFlagAdd(Game game) {
    baseTitle = getI18N().getVarString(Messages.Broadcast.BOSSBAR_PLAYING_ON)
            .setVariable("game", game.getName())
            .toString();
    baseColor = new SafeContainer<>(BarColor.GREEN);

    bossBar = new SafeContainer<>(Bukkit.getServer().createBossBar(baseTitle, baseColor.value, BarStyle.SOLID));
    bossBar.value.setProgress(DEFAULT_PROGRESS);
}
 
源代码20 项目: 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");
}
 
源代码21 项目: CraftserveRadiation   文件: BarConfig.java
public BarStyle style() {
    return this.style;
}
 
源代码22 项目: 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;
}
 
源代码23 项目: BedWars   文件: BossBar19.java
public BossBar19() {
    this.boss = Bukkit.createBossBar("", BarColor.PURPLE, BarStyle.SOLID);
}
 
源代码24 项目: BedWars   文件: BossBar19.java
@Override
public BarStyle getStyle() {
    return boss.getStyle();
}
 
源代码25 项目: BedWars   文件: BossBar19.java
@Override
public void setStyle(BarStyle style) {
    boss.setStyle(style);
}
 
源代码26 项目: BedWars   文件: BossBar19.java
public BossBar19() {
    this.boss = Bukkit.createBossBar("", BarColor.PURPLE, BarStyle.SOLID);
}
 
源代码27 项目: BedWars   文件: BossBar19.java
@Override
public BarStyle getStyle() {
    return boss.getStyle();
}
 
源代码28 项目: BedWars   文件: BossBar19.java
@Override
public void setStyle(BarStyle style) {
    boss.setStyle(style);
}
 
源代码29 项目: Kettle   文件: CraftServer.java
@Override
public BossBar createBossBar(String title, BarColor color, BarStyle style, BarFlag... flags) {
    return new CraftBossBar(title, color, style, flags);
}
 
源代码30 项目: Kettle   文件: CraftBossBar.java
@Override
public BarStyle getStyle() {
    return style;
}
 
 类所在包
 类方法
 同包方法