Paper/patch-remap/mache-spigotflower-stripped/net/minecraft/server/bossevents/CustomBossEvent.java.patch

38 lines
1.2 KiB
Diff

--- a/net/minecraft/server/bossevents/CustomBossEvent.java
+++ b/net/minecraft/server/bossevents/CustomBossEvent.java
@@ -17,6 +17,10 @@
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.util.Mth;
import net.minecraft.world.BossEvent;
+// CraftBukkit start
+import org.bukkit.boss.KeyedBossBar;
+import org.bukkit.craftbukkit.boss.CraftKeyedBossbar;
+// CraftBukkit end
public class CustomBossEvent extends ServerBossEvent {
@@ -24,10 +28,20 @@
private final Set<UUID> players = Sets.newHashSet();
private int value;
private int max = 100;
+ // CraftBukkit start
+ private KeyedBossBar bossBar;
- public CustomBossEvent(ResourceLocation resourcelocation, Component component) {
- super(component, BossEvent.BossBarColor.WHITE, BossEvent.BossBarOverlay.PROGRESS);
- this.id = resourcelocation;
+ public KeyedBossBar getBukkitEntity() {
+ if (bossBar == null) {
+ bossBar = new CraftKeyedBossbar(this);
+ }
+ return bossBar;
+ }
+ // CraftBukkit end
+
+ public CustomBossEvent(ResourceLocation id, Component name) {
+ super(name, BossEvent.BossBarColor.WHITE, BossEvent.BossBarOverlay.PROGRESS);
+ this.id = id;
this.setProgress(0.0F);
}