2019-02-23 18:17:41 +01:00
|
|
|
From 6df1eea3118148d343e2ba943ed0e79e3272e981 Mon Sep 17 00:00:00 2001
|
2018-01-19 06:38:49 +01:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Fri, 19 Jan 2018 00:29:28 -0500
|
2018-08-06 07:24:55 +02:00
|
|
|
Subject: [PATCH] Add setPlayerProfile API for Skulls
|
2018-01-19 06:38:49 +01: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 07:24:55 +02:00
|
|
|
diff --git a/src/main/java/org/bukkit/block/Skull.java b/src/main/java/org/bukkit/block/Skull.java
|
2018-10-27 06:02:22 +02:00
|
|
|
index 499a153e..3c75341e 100644
|
2018-08-06 07:24:55 +02:00
|
|
|
--- a/src/main/java/org/bukkit/block/Skull.java
|
|
|
|
+++ b/src/main/java/org/bukkit/block/Skull.java
|
|
|
|
@@ -4,6 +4,8 @@ import org.bukkit.Material;
|
|
|
|
import org.bukkit.OfflinePlayer;
|
|
|
|
import org.bukkit.SkullType;
|
|
|
|
import org.bukkit.block.data.BlockData;
|
|
|
|
+import com.destroystokyo.paper.profile.PlayerProfile;
|
|
|
|
+import javax.annotation.Nullable;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents a captured state of a skull block.
|
|
|
|
@@ -55,6 +57,20 @@ public interface Skull extends BlockState {
|
|
|
|
*/
|
|
|
|
public void setOwningPlayer(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
|
|
|
|
+ */
|
|
|
|
+ void setPlayerProfile(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
|
|
|
|
+
|
|
|
|
/**
|
2018-10-27 06:02:22 +02:00
|
|
|
* Gets the rotation of the skull in the world (or facing direction if this
|
|
|
|
* is a wall mounted skull).
|
2018-01-19 06:38:49 +01:00
|
|
|
diff --git a/src/main/java/org/bukkit/inventory/meta/SkullMeta.java b/src/main/java/org/bukkit/inventory/meta/SkullMeta.java
|
2018-07-15 03:53:17 +02:00
|
|
|
index 15c1dfd9..a458000f 100644
|
2018-01-19 06:38:49 +01:00
|
|
|
--- a/src/main/java/org/bukkit/inventory/meta/SkullMeta.java
|
|
|
|
+++ b/src/main/java/org/bukkit/inventory/meta/SkullMeta.java
|
2018-07-15 03:53:17 +02:00
|
|
|
@@ -1,7 +1,10 @@
|
2018-01-19 06:38:49 +01:00
|
|
|
package org.bukkit.inventory.meta;
|
|
|
|
|
|
|
|
+import com.destroystokyo.paper.profile.PlayerProfile;
|
2018-07-15 03:53:17 +02:00
|
|
|
+import javax.annotation.Nullable;
|
2018-01-19 06:38:49 +01:00
|
|
|
import org.bukkit.OfflinePlayer;
|
|
|
|
|
|
|
|
+
|
|
|
|
/**
|
2018-07-15 03:53:17 +02:00
|
|
|
* Represents a skull that can have an owner.
|
2018-01-19 06:38:49 +01:00
|
|
|
*/
|
2018-07-15 03:53:17 +02:00
|
|
|
@@ -36,6 +39,20 @@ public interface SkullMeta extends ItemMeta {
|
2018-01-19 06:38:49 +01:00
|
|
|
@Deprecated
|
|
|
|
boolean setOwner(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
|
|
|
|
+ */
|
|
|
|
+ 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.
|
|
|
|
*
|
|
|
|
--
|
2019-02-23 18:17:41 +01:00
|
|
|
2.20.1
|
2018-01-19 06:38:49 +01:00
|
|
|
|