Fix bossbar not working as intended
This commit is contained in:
		| @@ -199,6 +199,7 @@ public abstract class Disguise { | ||||
|         BossBar bar = Bukkit | ||||
|                 .createBossBar(getBossBar(), LibsMsg.ACTION_BAR_MESSAGE.get(getType().toReadable()), getBossBarColor(), | ||||
|                         getBossBarStyle()); | ||||
|         bar.setProgress(1); | ||||
|         bar.addPlayer((Player) getEntity()); | ||||
|     } | ||||
|  | ||||
| @@ -714,7 +715,23 @@ public abstract class Disguise { | ||||
|         } | ||||
|  | ||||
|         // If this disguise has a entity set | ||||
|         if (getEntity() != null) { | ||||
|         if (getEntity() == null) { | ||||
|             // Loop through the disguises because it could be used with a unknown entity id. | ||||
|             HashMap<Integer, HashSet<TargetedDisguise>> future = DisguiseUtilities.getFutureDisguises(); | ||||
|  | ||||
|             Iterator<Integer> itel = DisguiseUtilities.getFutureDisguises().keySet().iterator(); | ||||
|  | ||||
|             while (itel.hasNext()) { | ||||
|                 int id = itel.next(); | ||||
|  | ||||
|                 if (future.get(id).remove(this) && future.get(id).isEmpty()) { | ||||
|                     itel.remove(); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         if (this instanceof PlayerDisguise) { | ||||
|             PlayerDisguise disguise = (PlayerDisguise) this; | ||||
|  | ||||
| @@ -756,8 +773,8 @@ public abstract class Disguise { | ||||
|         } | ||||
|  | ||||
|         if (isHidePlayer() && getEntity() instanceof Player && ((Player) getEntity()).isOnline()) { | ||||
|                 PlayerInfoData playerInfo = new PlayerInfoData(ReflectionManager.getGameProfile((Player) getEntity()), | ||||
|                         0, NativeGameMode.fromBukkit(((Player) getEntity()).getGameMode()), | ||||
|             PlayerInfoData playerInfo = new PlayerInfoData(ReflectionManager.getGameProfile((Player) getEntity()), 0, | ||||
|                     NativeGameMode.fromBukkit(((Player) getEntity()).getGameMode()), | ||||
|                     WrappedChatComponent.fromText(DisguiseUtilities.getPlayerListName((Player) getEntity()))); | ||||
|  | ||||
|             PacketContainer addTab = new PacketContainer(PacketType.Play.Server.PLAYER_INFO); | ||||
| @@ -778,20 +795,6 @@ public abstract class Disguise { | ||||
|                 e.printStackTrace(); | ||||
|             } | ||||
|         } | ||||
|         } else { | ||||
|             // Loop through the disguises because it could be used with a unknown entity id. | ||||
|             HashMap<Integer, HashSet<TargetedDisguise>> future = DisguiseUtilities.getFutureDisguises(); | ||||
|  | ||||
|             Iterator<Integer> itel = DisguiseUtilities.getFutureDisguises().keySet().iterator(); | ||||
|  | ||||
|             while (itel.hasNext()) { | ||||
|                 int id = itel.next(); | ||||
|  | ||||
|                 if (future.get(id).remove(this) && future.get(id).isEmpty()) { | ||||
|                     itel.remove(); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         if (getEntity().hasMetadata("LastDisguise")) { | ||||
|             getEntity().removeMetadata("LastDisguise", LibsDisguises.getInstance()); | ||||
| @@ -800,8 +803,10 @@ public abstract class Disguise { | ||||
|         getEntity().setMetadata("LastDisguise", | ||||
|                 new FixedMetadataValue(LibsDisguises.getInstance(), System.currentTimeMillis())); | ||||
|  | ||||
|         if (getNotifyBar() == DisguiseConfig.NotifyBar.BOSS_BAR && getEntity() instanceof Player && | ||||
|                 !getEntity().hasPermission("libsdisguises.noactionbar")) { | ||||
|         BossBar bar = Bukkit.getBossBar(getBossBar()); | ||||
|  | ||||
|         if (bar != null) { | ||||
|             bar.removeAll(); | ||||
|             Bukkit.removeBossBar(getBossBar()); | ||||
|         } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user