Try fix a ghost armor issue
This commit is contained in:
		| @@ -159,9 +159,7 @@ public class PlayerSkinHandler implements Listener { | ||||
|     } | ||||
|  | ||||
|     public void handlePackets(Player player, PlayerDisguise disguise, LibsPackets packets) { | ||||
|         if (packets.getPackets().stream().anyMatch(p -> p.getType() == Server.NAMED_ENTITY_SPAWN)) { | ||||
|             return; | ||||
|         } | ||||
|         boolean spawn = packets.getPackets().stream().anyMatch(p -> p.getType() == Server.NAMED_ENTITY_SPAWN); | ||||
|  | ||||
|         List<PlayerSkin> skins = getCache().getIfPresent(player); | ||||
|  | ||||
| @@ -175,6 +173,17 @@ public class PlayerSkinHandler implements Listener { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         if (spawn) { | ||||
|             packets.getDelayedPacketsMap().entrySet().removeIf(entry -> { | ||||
|                 entry.getValue() | ||||
|                         .removeIf(packet -> packet.getType() == Server.ENTITY_EQUIPMENT && isRemove(skin, packet)); | ||||
|  | ||||
|                 return entry.getValue().isEmpty(); | ||||
|             }); | ||||
|  | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         packets.getPackets().removeIf(packet -> isRemove(skin, packet)); | ||||
|  | ||||
|         packets.getDelayedPacketsMap().entrySet().removeIf(entry -> { | ||||
|   | ||||
| @@ -74,6 +74,7 @@ public class PacketHandlerSpawn implements IPacketHandler { | ||||
|      */ | ||||
|     private void constructSpawnPackets(final Player observer, LibsPackets packets, Entity disguisedEntity) { | ||||
|         Disguise disguise = packets.getDisguise(); | ||||
|         boolean sendArmor = true; | ||||
|  | ||||
|         if (DisguiseConfig.isMiscDisguisesForLivingEnabled()) { | ||||
|             if (disguise.getWatcher() instanceof LivingWatcher) { | ||||
| @@ -215,6 +216,7 @@ public class PacketHandlerSpawn implements IPacketHandler { | ||||
|             boolean normalPlayerDisguise = observer == disguisedEntity || dist > (50 * 50) || | ||||
|                     (observer.getLocation().add(observer.getLocation().getDirection().normalize()) | ||||
|                             .distanceSquared(disguisedEntity.getLocation()) - dist) < 0.3; | ||||
|             sendArmor = normalPlayerDisguise; | ||||
|  | ||||
|             skin.setSleepPackets(!normalPlayerDisguise); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user