Add API to manipulate boss bar of entities and those created by commands
By: Yannick Lamprecht <yannicklamprecht@live.de>
This commit is contained in:
@@ -9,14 +9,23 @@ import net.minecraft.server.DragonControllerPhase;
|
||||
import net.minecraft.server.EntityComplexPart;
|
||||
import net.minecraft.server.EntityEnderDragon;
|
||||
|
||||
import org.bukkit.boss.BossBar;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.boss.CraftBossBar;
|
||||
import org.bukkit.entity.ComplexEntityPart;
|
||||
import org.bukkit.entity.EnderDragon;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class CraftEnderDragon extends CraftComplexLivingEntity implements EnderDragon {
|
||||
|
||||
private BossBar bossBar;
|
||||
|
||||
public CraftEnderDragon(CraftServer server, EntityEnderDragon entity) {
|
||||
super(server, entity);
|
||||
|
||||
if (entity.ds() != null) {
|
||||
this.bossBar = new CraftBossBar(entity.ds().c); // PAIL rename getEnderDragonBattle
|
||||
}
|
||||
}
|
||||
|
||||
public Set<ComplexEntityPart> getParts() {
|
||||
@@ -60,4 +69,9 @@ public class CraftEnderDragon extends CraftComplexLivingEntity implements EnderD
|
||||
public static DragonControllerPhase getMinecraftPhase(Phase phase) {
|
||||
return DragonControllerPhase.getById(phase.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BossBar getBossBar() {
|
||||
return bossBar;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,22 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityWither;
|
||||
import org.bukkit.boss.BossBar;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Wither;
|
||||
import org.bukkit.craftbukkit.boss.CraftBossBar;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Wither;
|
||||
|
||||
public class CraftWither extends CraftMonster implements Wither {
|
||||
|
||||
private BossBar bossBar;
|
||||
|
||||
public CraftWither(CraftServer server, EntityWither entity) {
|
||||
super(server, entity);
|
||||
|
||||
if (entity.bL != null) {
|
||||
this.bossBar = new CraftBossBar(entity.bL);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -23,4 +32,9 @@ public class CraftWither extends CraftMonster implements Wither {
|
||||
public EntityType getType() {
|
||||
return EntityType.WITHER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BossBar getBossBar() {
|
||||
return bossBar;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user