From 0094c1669c3f8b40b7231efb32273d2407aa2a9c Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 18 Mar 2018 11:31:32 -0400
Subject: [PATCH] Add PlayerProfile.complete() API to trigger skin lookup

---
 .../Basic-PlayerProfile-API.patch             |  9 +++++++-
 .../Basic-PlayerProfile-API.patch             | 22 +++++++++++++++++--
 2 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/Spigot-API-Patches/Basic-PlayerProfile-API.patch b/Spigot-API-Patches/Basic-PlayerProfile-API.patch
index 7800f1c0f5..5739a85424 100644
--- a/Spigot-API-Patches/Basic-PlayerProfile-API.patch
+++ b/Spigot-API-Patches/Basic-PlayerProfile-API.patch
@@ -7,7 +7,7 @@ Provides basic elements of a PlayerProfile to be used by future API/events
 
 diff --git a/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java
 new file mode 100644
-index 00000000..a7b69cab
+index 00000000..0f44f98f
 --- /dev/null
 +++ b/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java
 @@ -0,0 +0,0 @@
@@ -96,6 +96,13 @@ index 00000000..a7b69cab
 +    boolean isComplete();
 +
 +    /**
++     * If this profile is not complete, then make the API call to complete it.
++     * This is a blocking operation and should be done asynchronously.
++     * @return if the profile is now complete
++     */
++    boolean complete();
++
++    /**
 +     * @deprecated Will be removed in 1.13
 +     */
 +    @Deprecated
diff --git a/Spigot-Server-Patches/Basic-PlayerProfile-API.patch b/Spigot-Server-Patches/Basic-PlayerProfile-API.patch
index f8afd82959..b4f6ebe42f 100644
--- a/Spigot-Server-Patches/Basic-PlayerProfile-API.patch
+++ b/Spigot-Server-Patches/Basic-PlayerProfile-API.patch
@@ -6,7 +6,7 @@ Subject: [PATCH] Basic PlayerProfile API
 
 diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
 new file mode 100644
-index 000000000..e673726c5
+index 000000000..2cfd65bc1
 --- /dev/null
 +++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
 @@ -0,0 +0,0 @@
@@ -15,6 +15,7 @@ index 000000000..e673726c5
 +import com.mojang.authlib.GameProfile;
 +import com.mojang.authlib.properties.Property;
 +import com.mojang.authlib.properties.PropertyMap;
++import net.minecraft.server.MinecraftServer;
 +
 +import javax.annotation.Nonnull;
 +import javax.annotation.Nullable;
@@ -26,7 +27,7 @@ index 000000000..e673726c5
 +
 +public class CraftPlayerProfile implements PlayerProfile {
 +
-+    private final GameProfile profile;
++    private GameProfile profile;
 +    private final PropertySet properties;
 +
 +    /**
@@ -119,6 +120,11 @@ index 000000000..e673726c5
 +        return profile.isComplete();
 +    }
 +
++    public boolean complete() {
++        profile = MinecraftServer.getServer().getSessionService().fillProfileProperties(profile, true);
++        return profile.isComplete();
++    }
++
 +    private static ProfileProperty toBukkit(Property property) {
 +        return new ProfileProperty(property.getName(), property.getValue(), property.getSignature());
 +    }
@@ -226,6 +232,18 @@ index 02940d697..4539b5601 100644
      /**
       * Calculates distance between 2 entities
       * @param e1
+diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
+index e8bddc171..3b01ebd96 100644
+--- a/src/main/java/net/minecraft/server/MinecraftServer.java
++++ b/src/main/java/net/minecraft/server/MinecraftServer.java
+@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
+         this.H = i;
+     }
+ 
++    public MinecraftSessionService getSessionService() { return az(); } // Paper - OBFHELPER
+     public MinecraftSessionService az() {
+         return this.W;
+     }
 diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
 index 77c16fe2c..aca5ea7c0 100644
 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java