Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 20:40:07 +01:00
4ed5ab7c79
--- work/CraftBukkit Submodule work/CraftBukkit 297ff400..83af86db: > SPIGOT-5457: Downgrade 'Mismatch in destroy block pos' message to debug > SPIGOT-5481: PlayerBedLeaveEvent returns wrong bed location > SPIGOT-5482: Structure Block setUsageMode encounters NullpointerException > SPIGOT-5426: isSimilar for player heads fails > SPIGOT-5478: XP not dropping when a player dies --- work/Spigot Submodule work/Spigot 05bb8bcf..492a7792: > Rebuild patches
94 Zeilen
3.6 KiB
Diff
94 Zeilen
3.6 KiB
Diff
From 9027adb44adb78dd5a0b21f7a154b8c3e2063517 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 a4bc7f970..2dd2f476f 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;
|
|
@@ -15,6 +17,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 {
|
|
|
|
@@ -105,6 +108,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 4fb27cc7e..18545e5ef 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
|
@@ -3,6 +3,8 @@ package org.bukkit.craftbukkit.inventory;
|
|
import com.google.common.collect.ImmutableMap.Builder;
|
|
import com.mojang.authlib.GameProfile;
|
|
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;
|
|
@@ -16,6 +18,7 @@ import org.bukkit.craftbukkit.inventory.CraftMetaItem.SerializableMeta;
|
|
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
|
import org.bukkit.inventory.meta.SkullMeta;
|
|
|
|
+import javax.annotation.Nullable;
|
|
@DelegateDeserialization(SerializableMeta.class)
|
|
class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
|
|
|
|
@@ -133,6 +136,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.24.1
|
|
|