mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
parent
57e7f2a19d
commit
e9cbd7b668
2 changed files with 78 additions and 3 deletions
|
@ -1,11 +1,45 @@
|
|||
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 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
|
||||
@@ -0,0 +0,0 @@ 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.
|
||||
@@ -0,0 +0,0 @@ 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
|
|
@ -1,13 +1,54 @@
|
|||
From 0000000000000000000000000000000000000000 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
|
||||
@@ -0,0 +0,0 @@
|
||||
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;
|
||||
@@ -0,0 +0,0 @@ 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 {
|
||||
|
||||
@@ -0,0 +0,0 @@ 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
|
||||
@@ -0,0 +0,0 @@ package org.bukkit.craftbukkit.inventory;
|
Loading…
Reference in a new issue