Fix bossbar not working as intended
This commit is contained in:
parent
0c0ee16f29
commit
25768bc20d
@ -199,6 +199,7 @@ public abstract class Disguise {
|
|||||||
BossBar bar = Bukkit
|
BossBar bar = Bukkit
|
||||||
.createBossBar(getBossBar(), LibsMsg.ACTION_BAR_MESSAGE.get(getType().toReadable()), getBossBarColor(),
|
.createBossBar(getBossBar(), LibsMsg.ACTION_BAR_MESSAGE.get(getType().toReadable()), getBossBarColor(),
|
||||||
getBossBarStyle());
|
getBossBarStyle());
|
||||||
|
bar.setProgress(1);
|
||||||
bar.addPlayer((Player) getEntity());
|
bar.addPlayer((Player) getEntity());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -714,7 +715,23 @@ public abstract class Disguise {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If this disguise has a entity set
|
// 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) {
|
if (this instanceof PlayerDisguise) {
|
||||||
PlayerDisguise disguise = (PlayerDisguise) this;
|
PlayerDisguise disguise = (PlayerDisguise) this;
|
||||||
|
|
||||||
@ -756,8 +773,8 @@ public abstract class Disguise {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isHidePlayer() && getEntity() instanceof Player && ((Player) getEntity()).isOnline()) {
|
if (isHidePlayer() && getEntity() instanceof Player && ((Player) getEntity()).isOnline()) {
|
||||||
PlayerInfoData playerInfo = new PlayerInfoData(ReflectionManager.getGameProfile((Player) getEntity()),
|
PlayerInfoData playerInfo = new PlayerInfoData(ReflectionManager.getGameProfile((Player) getEntity()), 0,
|
||||||
0, NativeGameMode.fromBukkit(((Player) getEntity()).getGameMode()),
|
NativeGameMode.fromBukkit(((Player) getEntity()).getGameMode()),
|
||||||
WrappedChatComponent.fromText(DisguiseUtilities.getPlayerListName((Player) getEntity())));
|
WrappedChatComponent.fromText(DisguiseUtilities.getPlayerListName((Player) getEntity())));
|
||||||
|
|
||||||
PacketContainer addTab = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
|
PacketContainer addTab = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
|
||||||
@ -778,20 +795,6 @@ public abstract class Disguise {
|
|||||||
e.printStackTrace();
|
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")) {
|
if (getEntity().hasMetadata("LastDisguise")) {
|
||||||
getEntity().removeMetadata("LastDisguise", LibsDisguises.getInstance());
|
getEntity().removeMetadata("LastDisguise", LibsDisguises.getInstance());
|
||||||
@ -800,8 +803,10 @@ public abstract class Disguise {
|
|||||||
getEntity().setMetadata("LastDisguise",
|
getEntity().setMetadata("LastDisguise",
|
||||||
new FixedMetadataValue(LibsDisguises.getInstance(), System.currentTimeMillis()));
|
new FixedMetadataValue(LibsDisguises.getInstance(), System.currentTimeMillis()));
|
||||||
|
|
||||||
if (getNotifyBar() == DisguiseConfig.NotifyBar.BOSS_BAR && getEntity() instanceof Player &&
|
BossBar bar = Bukkit.getBossBar(getBossBar());
|
||||||
!getEntity().hasPermission("libsdisguises.noactionbar")) {
|
|
||||||
|
if (bar != null) {
|
||||||
|
bar.removeAll();
|
||||||
Bukkit.removeBossBar(getBossBar());
|
Bukkit.removeBossBar(getBossBar());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user