mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 11:58:06 +01:00
parent
a57facb10c
commit
d5eb80049c
@ -1,11 +1,45 @@
|
||||
From 0a29a32a10268a1478ad045924aa706d7da5685a Mon Sep 17 00:00:00 2001
|
||||
From 55e3e61db93e7dba8a19a6f2094fccf3b2fcab2f Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 19 Jan 2018 00:29:28 -0500
|
||||
Subject: [PATCH] Add SkullMeta.setPlayerProfile API
|
||||
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 92363d33..b83df2f7 100644
|
||||
--- 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
|
||||
+
|
||||
/**
|
||||
* Gets the rotation of the skull in the world
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/inventory/meta/SkullMeta.java b/src/main/java/org/bukkit/inventory/meta/SkullMeta.java
|
||||
index 15c1dfd9..a458000f 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/meta/SkullMeta.java
|
||||
@ -43,5 +77,5 @@ index 15c1dfd9..a458000f 100644
|
||||
* Gets the owner of the skull.
|
||||
*
|
||||
--
|
||||
2.18.0
|
||||
2.16.1.windows.1
|
||||
|
@ -1,13 +1,54 @@
|
||||
From df8ebfaa4210ab08be4e6555bd8ebd08353a8a39 Mon Sep 17 00:00:00 2001
|
||||
From 72c9d4a3673cc9e9bff91d550b9fd598b38df04f Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 19 Jan 2018 00:36:25 -0500
|
||||
Subject: [PATCH] Add SkullMeta.setPlayerProfile API
|
||||
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/craftbukkit/block/CraftSkull.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java
|
||||
index f113da713..fdfe101ae 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.bukkit.craftbukkit.block;
|
||||
|
||||
+import com.destroystokyo.paper.profile.CraftPlayerProfile;
|
||||
+import com.destroystokyo.paper.profile.PlayerProfile;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
@@ -13,6 +15,7 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.Skull;
|
||||
import org.bukkit.block.data.Rotatable;
|
||||
+import javax.annotation.Nullable;
|
||||
|
||||
public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implements Skull {
|
||||
|
||||
@@ -99,6 +102,20 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
|
||||
this.profile = new GameProfile(player.getUniqueId(), player.getName());
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public void setPlayerProfile(PlayerProfile profile) {
|
||||
+ Preconditions.checkNotNull(profile, "profile");
|
||||
+ this.profile = CraftPlayerProfile.asAuthlibCopy(profile);
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ @Override
|
||||
+ public PlayerProfile getPlayerProfile() {
|
||||
+ return profile != null ? CraftPlayerProfile.asBukkitCopy(profile) : null;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public BlockFace getRotation() {
|
||||
return ((Rotatable) getBlockData()).getRotation();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
||||
index 7984c68cb0..14d8dd65ac 100644
|
||||
index 7984c68cb..14d8dd65a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
||||
@@ -2,6 +2,8 @@ package org.bukkit.craftbukkit.inventory;
|
||||
@ -49,5 +90,5 @@ index 7984c68cb0..14d8dd65ac 100644
|
||||
public OfflinePlayer getOwningPlayer() {
|
||||
if (hasOwner()) {
|
||||
--
|
||||
2.18.0
|
||||
2.16.1.windows.1
|
||||
|
Loading…
Reference in New Issue
Block a user