Add Setters for ID/Name and add completeByCache for Profile API
This commit is contained in:
parent
9b12f54b69
commit
658eca0c22
2 changed files with 117 additions and 29 deletions
|
@ -1,4 +1,4 @@
|
|||
From 15f696b679672e955cf4f3186130eb9afa2e0df6 Mon Sep 17 00:00:00 2001
|
||||
From 8a79fb272338e01bf067f3a27797b26311e25815 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..404fb468
|
||||
index 00000000..e060c38a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java
|
||||
@@ -0,0 +1,125 @@
|
||||
@@ -0,0 +1,149 @@
|
||||
+package com.destroystokyo.paper.profile;
|
||||
+
|
||||
+import com.mojang.authlib.GameProfile;
|
||||
|
@ -32,11 +32,27 @@ index 00000000..404fb468
|
|||
+ @Nullable String getName();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets this profiles Name
|
||||
+ *
|
||||
+ * @param name The new Name
|
||||
+ * @return The previous Name
|
||||
+ */
|
||||
+ String setName(@Nullable String name);
|
||||
+
|
||||
+ /**
|
||||
+ * @return The players unique identifier, if set
|
||||
+ */
|
||||
+ @Nullable UUID getId();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets this profiles UUID
|
||||
+ *
|
||||
+ * @param uuid The new UUID
|
||||
+ * @return The previous UUID
|
||||
+ */
|
||||
+ UUID setId(@Nullable UUID uuid);
|
||||
+
|
||||
+ /**
|
||||
+ * @return A Mutable set of this players properties, such as textures.
|
||||
+ * Values specified here are subject to implementation details.
|
||||
+ */
|
||||
|
@ -98,16 +114,24 @@ index 00000000..404fb468
|
|||
+ void clearProperties();
|
||||
+
|
||||
+ /**
|
||||
+ * @return Does this profile have Name, UUID and Textures filled in
|
||||
+ * @return If the profile is now complete (has UUID and Name)
|
||||
+ */
|
||||
+ boolean isComplete();
|
||||
+
|
||||
+ /**
|
||||
+ * Like {@link #complete(boolean)} but will try only from cache, and not make network calls
|
||||
+ * Does not account for textures.
|
||||
+ *
|
||||
+ * @return If the profile is now complete (has UUID and Name)
|
||||
+ */
|
||||
+ boolean completeFromCache();
|
||||
+
|
||||
+ /**
|
||||
+ * If this profile is not complete, then make the API call to complete it.
|
||||
+ * This is a blocking operation and should be done asynchronously.
|
||||
+ *
|
||||
+ * 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)
|
||||
+ * @return If the profile is now complete (has UUID and Name) (if you get rate limited, this operation may fail)
|
||||
+ */
|
||||
+ default boolean complete() {
|
||||
+ return complete(true);
|
||||
|
@ -118,7 +142,7 @@ index 00000000..404fb468
|
|||
+ * 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)
|
||||
+ * @return If the profile is now complete (has UUID and Name) (if you get rate limited, this operation may fail)
|
||||
+ */
|
||||
+ boolean complete(boolean textures);
|
||||
+
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue