use of com.denizenscript.denizen.nms.v1_16.impl.network.packets.PacketOutSpawnEntityImpl in project Denizen-For-Bukkit by DenizenScript.
the class DenizenNetworkManagerImpl method processHiddenEntitiesForPacket.
public boolean processHiddenEntitiesForPacket(Packet<?> packet) {
if (!HideEntitiesHelper.hasAnyHides()) {
return false;
}
try {
if (packet instanceof PacketPlayOutNamedEntitySpawn || packet instanceof PacketPlayOutSpawnEntity || packet instanceof PacketPlayOutSpawnEntityLiving || packet instanceof PacketPlayOutSpawnEntityPainting || packet instanceof PacketPlayOutSpawnEntityExperienceOrb) {
PacketOutSpawnEntity spawnEntity = new PacketOutSpawnEntityImpl(player, packet);
Entity entity = player.getWorld().getEntity(spawnEntity.getEntityId());
if (isHidden(entity)) {
return true;
}
processFakePlayerSpawn(entity);
}
int ider = -1;
if (packet instanceof PacketPlayOutEntity) {
ider = ENTITY_ID_PACKENT.getInt(packet);
} else if (packet instanceof PacketPlayOutEntityMetadata) {
ider = ENTITY_METADATA_EID.getInt(packet);
} else if (packet instanceof PacketPlayOutEntityVelocity) {
ider = ENTITY_ID_PACKVELENT.getInt(packet);
} else if (packet instanceof PacketPlayOutEntityTeleport) {
ider = ENTITY_ID_PACKTELENT.getInt(packet);
}
if (ider != -1) {
Entity e = player.getWorld().getEntity(ider);
if (isHidden(e)) {
return true;
}
}
} catch (Exception ex) {
Debug.echoError(ex);
}
return false;
}
Aggregations