mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 05:47:45 +01:00
Add PlayerProfile.complete() API to trigger skin lookup
This commit is contained in:
parent
0d220393d1
commit
0094c1669c
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user