2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Fri, 19 Jan 2018 00:29:28 -0500
|
|
|
|
Subject: [PATCH] Add setPlayerProfile API for Skulls
|
|
|
|
|
|
|
|
This allows you to create already filled textures on Skulls to avoid texture lookups
|
|
|
|
which commonly cause rate limit issues with Mojang API
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/block/Skull.java b/src/main/java/org/bukkit/block/Skull.java
|
2023-04-09 02:00:50 +02:00
|
|
|
index fab2ca9f6c7738795cfedbb6d0d2206f13e9da8a..33ae32155d12ecd58a2a6434dba229043d4e2132 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/block/Skull.java
|
|
|
|
+++ b/src/main/java/org/bukkit/block/Skull.java
|
2023-04-09 02:00:50 +02:00
|
|
|
@@ -65,6 +65,20 @@ public interface Skull extends TileState {
|
2021-06-11 14:02:28 +02:00
|
|
|
*/
|
|
|
|
public void setOwningPlayer(@NotNull OfflinePlayer player);
|
|
|
|
|
|
|
|
+ // Paper start
|
|
|
|
+ /**
|
|
|
|
+ * Sets this skull to use the supplied Player Profile, which can include textures already prefilled.
|
|
|
|
+ * @param profile The profile to set this Skull to use, may not be null
|
|
|
|
+ */
|
2022-02-12 14:20:33 +01:00
|
|
|
+ void setPlayerProfile(@NotNull com.destroystokyo.paper.profile.PlayerProfile profile);
|
2021-06-11 14:02:28 +02:00
|
|
|
+
|
|
|
|
+ /**
|
2022-02-12 14:20:33 +01:00
|
|
|
+ * If the skull has an owner, per {@link #hasOwner()}, return the owners {@link com.destroystokyo.paper.profile.PlayerProfile}
|
2021-06-11 14:02:28 +02:00
|
|
|
+ * @return The profile of the owner, if set
|
|
|
|
+ */
|
2022-02-12 14:20:33 +01:00
|
|
|
+ @Nullable com.destroystokyo.paper.profile.PlayerProfile getPlayerProfile();
|
2021-06-11 14:02:28 +02:00
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
/**
|
2022-02-12 14:20:33 +01:00
|
|
|
* Gets the profile of the player who owns the skull. This player profile
|
|
|
|
* may appear as the texture depending on skull type.
|
2023-04-09 02:00:50 +02:00
|
|
|
@@ -72,6 +86,7 @@ public interface Skull extends TileState {
|
2022-02-12 14:20:33 +01:00
|
|
|
* @return the profile of the owning player
|
|
|
|
*/
|
|
|
|
@Nullable
|
|
|
|
+ @Deprecated // Paper
|
|
|
|
PlayerProfile getOwnerProfile();
|
|
|
|
|
|
|
|
/**
|
2023-04-09 02:00:50 +02:00
|
|
|
@@ -86,6 +101,7 @@ public interface Skull extends TileState {
|
2022-02-12 14:20:33 +01:00
|
|
|
* @throws IllegalArgumentException if the profile does not contain the
|
|
|
|
* necessary information
|
|
|
|
*/
|
|
|
|
+ @Deprecated // Paper
|
|
|
|
void setOwnerProfile(@Nullable PlayerProfile profile);
|
|
|
|
|
|
|
|
/**
|
2021-06-11 14:02:28 +02:00
|
|
|
diff --git a/src/main/java/org/bukkit/inventory/meta/SkullMeta.java b/src/main/java/org/bukkit/inventory/meta/SkullMeta.java
|
2023-04-09 02:00:50 +02:00
|
|
|
index 461cdecc3e8f45b63f17963031b16943309909e2..1808e1315c72f983817426420eb22434c6a65024 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/inventory/meta/SkullMeta.java
|
|
|
|
+++ b/src/main/java/org/bukkit/inventory/meta/SkullMeta.java
|
2023-04-09 02:00:50 +02:00
|
|
|
@@ -40,6 +40,20 @@ public interface SkullMeta extends ItemMeta {
|
2021-06-11 14:02:28 +02:00
|
|
|
@Deprecated
|
|
|
|
boolean setOwner(@Nullable String owner);
|
|
|
|
|
|
|
|
+ // Paper start
|
|
|
|
+ /**
|
|
|
|
+ * Sets this skull to use the supplied Player Profile, which can include textures already prefilled.
|
|
|
|
+ * @param profile The profile to set this Skull to use, or null to clear owner
|
|
|
|
+ */
|
2022-02-12 14:20:33 +01:00
|
|
|
+ void setPlayerProfile(@Nullable com.destroystokyo.paper.profile.PlayerProfile profile);
|
2021-06-11 14:02:28 +02:00
|
|
|
+
|
|
|
|
+ /**
|
2022-02-12 14:20:33 +01:00
|
|
|
+ * If the skull has an owner, per {@link #hasOwner()}, return the owners {@link com.destroystokyo.paper.profile.PlayerProfile}
|
2021-06-11 14:02:28 +02:00
|
|
|
+ * @return The profile of the owner, if set
|
|
|
|
+ */
|
2022-02-12 14:20:33 +01:00
|
|
|
+ @Nullable com.destroystokyo.paper.profile.PlayerProfile getPlayerProfile();
|
2021-06-11 14:02:28 +02:00
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* Gets the owner of the skull.
|
|
|
|
*
|
2023-04-09 02:00:50 +02:00
|
|
|
@@ -66,6 +80,7 @@ public interface SkullMeta extends ItemMeta {
|
2022-02-12 14:20:33 +01:00
|
|
|
* @return the profile of the owning player
|
|
|
|
*/
|
|
|
|
@Nullable
|
|
|
|
+ @Deprecated // Paper
|
|
|
|
PlayerProfile getOwnerProfile();
|
|
|
|
|
|
|
|
/**
|
2023-04-09 02:00:50 +02:00
|
|
|
@@ -80,6 +95,7 @@ public interface SkullMeta extends ItemMeta {
|
2022-02-12 14:20:33 +01:00
|
|
|
* @throws IllegalArgumentException if the profile does not contain the
|
|
|
|
* necessary information
|
|
|
|
*/
|
|
|
|
+ @Deprecated // Paper
|
|
|
|
void setOwnerProfile(@Nullable PlayerProfile profile);
|
|
|
|
|
2022-12-26 18:53:35 +01:00
|
|
|
/**
|