Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-08 17:20:24 +01:00
Merge branch 'master' of https://github.com/MylesIsCool/ViaVersion
Dieser Commit ist enthalten in:
Commit
c7ee816aba
@ -69,6 +69,14 @@ public interface BossBar {
|
|||||||
*/
|
*/
|
||||||
BossBar addPlayer(Player player);
|
BossBar addPlayer(Player player);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the bossbar to a player (uuid)
|
||||||
|
*
|
||||||
|
* @param player uuid of the player
|
||||||
|
* @return the BossBar instance
|
||||||
|
*/
|
||||||
|
BossBar addPlayer(UUID player);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* add multiple players
|
* add multiple players
|
||||||
*
|
*
|
||||||
|
@ -78,10 +78,15 @@ public class ViaBossBar implements BossBar {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BossBar addPlayer(@NonNull Player player) {
|
public BossBar addPlayer(@NonNull Player player) {
|
||||||
if (!players.contains(player.getUniqueId())) {
|
return addPlayer(player.getUniqueId());
|
||||||
players.add(player.getUniqueId());
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BossBar addPlayer(UUID player) {
|
||||||
|
if (!players.contains(player)) {
|
||||||
|
players.add(player);
|
||||||
if (visible)
|
if (visible)
|
||||||
sendPacket(player.getUniqueId(), getPacket(UpdateAction.ADD));
|
sendPacket(player, getPacket(UpdateAction.ADD));
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,8 @@ import com.google.common.collect.Sets;
|
|||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import us.myles.ViaVersion.ViaVersionPlugin;
|
import us.myles.ViaVersion.ViaVersionPlugin;
|
||||||
import us.myles.ViaVersion.api.PacketWrapper;
|
import us.myles.ViaVersion.api.PacketWrapper;
|
||||||
import us.myles.ViaVersion.api.ViaVersion;
|
import us.myles.ViaVersion.api.ViaVersion;
|
||||||
@ -181,7 +179,7 @@ public class EntityTracker extends StoredObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Player player = Bukkit.getPlayer(getUser().get(ProtocolInfo.class).getUuid());
|
UUID uuid = getUser().get(ProtocolInfo.class).getUuid();
|
||||||
// Boss bar
|
// Boss bar
|
||||||
if (((ViaVersionPlugin) ViaVersion.getInstance()).isBossbarPatch()) {
|
if (((ViaVersionPlugin) ViaVersion.getInstance()).isBossbarPatch()) {
|
||||||
if (type == EntityType.ENDER_DRAGON || type == EntityType.WITHER) {
|
if (type == EntityType.ENDER_DRAGON || type == EntityType.WITHER) {
|
||||||
@ -192,7 +190,7 @@ public class EntityTracker extends StoredObject {
|
|||||||
if (bar == null) {
|
if (bar == null) {
|
||||||
bar = ViaVersion.getInstance().createBossBar(title, BossColor.PINK, BossStyle.SOLID);
|
bar = ViaVersion.getInstance().createBossBar(title, BossColor.PINK, BossStyle.SOLID);
|
||||||
bossBarMap.put(entityID, bar);
|
bossBarMap.put(entityID, bar);
|
||||||
bar.addPlayer(player);
|
bar.addPlayer(uuid);
|
||||||
bar.show();
|
bar.show();
|
||||||
} else {
|
} else {
|
||||||
bar.setTitle(title);
|
bar.setTitle(title);
|
||||||
@ -206,7 +204,7 @@ public class EntityTracker extends StoredObject {
|
|||||||
String title = type == EntityType.ENDER_DRAGON ? "Ender Dragon" : "Wither";
|
String title = type == EntityType.ENDER_DRAGON ? "Ender Dragon" : "Wither";
|
||||||
bar = ViaVersion.getInstance().createBossBar(title, health, BossColor.PINK, BossStyle.SOLID);
|
bar = ViaVersion.getInstance().createBossBar(title, health, BossColor.PINK, BossStyle.SOLID);
|
||||||
bossBarMap.put(entityID, bar);
|
bossBarMap.put(entityID, bar);
|
||||||
bar.addPlayer(player);
|
bar.addPlayer(uuid);
|
||||||
bar.show();
|
bar.show();
|
||||||
} else {
|
} else {
|
||||||
bar.setHealth(health);
|
bar.setHealth(health);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren