Merge branch 'master' of github.com:CitizensDev/Citizens2

This commit is contained in:
fullwall 2019-05-07 20:02:33 +08:00
commit 35fe1c5c93
2 changed files with 8 additions and 1 deletions

View File

@ -41,6 +41,9 @@ public class BossBarTrait extends Trait {
if (!npc.isSpawned() || !isBoss(npc.getEntity())) if (!npc.isSpawned() || !isBoss(npc.getEntity()))
return; return;
BossBar bar = NMSImpl.getBossBar(npc.getEntity()); BossBar bar = NMSImpl.getBossBar(npc.getEntity());
if (bar == null) {
return;
}
bar.setVisible(visible); bar.setVisible(visible);
if (color != null) { if (color != null) {
bar.setColor(color); bar.setColor(color);

View File

@ -1460,7 +1460,11 @@ public class NMSImpl implements NMSBridge {
if (entity.getType() == EntityType.WITHER) { if (entity.getType() == EntityType.WITHER) {
bserver = ((EntityWither) NMSImpl.getHandle(entity)).bossBattle; bserver = ((EntityWither) NMSImpl.getHandle(entity)).bossBattle;
} else if (entity.getType() == EntityType.ENDER_DRAGON) { } 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) { } catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();