From d830eb6f47e89e4fbc8dfcd2388e769e53f03828 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Thu, 29 Apr 2021 02:03:23 +0200 Subject: [PATCH 1/3] Little Skull Patch --- SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java b/SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java index adf1b9c..d31f937 100644 --- a/SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java +++ b/SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java @@ -19,7 +19,9 @@ package de.steamwar.inventory; +import org.bukkit.Bukkit; import org.bukkit.Material; +import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.SkullMeta; @@ -269,7 +271,12 @@ class SWItem_14 { ItemStack head = new ItemStack(Material.PLAYER_HEAD, 1); SkullMeta headmeta = (SkullMeta) head.getItemMeta(); assert headmeta != null; - headmeta.setOwner(player); + Player p = Bukkit.getPlayer(player); + if (p != null) { + headmeta.setOwningPlayer(p); + } else { + headmeta.setOwner(player); + } headmeta.setDisplayName(player); head.setItemMeta(headmeta); return head; From 24f605daf2713ae4e685960e5003a349553922c1 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Thu, 29 Apr 2021 02:04:37 +0200 Subject: [PATCH 2/3] Minor Fix --- SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java b/SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java index d31f937..08b3fee 100644 --- a/SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java +++ b/SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java @@ -271,7 +271,7 @@ class SWItem_14 { ItemStack head = new ItemStack(Material.PLAYER_HEAD, 1); SkullMeta headmeta = (SkullMeta) head.getItemMeta(); assert headmeta != null; - Player p = Bukkit.getPlayer(player); + Player p = Bukkit.getPlayerExact(player); if (p != null) { headmeta.setOwningPlayer(p); } else { From 6c2d9d067f07330ac702ab3fcadf465d0de1645a Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Thu, 29 Apr 2021 12:02:12 +0200 Subject: [PATCH 3/3] Even more Cache --- SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java b/SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java index 08b3fee..623dd20 100644 --- a/SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java +++ b/SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java @@ -21,7 +21,6 @@ package de.steamwar.inventory; import org.bukkit.Bukkit; import org.bukkit.Material; -import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.SkullMeta; @@ -271,12 +270,7 @@ class SWItem_14 { ItemStack head = new ItemStack(Material.PLAYER_HEAD, 1); SkullMeta headmeta = (SkullMeta) head.getItemMeta(); assert headmeta != null; - Player p = Bukkit.getPlayerExact(player); - if (p != null) { - headmeta.setOwningPlayer(p); - } else { - headmeta.setOwner(player); - } + headmeta.setOwningPlayer(Bukkit.getOfflinePlayer(player)); headmeta.setDisplayName(player); head.setItemMeta(headmeta); return head;