Search in sources :

Example 1 with ServerBossBar

use of org.spongepowered.api.boss.ServerBossBar in project SpongeCommon by SpongePowered.

the class ServerBossBarBuilder method build.

@Override
public ServerBossBar build() {
    checkState(this.name != null, "name must be set");
    checkState(this.color != null, "color must be set");
    checkState(this.overlay != null, "overlay must be set");
    BossInfoServer bar = new BossInfoServer(SpongeTexts.toComponent(this.name), (BossInfo.Color) (Object) this.color, (BossInfo.Overlay) (Object) this.overlay);
    bar.setPercent(this.percent);
    bar.setDarkenSky(this.darkenSky);
    bar.setPlayEndBossMusic(this.playEndBossMusic);
    bar.setCreateFog(this.createFog);
    bar.setVisible(this.visible);
    return (ServerBossBar) bar;
}
Also used : ServerBossBar(org.spongepowered.api.boss.ServerBossBar) BossInfoServer(net.minecraft.world.BossInfoServer) BossInfo(net.minecraft.world.BossInfo)

Example 2 with ServerBossBar

use of org.spongepowered.api.boss.ServerBossBar in project RedProtect by FabioZumbi12.

the class RPPlayerListener method SendNotifyMsg.

public void SendNotifyMsg(Player p, String notify) {
    if (RedProtect.get().cfgs.getString("notify.region-enter-mode").equalsIgnoreCase("OFF")) {
        return;
    }
    if (!notify.equals("")) {
        if (RedProtect.get().cfgs.getString("notify.region-enter-mode").equalsIgnoreCase("BOSSBAR")) {
            ServerBossBar boss = ServerBossBar.builder().name(RPUtil.toText(notify)).overlay(BossBarOverlays.NOTCHED_12).color(BossBarColors.YELLOW).percent(1).build();
            boss.addPlayer(p);
            // start timer
            Task.builder().interval(1, TimeUnit.SECONDS).execute(new BossBarTimer(boss)).submit(RedProtect.get().container);
        }
        if (RedProtect.get().cfgs.getString("notify.region-enter-mode").equalsIgnoreCase("CHAT")) {
            p.sendMessage(RPUtil.toText(notify));
        }
    }
}
Also used : ServerBossBar(org.spongepowered.api.boss.ServerBossBar)

Example 3 with ServerBossBar

use of org.spongepowered.api.boss.ServerBossBar in project RedProtect by FabioZumbi12.

the class RPPlayerListener method SendWelcomeMsg.

public void SendWelcomeMsg(Player p, String wel) {
    if (RedProtect.get().cfgs.getString("notify.welcome-mode").equalsIgnoreCase("OFF")) {
        return;
    }
    if (RedProtect.get().cfgs.getString("notify.welcome-mode").equalsIgnoreCase("BOSSBAR")) {
        ServerBossBar boss = ServerBossBar.builder().name(RPUtil.toText(wel)).overlay(BossBarOverlays.NOTCHED_12).color(BossBarColors.GREEN).percent(1).build();
        boss.addPlayer(p);
        // start timer
        Task.builder().interval(1, TimeUnit.SECONDS).execute(new BossBarTimer(boss)).submit(RedProtect.get().container);
    }
    if (RedProtect.get().cfgs.getString("notify.welcome-mode").equalsIgnoreCase("CHAT")) {
        p.sendMessage(RPUtil.toText(wel));
    }
}
Also used : ServerBossBar(org.spongepowered.api.boss.ServerBossBar)

Aggregations

ServerBossBar (org.spongepowered.api.boss.ServerBossBar)3 BossInfo (net.minecraft.world.BossInfo)1 BossInfoServer (net.minecraft.world.BossInfoServer)1