Add PlayerProfile.complete() API to trigger skin lookup

This commit is contained in:
Aikar 2018-03-18 11:31:32 -04:00
parent 242e82f25b
commit e3e257562f
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE
2 changed files with 33 additions and 8 deletions

View File

@ -1,4 +1,4 @@
From a81aa18c534bcbca348329135c312a5725210352 Mon Sep 17 00:00:00 2001
From 0952cf855ca2b8bf45741e73250656ad452532c8 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 15 Jan 2018 21:46:46 -0500
Subject: [PATCH] Basic PlayerProfile API
@ -7,10 +7,10 @@ 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 +1,90 @@
@@ -0,0 +1,97 @@
+package com.destroystokyo.paper.profile;
+
+import com.mojang.authlib.GameProfile;
@ -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
@ -277,5 +284,5 @@ index 87ab9d2b..f2ee6516 100644
// Paper end
}
--
2.15.1
2.16.2

View File

@ -1,4 +1,4 @@
From 169a4bcde7aa5596794b15d147b9c331d8b01fb0 Mon Sep 17 00:00:00 2001
From d59f6eb0f4ce7dbd4e2ad3c366c5950e1bb6d9ca Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 15 Jan 2018 22:11:48 -0500
Subject: [PATCH] Basic PlayerProfile API
@ -6,15 +6,16 @@ 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 +1,191 @@
@@ -0,0 +1,197 @@
+package com.destroystokyo.paper.profile;
+
+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
@@ -1538,6 +1538,7 @@ 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