Revert to old createProfile(UUID, String) logic (#7723)

This commit is contained in:
Bjarne Koll 2022-04-22 20:54:08 +02:00 committed by GitHub
parent c449f6a1f7
commit ef6a1a5f99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 117 additions and 45 deletions

View file

@ -621,7 +621,7 @@ index c4142568c3188c89142799cc4911dd7eae32a45f..f379e108ec3c762940bddea878a0a711
String s1 = name.toLowerCase(Locale.ROOT);
GameProfileCache.GameProfileInfo usercache_usercacheentry = (GameProfileCache.GameProfileInfo) this.profilesByName.get(s1);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 6f1b1191426d864719e1b5cbd42bf5699e6193e3..59f3167c276d93c36b0b36ff0e36918cf498424b 100644
index 6f1b1191426d864719e1b5cbd42bf5699e6193e3..4dad4b95f263bd7cd086d87848ee8c8a862e1577 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -244,6 +244,9 @@ import org.yaml.snakeyaml.error.MarkedYAMLException;
@ -642,7 +642,7 @@ index 6f1b1191426d864719e1b5cbd42bf5699e6193e3..59f3167c276d93c36b0b36ff0e36918c
CraftItemFactory.instance();
}
@@ -2574,5 +2578,29 @@ public final class CraftServer implements Server {
@@ -2574,5 +2578,37 @@ public final class CraftServer implements Server {
public boolean suggestPlayerNamesWhenNullTabCompletions() {
return com.destroystokyo.paper.PaperConfig.suggestPlayersWhenNullTabCompletions;
}
@ -660,6 +660,14 @@ index 6f1b1191426d864719e1b5cbd42bf5699e6193e3..59f3167c276d93c36b0b36ff0e36918c
+ @Override
+ public com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String name) {
+ Player player = uuid != null ? Bukkit.getPlayer(uuid) : (name != null ? Bukkit.getPlayerExact(name) : null);
+ if (player != null) return new com.destroystokyo.paper.profile.CraftPlayerProfile((CraftPlayer) player);
+
+ return new com.destroystokyo.paper.profile.CraftPlayerProfile(uuid, name);
+ }
+
+ @Override
+ public com.destroystokyo.paper.profile.PlayerProfile createProfileExact(@Nullable UUID uuid, @Nullable String name) {
+ Player player = uuid != null ? Bukkit.getPlayer(uuid) : (name != null ? Bukkit.getPlayerExact(name) : null);
+ if (player == null) return new com.destroystokyo.paper.profile.CraftPlayerProfile(uuid, name);
+
+ if (Objects.equals(uuid, player.getUniqueId()) && Objects.equals(name, player.getName())) {