mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-03 17:29:56 +01:00
fb25dc17c6
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: da08d022 SPIGOT-4700: Add PlayerFishEvent.State.REEL_IN 0cef14e4 Remove draft API from selectEntities CraftBukkit Changes:a46fdbc6
Remove outdated build delay.3697519b
SPIGOT-4708: Fix ExactChoice recipes neglecting material9ead7009
SPIGOT-4677: Add minecraft.admin.command_feedback permissionc3749a23
Remove the Damage tag from items when it is 0.f74c7b95
SPIGOT-4706: Can't interact with active item494eef45
Mention requirement of JIRA ticket for bug fixes51d62dec
SPIGOT-4702: Exception when middle clicking certain slotsbe557e69
SPIGOT-4700: Add PlayerFishEvent.State.REEL_IN
95 lines
3.4 KiB
Diff
95 lines
3.4 KiB
Diff
From 4391ebacd07855f754c975a03878cd52421ba6af Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Fri, 19 Jan 2018 00:36:25 -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/craftbukkit/block/CraftSkull.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java
|
|
index 110e04597b..c260af11cd 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;
|
|
@@ -16,6 +18,7 @@ import org.bukkit.block.data.BlockData;
|
|
import org.bukkit.block.data.Directional;
|
|
import org.bukkit.block.data.Rotatable;
|
|
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
|
+import javax.annotation.Nullable;
|
|
|
|
public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implements Skull {
|
|
|
|
@@ -106,6 +109,20 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
|
|
}
|
|
}
|
|
|
|
+ // 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() {
|
|
BlockData blockData = getBlockData();
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
|
index 2ad3acf43b..87e51cf8ad 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;
|
|
|
|
import java.util.Map;
|
|
|
|
+import com.destroystokyo.paper.profile.CraftPlayerProfile;
|
|
+import com.destroystokyo.paper.profile.PlayerProfile;
|
|
import net.minecraft.server.GameProfileSerializer;
|
|
import net.minecraft.server.NBTBase;
|
|
import net.minecraft.server.NBTTagCompound;
|
|
@@ -20,6 +22,8 @@ import org.bukkit.inventory.meta.SkullMeta;
|
|
import com.google.common.collect.ImmutableMap.Builder;
|
|
import com.mojang.authlib.GameProfile;
|
|
|
|
+import javax.annotation.Nullable;
|
|
+
|
|
@DelegateDeserialization(SerializableMeta.class)
|
|
class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
|
|
|
|
@@ -133,6 +137,19 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
|
|
return hasOwner() ? profile.getName() : null;
|
|
}
|
|
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public void setPlayerProfile(@Nullable PlayerProfile profile) {
|
|
+ this.profile = (profile == null) ? null : CraftPlayerProfile.asAuthlibCopy(profile);
|
|
+ }
|
|
+
|
|
+ @Nullable
|
|
+ @Override
|
|
+ public PlayerProfile getPlayerProfile() {
|
|
+ return profile != null ? CraftPlayerProfile.asBukkitCopy(profile) : null;
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
@Override
|
|
public OfflinePlayer getOwningPlayer() {
|
|
if (hasOwner()) {
|
|
--
|
|
2.21.0
|
|
|