Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/patches/api/0083-Add-setPlayerProfile-API-for-Skulls.patch

91 Zeilen
3.6 KiB
Diff

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-06-07 18:24:39 +02:00
index b39128bb0ca2d4fe7a254193236c60fb5bfaa7da..5135b8e6028e6926e2711e2dd6ce68b76f468fd7 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-06-07 18:24:39 +02:00
@@ -63,6 +63,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
+ */
+ void setPlayerProfile(@NotNull com.destroystokyo.paper.profile.PlayerProfile profile);
2021-06-11 14:02:28 +02: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
+ */
+ @Nullable com.destroystokyo.paper.profile.PlayerProfile getPlayerProfile();
2021-06-11 14:02:28 +02:00
+ // Paper end
+
/**
* Gets the profile of the player who owns the skull. This player profile
* may appear as the texture depending on skull type.
2023-06-07 18:24:39 +02:00
@@ -70,6 +84,7 @@ public interface Skull extends TileState {
* @return the profile of the owning player
*/
@Nullable
+ @Deprecated // Paper
PlayerProfile getOwnerProfile();
/**
2023-06-07 18:24:39 +02:00
@@ -84,6 +99,7 @@ public interface Skull extends TileState {
* @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-06-07 18:24:39 +02:00
index 5a18a66a0b7877ec0c1859f78cce659db4b8541a..862640b4611458dfbcd3be797eacd120fc8d1f9f 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-06-07 18:24:39 +02:00
@@ -38,6 +38,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
+ */
+ void setPlayerProfile(@Nullable com.destroystokyo.paper.profile.PlayerProfile profile);
2021-06-11 14:02:28 +02: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
+ */
+ @Nullable com.destroystokyo.paper.profile.PlayerProfile getPlayerProfile();
2021-06-11 14:02:28 +02:00
+ // Paper end
+
/**
* Gets the owner of the skull.
*
2023-06-07 18:24:39 +02:00
@@ -64,6 +78,7 @@ public interface SkullMeta extends ItemMeta {
* @return the profile of the owning player
*/
@Nullable
+ @Deprecated // Paper
PlayerProfile getOwnerProfile();
/**
2023-06-07 18:24:39 +02:00
@@ -78,6 +93,7 @@ public interface SkullMeta extends ItemMeta {
* @throws IllegalArgumentException if the profile does not contain the
* necessary information
*/
+ @Deprecated // Paper
void setOwnerProfile(@Nullable PlayerProfile profile);
/**