us.myles.ViaVersion.api.boss.BossBar Java Examples

The following examples show how to use us.myles.ViaVersion.api.boss.BossBar. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EntityTracker1_9.java    From ViaVersion with MIT License 6 votes vote down vote up
@Override
public void removeEntity(int entityId) {
    super.removeEntity(entityId);

    vehicleMap.remove(entityId);
    uuidMap.remove(entityId);
    validBlocking.remove(entityId);
    knownHolograms.remove(entityId);
    metadataBuffer.remove(entityId);

    BossBar bar = bossBarMap.remove(entityId);
    if (bar != null) {
        bar.hide();
        // Send to provider
        Via.getManager().getProviders().get(BossBarProvider.class).handleRemove(getUser(), bar.getId());
    }
}
 
Example #2
Source File: WitherBossBar.java    From ViaRewind with MIT License 5 votes vote down vote up
@Override
public BossBar setHealth(float health) {
	this.health  = health;
	if (this.health<=0) this.health = 0.0001f;
	if (this.visible) updateMetadata();
	return this;
}
 
Example #3
Source File: CommonBoss.java    From ViaVersion with MIT License 5 votes vote down vote up
@Override
public BossBar removeFlag(BossFlag flag) {
    Preconditions.checkNotNull(flag);
    if (hasFlag(flag))
        flags.remove(flag);
    sendPacket(CommonBoss.UpdateAction.UPDATE_FLAGS);
    return this;
}
 
Example #4
Source File: CommonBoss.java    From ViaVersion with MIT License 5 votes vote down vote up
@Override
public BossBar addFlag(BossFlag flag) {
    Preconditions.checkNotNull(flag);
    if (!hasFlag(flag))
        flags.add(flag);
    sendPacket(CommonBoss.UpdateAction.UPDATE_FLAGS);
    return this;
}
 
Example #5
Source File: CommonBoss.java    From ViaVersion with MIT License 5 votes vote down vote up
@Override
public BossBar removeConnection(UserConnection conn) {
    if (connections.remove(conn)) {
        sendPacketConnection(conn, getPacket(UpdateAction.REMOVE, conn));
    }
    return this;
}
 
Example #6
Source File: CommonBoss.java    From ViaVersion with MIT License 5 votes vote down vote up
@Override
public BossBar setTitle(String title) {
    Preconditions.checkNotNull(title);
    this.title = title;
    sendPacket(CommonBoss.UpdateAction.UPDATE_TITLE);
    return this;
}
 
Example #7
Source File: CommonBoss.java    From ViaVersion with MIT License 5 votes vote down vote up
@Override
public BossBar addConnection(UserConnection conn) {
    if (connections.add(conn) && visible) {
        sendPacketConnection(conn, getPacket(CommonBoss.UpdateAction.ADD, conn));
    }
    return this;
}
 
Example #8
Source File: CommonBoss.java    From ViaVersion with MIT License 5 votes vote down vote up
@Override
public BossBar setHealth(float health) {
    Preconditions.checkArgument((health >= 0 && health <= 1), "Health must be between 0 and 1");
    this.health = health;
    sendPacket(CommonBoss.UpdateAction.UPDATE_HEALTH);
    return this;
}
 
Example #9
Source File: CommonBoss.java    From ViaVersion with MIT License 5 votes vote down vote up
@Override
public BossBar setStyle(BossStyle style) {
    Preconditions.checkNotNull(style);
    this.style = style;
    sendPacket(CommonBoss.UpdateAction.UPDATE_STYLE);
    return this;
}
 
Example #10
Source File: CommonBoss.java    From ViaVersion with MIT License 5 votes vote down vote up
@Override
public BossBar setColor(BossColor color) {
    Preconditions.checkNotNull(color);
    this.color = color;
    sendPacket(CommonBoss.UpdateAction.UPDATE_STYLE);
    return this;
}
 
Example #11
Source File: WitherBossBar.java    From ViaRewind with MIT License 5 votes vote down vote up
@Override
public BossBar show() {
	if (!this.visible) {
		this.visible = true;
		spawnWither();
	}
	return this;
}
 
Example #12
Source File: WitherBossBar.java    From ViaRewind with MIT License 5 votes vote down vote up
@Override
public BossBar hide() {
	if (this.visible) {
		this.visible = false;
		despawnWither();
	}
	return this;
}
 
Example #13
Source File: SpongeViaAPI.java    From ViaVersion with MIT License 4 votes vote down vote up
@Override
public BossBar createBossBar(String title, float health, BossColor color, BossStyle style) {
    return new SpongeBossBar(title, health, color, style);
}
 
Example #14
Source File: VelocityViaAPI.java    From ViaVersion with MIT License 4 votes vote down vote up
@Override
public BossBar createBossBar(String title, BossColor color, BossStyle style) {
    return new VelocityBossBar(title, 1F, color, style);
}
 
Example #15
Source File: SpongeBossBar.java    From ViaVersion with MIT License 4 votes vote down vote up
@Override
public BossBar addPlayers(Player... players) {
    for (Player p : players)
        addPlayer(p);
    return this;
}
 
Example #16
Source File: SpongeViaAPI.java    From ViaVersion with MIT License 4 votes vote down vote up
@Override
public BossBar createBossBar(String title, BossColor color, BossStyle style) {
    return new SpongeBossBar(title, 1F, color, style);
}
 
Example #17
Source File: SpongeBossBar.java    From ViaVersion with MIT License 4 votes vote down vote up
@Override
public BossBar removePlayer(Player player) {
    removePlayer(player.getUniqueId());
    return this;
}
 
Example #18
Source File: BungeeBossBar.java    From ViaVersion with MIT License 4 votes vote down vote up
@Override
public BossBar removePlayer(ProxiedPlayer player) {
    removePlayer(player.getUniqueId());
    return this;
}
 
Example #19
Source File: VelocityViaAPI.java    From ViaVersion with MIT License 4 votes vote down vote up
@Override
public BossBar createBossBar(String title, float health, BossColor color, BossStyle style) {
    return new VelocityBossBar(title, health, color, style);
}
 
Example #20
Source File: EntityTracker1_9.java    From ViaVersion with MIT License 4 votes vote down vote up
public Map<Integer, BossBar> getBossBarMap() {
    return bossBarMap;
}
 
Example #21
Source File: CommonBoss.java    From ViaVersion with MIT License 4 votes vote down vote up
@Override
public BossBar addPlayer(UUID player) {
    return addConnection(Via.getManager().getConnection(player));
}
 
Example #22
Source File: CommonBoss.java    From ViaVersion with MIT License 4 votes vote down vote up
@Override
public BossBar removePlayer(UUID uuid) {
    return removeConnection(Via.getManager().getConnection(uuid));
}
 
Example #23
Source File: CommonBoss.java    From ViaVersion with MIT License 4 votes vote down vote up
@Override
public BossBar show() {
    setVisible(true);
    return this;
}
 
Example #24
Source File: CommonBoss.java    From ViaVersion with MIT License 4 votes vote down vote up
@Override
public BossBar hide() {
    setVisible(false);
    return this;
}
 
Example #25
Source File: BukkitViaAPI.java    From ViaVersion with MIT License 4 votes vote down vote up
@Override
public BossBar<Player> createBossBar(String title, float health, BossColor color, BossStyle style) {
    return new ViaBossBar(title, health, color, style);
}
 
Example #26
Source File: VRViaAPI.java    From ViaFabric with MIT License 4 votes vote down vote up
@Override
public BossBar<Void> createBossBar(String s, float v, BossColor bossColor, BossStyle bossStyle) {
    return new VRBossBar(s, v, bossColor, bossStyle);
}
 
Example #27
Source File: WitherBossBar.java    From ViaRewind with MIT License 4 votes vote down vote up
@Override
public BossBar setTitle(String title) {
	this.title = title;
	if (this.visible) updateMetadata();
	return this;
}
 
Example #28
Source File: WitherBossBar.java    From ViaRewind with MIT License 4 votes vote down vote up
@Override
public BossBar setColor(BossColor bossColor) {
	throw new UnsupportedOperationException(this.getClass().getName() + " does not support color");
}
 
Example #29
Source File: WitherBossBar.java    From ViaRewind with MIT License 4 votes vote down vote up
@Override
public BossBar setStyle(BossStyle bossStyle) {
	throw new UnsupportedOperationException(this.getClass().getName() + " does not support styles");
}
 
Example #30
Source File: WitherBossBar.java    From ViaRewind with MIT License 4 votes vote down vote up
@Override
public BossBar addPlayer(UUID uuid) {
	throw new UnsupportedOperationException(this.getClass().getName() + " is only for one UserConnection!");
}