Send remove player info even if disguise is removed

This commit is contained in:
libraryaddict 2020-02-15 20:55:29 +13:00
parent 10039f39c3
commit 4105b953bf
No known key found for this signature in database
GPG Key ID: 052E4FBCD257AEA4

View File

@ -93,17 +93,22 @@ public class LibsPackets {
final boolean isRemoveCancel = isSpawnPacket && entry.getKey() >= removeMetaAt && removeMetaAt >= 0;
Bukkit.getScheduler().scheduleSyncDelayedTask(LibsDisguises.getInstance(), () -> {
if (!disguise.isDisguiseInUse()) {
if (isRemoveCancel) {
PacketsManager.getPacketsHandler().removeCancel(disguise, observer);
}
return;
}
if (isRemoveCancel) {
PacketsManager.getPacketsHandler().removeCancel(disguise, observer);
}
if (!disguise.isDisguiseInUse()) {
ArrayList<PacketContainer> packets = entry.getValue();
if (packets.stream().noneMatch(p -> p.getType() == PacketType.Play.Server.PLAYER_INFO)) {
return;
}
packets.removeIf(p -> p.getType() != PacketType.Play.Server.PLAYER_INFO);
}
if (isRemoveCancel) {
if (isSendArmor()) {
for (EquipmentSlot slot : EquipmentSlot.values()) {
PacketContainer packet = createPacket(slot);