mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-03 21:52:05 -07:00
Fix Profile Textures and expand PlayerProfile .complete() API
I mistakenly thought .complete() also checked for textures, which was not the case So the logic was not working as desired. Also some undesired logic paths lead to textures of the logging in player being dropped, forcing us to always load the textures immediately again on login, leading to rate limits. Everythings now good the .complete() api now will default specify to also complete textures, but you may pass false to it to skip loading textures.
This commit is contained in:
@@ -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..0f44f98f
|
||||
index 00000000..404fb468
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java
|
||||
@@ -0,0 +0,0 @@
|
||||
@@ -43,6 +43,13 @@ index 00000000..0f44f98f
|
||||
+ @Nonnull Set<ProfileProperty> getProperties();
|
||||
+
|
||||
+ /**
|
||||
+ * Check if the Profile has the specified property
|
||||
+ * @param property Property name to check
|
||||
+ * @return If the property is set
|
||||
+ */
|
||||
+ boolean hasProperty(String property);
|
||||
+
|
||||
+ /**
|
||||
+ * Sets a property. If the property already exists, the previous one will be replaced
|
||||
+ * @param property Property to set.
|
||||
+ */
|
||||
@@ -98,9 +105,30 @@ index 00000000..0f44f98f
|
||||
+ /**
|
||||
+ * 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
|
||||
+ *
|
||||
+ * This will also complete textures. If you do not want to load textures, use {{@link #complete(boolean)}}
|
||||
+ * @return if the profile is now complete (if you get rate limited, this operation may fail)
|
||||
+ */
|
||||
+ boolean complete();
|
||||
+ default boolean complete() {
|
||||
+ return complete(true);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * 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.
|
||||
+ * @return if the profile is now complete (if you get rate limited, this operation may fail)
|
||||
+ */
|
||||
+ boolean complete(boolean textures);
|
||||
+
|
||||
+ /**
|
||||
+ * Whether or not this Profile has textures associated to it
|
||||
+ * @return If has a textures property
|
||||
+ */
|
||||
+ default boolean hasTextures() {
|
||||
+ return hasProperty("textures");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @deprecated Will be removed in 1.13
|
||||
|
Reference in New Issue
Block a user