public void clear(EntityPlayer entityplayer) {
   org.spigotmc.AsyncCatcher.catchOp("player tracker clear"); // Spigot
   if (this.trackedPlayers.contains(entityplayer)) {
     this.trackedPlayers.remove(entityplayer);
     this.tracker.c(entityplayer);
     entityplayer.c(this.tracker);
   }
 }
  public void updatePlayer(EntityPlayer entityplayer) {
    org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot
    if (entityplayer != this.tracker) {
      if (this.c(entityplayer)) {
        if (!this.trackedPlayers.contains(entityplayer)
            && (this.e(entityplayer) || this.tracker.attachedToPlayer)) {
          // CraftBukkit start - respect vanish API
          if (this.tracker instanceof EntityPlayer) {
            Player player = ((EntityPlayer) this.tracker).getBukkitEntity();
            if (!entityplayer.getBukkitEntity().canSee(player)) {
              return;
            }
          }

          entityplayer.removeQueue.remove(Integer.valueOf(this.tracker.getId()));
          // CraftBukkit end
          this.trackedPlayers.add(entityplayer);
          Packet packet = this.e();

          entityplayer.playerConnection.sendPacket(packet);
          if (!this.tracker.getDataWatcher().d()) {
            entityplayer.playerConnection.sendPacket(
                new PacketPlayOutEntityMetadata(
                    this.tracker.getId(), this.tracker.getDataWatcher(), true));
          }

          boolean flag = this.u;

          if (this.tracker instanceof EntityLiving) {
            AttributeMapServer attributemapserver =
                (AttributeMapServer) ((EntityLiving) this.tracker).getAttributeMap();
            Collection collection = attributemapserver.c();

            // CraftBukkit start - If sending own attributes send scaled health instead of current
            // maximum health
            if (this.tracker.getId() == entityplayer.getId()) {
              ((EntityPlayer) this.tracker)
                  .getBukkitEntity()
                  .injectScaledMaxHealth(collection, false);
            }
            // CraftBukkit end

            if (!collection.isEmpty()) {
              entityplayer.playerConnection.sendPacket(
                  new PacketPlayOutUpdateAttributes(this.tracker.getId(), collection));
            }

            if (((EntityLiving) this.tracker).cH()) {
              flag = true;
            }
          }

          this.n = this.tracker.motX;
          this.o = this.tracker.motY;
          this.p = this.tracker.motZ;
          if (flag && !(packet instanceof PacketPlayOutSpawnEntityLiving)) {
            entityplayer.playerConnection.sendPacket(
                new PacketPlayOutEntityVelocity(
                    this.tracker.getId(), this.tracker.motX, this.tracker.motY, this.tracker.motZ));
          }

          if (this.tracker instanceof EntityLiving) {
            EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
            int i = aenumitemslot.length;

            for (int j = 0; j < i; ++j) {
              EnumItemSlot enumitemslot = aenumitemslot[j];
              ItemStack itemstack = ((EntityLiving) this.tracker).getEquipment(enumitemslot);

              if (!itemstack.isEmpty()) {
                entityplayer.playerConnection.sendPacket(
                    new PacketPlayOutEntityEquipment(
                        this.tracker.getId(), enumitemslot, itemstack));
              }
            }
          }

          if (this.tracker instanceof EntityHuman) {
            EntityHuman entityhuman = (EntityHuman) this.tracker;

            if (entityhuman.isSleeping()) {
              entityplayer.playerConnection.sendPacket(
                  new PacketPlayOutBed(entityhuman, new BlockPosition(this.tracker)));
            }
          }

          // CraftBukkit start - Fix for nonsensical head yaw
          this.headYaw = MathHelper.d(this.tracker.getHeadRotation() * 256.0F / 360.0F);
          this.broadcast(new PacketPlayOutEntityHeadRotation(this.tracker, (byte) headYaw));
          // CraftBukkit end

          if (this.tracker instanceof EntityLiving) {
            EntityLiving entityliving = (EntityLiving) this.tracker;
            Iterator iterator = entityliving.getEffects().iterator();

            while (iterator.hasNext()) {
              MobEffect mobeffect = (MobEffect) iterator.next();

              entityplayer.playerConnection.sendPacket(
                  new PacketPlayOutEntityEffect(this.tracker.getId(), mobeffect));
            }
          }

          if (!this.tracker.bx().isEmpty()) {
            entityplayer.playerConnection.sendPacket(new PacketPlayOutMount(this.tracker));
          }

          if (this.tracker.isPassenger()) {
            entityplayer.playerConnection.sendPacket(new PacketPlayOutMount(this.tracker.bB()));
          }

          this.tracker.b(entityplayer);
          entityplayer.d(this.tracker);
        }
      } else if (this.trackedPlayers.contains(entityplayer)) {
        this.trackedPlayers.remove(entityplayer);
        this.tracker.c(entityplayer);
        entityplayer.c(this.tracker);
      }
    }
  }