mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 23:29:32 +01:00
Prevent profile lookups when unnecessary (#10651)
This commit is contained in:
parent
716dfd8698
commit
21d91ce634
1 changed files with 7 additions and 3 deletions
|
@ -16,10 +16,10 @@ public org.bukkit.craftbukkit.profile.CraftPlayerProfile setProperty(Ljava/lang/
|
||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
|
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
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..68c99e29450e318d2b6eb83099e3e4012b6f0c01
|
index 0000000000000000000000000000000000000000..a750ec2cde2c6b3942806241b2d972cef57f3d44
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
|
+++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
|
||||||
@@ -0,0 +1,412 @@
|
@@ -0,0 +1,416 @@
|
||||||
+package com.destroystokyo.paper.profile;
|
+package com.destroystokyo.paper.profile;
|
||||||
+
|
+
|
||||||
+import com.mojang.authlib.yggdrasil.ProfileResult;
|
+import com.mojang.authlib.yggdrasil.ProfileResult;
|
||||||
|
@ -248,9 +248,13 @@ index 0000000000000000000000000000000000000000..68c99e29450e318d2b6eb83099e3e401
|
||||||
+ return complete(textures, GlobalConfiguration.get().proxies.isProxyOnlineMode());
|
+ return complete(textures, GlobalConfiguration.get().proxies.isProxyOnlineMode());
|
||||||
+ }
|
+ }
|
||||||
+ public boolean complete(boolean textures, boolean onlineMode) {
|
+ public boolean complete(boolean textures, boolean onlineMode) {
|
||||||
|
+ if (this.isComplete() && (!textures || hasTextures())) { // Don't do lookup if we already have everything
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ MinecraftServer server = MinecraftServer.getServer();
|
+ MinecraftServer server = MinecraftServer.getServer();
|
||||||
+ boolean isCompleteFromCache = this.completeFromCache(true, onlineMode);
|
+ boolean isCompleteFromCache = this.completeFromCache(true, onlineMode);
|
||||||
+ if (onlineMode && (!isCompleteFromCache || textures && !hasTextures())) {
|
+ if (onlineMode && (!isCompleteFromCache || (textures && !hasTextures()))) {
|
||||||
+ ProfileResult result = server.getSessionService().fetchProfile(this.getId(), true);
|
+ ProfileResult result = server.getSessionService().fetchProfile(this.getId(), true);
|
||||||
+ if (result != null && result.profile() != null) {
|
+ if (result != null && result.profile() != null) {
|
||||||
+ copyProfileProperties(result.profile(), this.profile, true);
|
+ copyProfileProperties(result.profile(), this.profile, true);
|
||||||
|
|
Loading…
Reference in a new issue