2020-01-22 02:02:07 +00:00
|
|
|
From cbdb821df0d1d148d04aeda9d0f83199e90c6f72 Mon Sep 17 00:00:00 2001
|
2018-01-19 05:38:49 +00:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Fri, 19 Jan 2018 00:29:28 -0500
|
2018-08-06 05:24:55 +00:00
|
|
|
Subject: [PATCH] Add setPlayerProfile API for Skulls
|
2018-01-19 05:38:49 +00:00
|
|
|
|
|
|
|
This allows you to create already filled textures on Skulls to avoid texture lookups
|
|
|
|
which commonly cause rate limit issues with Mojang API
|
|
|
|
|
2018-08-06 05:24:55 +00:00
|
|
|
diff --git a/src/main/java/org/bukkit/block/Skull.java b/src/main/java/org/bukkit/block/Skull.java
|
2020-01-22 02:02:07 +00:00
|
|
|
index 943d751f..a6914f01 100644
|
2018-08-06 05:24:55 +00:00
|
|
|
--- a/src/main/java/org/bukkit/block/Skull.java
|
|
|
|
+++ b/src/main/java/org/bukkit/block/Skull.java
|
2019-03-20 00:28:15 +00:00
|
|
|
@@ -7,6 +7,7 @@ import org.bukkit.block.data.BlockData;
|
|
|
|
import org.jetbrains.annotations.Contract;
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
+import com.destroystokyo.paper.profile.PlayerProfile; // Paper
|
2018-08-06 05:24:55 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents a captured state of a skull block.
|
2019-05-06 02:58:04 +00:00
|
|
|
@@ -61,6 +62,20 @@ public interface Skull extends TileState {
|
2018-08-06 05:24:55 +00:00
|
|
|
*/
|
2019-03-20 00:28:15 +00:00
|
|
|
public void setOwningPlayer(@NotNull OfflinePlayer player);
|
2018-08-06 05:24:55 +00:00
|
|
|
|
|
|
|
+ // 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
|
|
|
|
+ */
|
2019-03-20 00:28:15 +00:00
|
|
|
+ void setPlayerProfile(@NotNull PlayerProfile profile);
|
2018-08-06 05:24:55 +00:00
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * If the skull has an owner, per {@link #hasOwner()}, return the owners {@link PlayerProfile}
|
|
|
|
+ * @return The profile of the owner, if set
|
|
|
|
+ */
|
|
|
|
+ @Nullable PlayerProfile getPlayerProfile();
|
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
/**
|
2018-10-27 04:02:22 +00:00
|
|
|
* Gets the rotation of the skull in the world (or facing direction if this
|
|
|
|
* is a wall mounted skull).
|
2018-01-19 05:38:49 +00:00
|
|
|
diff --git a/src/main/java/org/bukkit/inventory/meta/SkullMeta.java b/src/main/java/org/bukkit/inventory/meta/SkullMeta.java
|
2020-01-22 02:02:07 +00:00
|
|
|
index 35a39203..8b2465ea 100644
|
2018-01-19 05:38:49 +00:00
|
|
|
--- a/src/main/java/org/bukkit/inventory/meta/SkullMeta.java
|
|
|
|
+++ b/src/main/java/org/bukkit/inventory/meta/SkullMeta.java
|
2019-03-20 00:28:15 +00:00
|
|
|
@@ -1,9 +1,11 @@
|
2018-01-19 05:38:49 +00:00
|
|
|
package org.bukkit.inventory.meta;
|
|
|
|
|
|
|
|
+import com.destroystokyo.paper.profile.PlayerProfile;
|
|
|
|
import org.bukkit.OfflinePlayer;
|
2019-03-20 00:28:15 +00:00
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
import org.jetbrains.annotations.Nullable;
|
2018-01-19 05:38:49 +00:00
|
|
|
|
|
|
|
+
|
|
|
|
/**
|
2018-07-15 01:53:17 +00:00
|
|
|
* Represents a skull that can have an owner.
|
2018-01-19 05:38:49 +00:00
|
|
|
*/
|
2019-03-20 00:28:15 +00:00
|
|
|
@@ -36,6 +38,20 @@ public interface SkullMeta extends ItemMeta {
|
2018-01-19 05:38:49 +00:00
|
|
|
@Deprecated
|
2019-03-20 00:28:15 +00:00
|
|
|
boolean setOwner(@Nullable String owner);
|
2018-01-19 05:38:49 +00:00
|
|
|
|
|
|
|
+ // 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
|
|
|
|
+ */
|
|
|
|
+ void setPlayerProfile(@Nullable PlayerProfile profile);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * If the skull has an owner, per {@link #hasOwner()}, return the owners {@link PlayerProfile}
|
|
|
|
+ * @return The profile of the owner, if set
|
|
|
|
+ */
|
|
|
|
+ @Nullable PlayerProfile getPlayerProfile();
|
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* Gets the owner of the skull.
|
|
|
|
*
|
|
|
|
--
|
2020-01-22 02:02:07 +00:00
|
|
|
2.25.0.windows.1
|
2018-01-19 05:38:49 +00:00
|
|
|
|