Paper/patches/server/0047-Use-UserCache-for-player-heads.patch
2023-09-21 21:54:46 +02:00

26 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@outlook.com>
Date: Wed, 2 Mar 2016 23:42:37 -0600
Subject: [PATCH] Use UserCache for player heads
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
index 0a6003248178d239c8b9a81a558f6bcf1173f00a..f8e2315845b15af230f43521b53f943ee58b9117 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
@@ -211,7 +211,13 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
if (name == null) {
this.setProfile(null);
} else {
- this.setProfile(new CraftGameProfile(null, name));
+ // Paper start - Use Online Players Skull
+ GameProfile newProfile = null;
+ net.minecraft.server.level.ServerPlayer player = net.minecraft.server.MinecraftServer.getServer().getPlayerList().getPlayerByName(name);
+ if (player != null) newProfile = player.getGameProfile();
+ if (newProfile == null) newProfile = new CraftGameProfile(null, name);
+ this.setProfile(newProfile);
+ // Paper end
}
return true;