Fix Player skulls for offline mode servers

Always use online mode for them in Profile API calls

Adds new API to profile API to let you control online mode yourself

Fixes #3594
This commit is contained in:
Aikar 2020-06-23 04:53:02 -04:00
parent ce270e1412
commit 24b2f54b7b
No known key found for this signature in database
GPG key ID: 401ADFC9891FAAFE
2 changed files with 58 additions and 19 deletions

View file

@ -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 0000000000000000000000000000000000000000..476151d2a8757b77e677647fe95a0f7f1c873459
index 0000000000000000000000000000000000000000..2ef9a7bd55e2c9cf8cb20d5f77282676ae11181f
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java
@@ -0,0 +1,145 @@
@@ -0,0 +1,177 @@
+package com.destroystokyo.paper.profile;
+
+import java.util.Collection;
@ -128,6 +128,25 @@ index 0000000000000000000000000000000000000000..476151d2a8757b77e677647fe95a0f7f
+ boolean completeFromCache();
+
+ /**
+ * Like {@link #complete(boolean)} but will try only from cache, and not make network calls
+ * Does not account for textures.
+ *
+ * @param onlineMode Treat this as online mode or not
+ * @return If the profile is now complete (has UUID and Name)
+ */
+ boolean completeFromCache(boolean onlineMode);
+
+ /**
+ * Like {@link #complete(boolean)} but will try only from cache, and not make network calls
+ * Does not account for textures.
+ *
+ * @param lookupUUID If only name is supplied, should we do a UUID lookup
+ * @param onlineMode Treat this as online mode or not
+ * @return If the profile is now complete (has UUID and Name)
+ */
+ boolean completeFromCache(boolean lookupUUID, boolean onlineMode);
+
+ /**
+ * If this profile is not complete, then make the API call to complete it.
+ * This is a blocking operation and should be done asynchronously.
+ *
@ -143,12 +162,25 @@ index 0000000000000000000000000000000000000000..476151d2a8757b77e677647fe95a0f7f
+ * This is a blocking operation and should be done asynchronously.
+ *
+ * Optionally will also fill textures.
+ *
+ * Online mode will be automatically determined
+ * @param textures controls if we should fill the profile with texture properties
+ * @return If the profile is now complete (has UUID and Name) (if you get rate limited, this operation may fail)
+ */
+ boolean complete(boolean textures);
+
+ /**
+ * If this profile is not complete, then make the API call to complete it.
+ * This is a blocking operation and should be done asynchronously.
+ *
+ * Optionally will also fill textures.
+ * @param textures controls if we should fill the profile with texture properties
+ * @param onlineMode Treat this server as online mode or not
+ * @return If the profile is now complete (has UUID and Name) (if you get rate limited, this operation may fail)
+ */
+ boolean complete(boolean textures, boolean onlineMode);
+
+ /**
+ * Whether or not this Profile has textures associated to it
+ * @return If has a textures property
+ */