Fix profile requests being made on offline mode servers
Closes #1076
Dieser Commit ist enthalten in:
Ursprung
242d671fa9
Commit
dc772289f8
@ -1,4 +1,4 @@
|
||||
From 8660aebe21b1e188d8657e726f5e5e9c3baa136e Mon Sep 17 00:00:00 2001
|
||||
From 0609cc1f82cd0a16e7d0acf66c5e6cbf9b7f24ac Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 15 Jan 2018 22:11:48 -0500
|
||||
Subject: [PATCH] Basic PlayerProfile API
|
||||
@ -6,10 +6,10 @@ 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 00000000..8cc85be8
|
||||
index 000000000..9ad5853de
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
|
||||
@@ -0,0 +1,276 @@
|
||||
@@ -0,0 +1,281 @@
|
||||
+package com.destroystokyo.paper.profile;
|
||||
+
|
||||
+import com.destroystokyo.paper.PaperConfig;
|
||||
@ -150,6 +150,9 @@ index 00000000..8cc85be8
|
||||
+ }
|
||||
+
|
||||
+ public boolean completeFromCache(boolean lookupName) {
|
||||
+ if (profile.isComplete()) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ MinecraftServer server = MinecraftServer.getServer();
|
||||
+ String name = profile.getName();
|
||||
+ UserCache userCache = server.getUserCache();
|
||||
@ -181,13 +184,15 @@ index 00000000..8cc85be8
|
||||
+ public boolean complete(boolean textures) {
|
||||
+ MinecraftServer server = MinecraftServer.getServer();
|
||||
+
|
||||
+ if (!this.completeFromCache(true) || textures && !hasTextures()) {
|
||||
+ boolean isOnlineMode = server.getOnlineMode() || (SpigotConfig.bungee && PaperConfig.bungeeOnlineMode);
|
||||
+ boolean isCompleteFromCache = this.completeFromCache(true);
|
||||
+ if (isOnlineMode && (!isCompleteFromCache || textures && !hasTextures())) {
|
||||
+ GameProfile result = server.getSessionService().fillProfileProperties(profile, true);
|
||||
+ if (result != null) {
|
||||
+ this.profile = result;
|
||||
+ }
|
||||
+ }
|
||||
+ return profile.isComplete() && (!textures || hasTextures());
|
||||
+ return profile.isComplete() && (!isOnlineMode || !textures || hasTextures());
|
||||
+ }
|
||||
+
|
||||
+ private static void copyProfileProperties(GameProfile source, GameProfile target) {
|
||||
@ -287,7 +292,7 @@ index 00000000..8cc85be8
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
index 02940d69..4539b560 100644
|
||||
index 02940d697..4539b5601 100644
|
||||
--- a/src/main/java/net/minecraft/server/MCUtil.java
|
||||
+++ b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
@@ -1,6 +1,9 @@
|
||||
@ -312,7 +317,7 @@ index 02940d69..4539b560 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 e8bddc17..3b01ebd9 100644
|
||||
index e8bddc171..3b01ebd96 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1538,6 +1538,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
|
||||
@ -324,7 +329,7 @@ index e8bddc17..3b01ebd9 100644
|
||||
return this.W;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java
|
||||
index 7ce08eb8..6a750c25 100644
|
||||
index 7ce08eb8b..6a750c25e 100644
|
||||
--- a/src/main/java/net/minecraft/server/UserCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/UserCache.java
|
||||
@@ -44,7 +44,7 @@ public class UserCache {
|
||||
@ -360,7 +365,7 @@ index 7ce08eb8..6a750c25 100644
|
||||
|
||||
private UserCacheEntry(GameProfile gameprofile, Date date) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 77c16fe2..2dd7ed96 100644
|
||||
index 77c16fe2c..2dd7ed96a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -135,6 +135,10 @@ import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
@ -397,5 +402,5 @@ index 77c16fe2..2dd7ed96 100644
|
||||
// Paper end
|
||||
}
|
||||
--
|
||||
2.14.3
|
||||
2.16.2
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren