use of net.minecraft.server.v1_13_R2.BossBattleServer in project Citizens2 by CitizensDev.
the class NMSImpl method getBossBar.
@Override
public BossBar getBossBar(org.bukkit.entity.Entity entity) {
BossBattleServer bserver = null;
try {
if (entity.getType() == EntityType.WITHER) {
bserver = ((EntityWither) NMSImpl.getHandle(entity)).bossBattle;
} else if (entity.getType() == EntityType.ENDER_DRAGON) {
Object battleObject = ENDERDRAGON_BATTLE_FIELD.invoke(NMSImpl.getHandle(entity));
if (battleObject == null) {
return null;
}
bserver = ((EnderDragonBattle) battleObject).bossBattle;
}
} catch (Throwable e) {
e.printStackTrace();
}
if (bserver == null) {
return null;
}
BossBar ret = Bukkit.createBossBar("", BarColor.BLUE, BarStyle.SEGMENTED_10);
try {
CRAFT_BOSSBAR_HANDLE_FIELD.invoke(ret, bserver);
} catch (Throwable e) {
e.printStackTrace();
}
return ret;
}
use of net.minecraft.server.v1_13_R2.BossBattleServer in project Citizens2 by CitizensDev.
the class NMSImpl method getBossBar.
@Override
public BossBar getBossBar(org.bukkit.entity.Entity entity) {
BossBattleServer bserver = null;
try {
if (entity.getType() == EntityType.WITHER) {
bserver = ((EntityWither) NMSImpl.getHandle(entity)).bossBattle;
} else if (entity.getType() == EntityType.ENDER_DRAGON) {
Object battleObject = ENDERDRAGON_BATTLE_FIELD.invoke(NMSImpl.getHandle(entity));
if (battleObject == null) {
return null;
}
bserver = ((EnderDragonBattle) battleObject).bossBattle;
}
} catch (Throwable e) {
e.printStackTrace();
}
if (bserver == null) {
return null;
}
BossBar ret = Bukkit.createBossBar("", BarColor.BLUE, BarStyle.SEGMENTED_10);
try {
CRAFT_BOSSBAR_HANDLE_FIELD.invoke(ret, bserver);
} catch (Throwable e) {
e.printStackTrace();
}
return ret;
}
Aggregations