forked from PaperMC/Paper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
0083-Add-setPlayerProfile-API-for-Skulls.patch
90 lines (82 loc) · 3.57 KB
/
0083-Add-setPlayerProfile-API-for-Skulls.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
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
index 83ca284e02f0c2229126d8f40cb33b18f44524d3..d89da5e370d95cfbc4dac776a64e402c5c1f5fc1 100644
--- a/src/main/java/org/bukkit/block/Skull.java
+++ b/src/main/java/org/bukkit/block/Skull.java
@@ -62,6 +62,20 @@ public interface Skull extends TileState {
*/
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
+ */
+ void setPlayerProfile(@NotNull com.destroystokyo.paper.profile.PlayerProfile profile);
+
+ /**
+ * If the skull has an owner, per {@link #hasOwner()}, return the owners {@link com.destroystokyo.paper.profile.PlayerProfile}
+ * @return The profile of the owner, if set
+ */
+ @Nullable com.destroystokyo.paper.profile.PlayerProfile getPlayerProfile();
+ // Paper end
+
/**
* Gets the profile of the player who owns the skull. This player profile
* may appear as the texture depending on skull type.
@@ -69,6 +83,7 @@ public interface Skull extends TileState {
* @return the profile of the owning player
*/
@Nullable
+ @Deprecated // Paper
PlayerProfile getOwnerProfile();
/**
@@ -83,6 +98,7 @@ public interface Skull extends TileState {
* @throws IllegalArgumentException if the profile does not contain the
* necessary information
*/
+ @Deprecated // Paper
void setOwnerProfile(@Nullable PlayerProfile profile);
/**
diff --git a/src/main/java/org/bukkit/inventory/meta/SkullMeta.java b/src/main/java/org/bukkit/inventory/meta/SkullMeta.java
index dcefd0eea9461441c4209d587896d704389487d0..9ad062968335ee02bff5353d8c63c330d9338cd7 100644
--- a/src/main/java/org/bukkit/inventory/meta/SkullMeta.java
+++ b/src/main/java/org/bukkit/inventory/meta/SkullMeta.java
@@ -37,6 +37,20 @@ public interface SkullMeta extends ItemMeta {
@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
+ */
+ void setPlayerProfile(@Nullable com.destroystokyo.paper.profile.PlayerProfile profile);
+
+ /**
+ * If the skull has an owner, per {@link #hasOwner()}, return the owners {@link com.destroystokyo.paper.profile.PlayerProfile}
+ * @return The profile of the owner, if set
+ */
+ @Nullable com.destroystokyo.paper.profile.PlayerProfile getPlayerProfile();
+ // Paper end
+
/**
* Gets the owner of the skull.
*
@@ -63,6 +77,7 @@ public interface SkullMeta extends ItemMeta {
* @return the profile of the owning player
*/
@Nullable
+ @Deprecated // Paper
PlayerProfile getOwnerProfile();
/**
@@ -77,6 +92,7 @@ public interface SkullMeta extends ItemMeta {
* @throws IllegalArgumentException if the profile does not contain the
* necessary information
*/
+ @Deprecated // Paper
void setOwnerProfile(@Nullable PlayerProfile profile);
@Override