mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 10:36:10 +01:00
catch null bossbars for enderdragaon NPCs, fixes #1764
This commit is contained in:
parent
244e8dd343
commit
47fd18dc04
@ -41,6 +41,9 @@ public class BossBarTrait extends Trait {
|
||||
if (!npc.isSpawned() || !isBoss(npc.getEntity()))
|
||||
return;
|
||||
BossBar bar = NMSImpl.getBossBar(npc.getEntity());
|
||||
if (bar == null) {
|
||||
return;
|
||||
}
|
||||
bar.setVisible(visible);
|
||||
if (color != null) {
|
||||
bar.setColor(color);
|
||||
|
@ -1459,7 +1459,11 @@ public class NMSImpl implements NMSBridge {
|
||||
if (entity.getType() == EntityType.WITHER) {
|
||||
bserver = ((EntityWither) NMSImpl.getHandle(entity)).bossBattle;
|
||||
} else if (entity.getType() == EntityType.ENDER_DRAGON) {
|
||||
bserver = ((EnderDragonBattle) ENDERDRAGON_BATTLE_FIELD.invoke(NMSImpl.getHandle(entity))).bossBattle;
|
||||
Object battleObject = ENDERDRAGON_BATTLE_FIELD.invoke(NMSImpl.getHandle(entity));
|
||||
if (battleObject == null) {
|
||||
return null;
|
||||
}
|
||||
bserver = ((EnderDragonBattle) battleObject).bossBattle;
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
|
Loading…
Reference in New Issue
Block a user